Skip to content

fix(lzma2): restore Debug/Clone on Encoder; document the stub→struct break#95

Merged
MagicalTux merged 1 commit into
masterfrom
fix-lzma2-encoder-semver
Jun 14, 2026
Merged

fix(lzma2): restore Debug/Clone on Encoder; document the stub→struct break#95
MagicalTux merged 1 commit into
masterfrom
fix-lzma2-encoder-semver

Conversation

@MagicalTux

Copy link
Copy Markdown
Member

Addresses the cargo-semver-checks findings on compcol::lzma2::Encoder after the raw LZMA2 encoder landed (#94). That change turned a permanently-Unsupported unit-struct stub into a real stateful encoder, which cargo-semver-checks reported as four API breaks.

What this PR does

  • Restores Debug + Clone on lzma2::Encoder (and adds Debug to the internal EncoderParams so the derive composes). Those two derives were dropped by oversight, not by necessity — re-adding them removes two of the four reported breaks.
  • Documents the remaining change in the type docs and CHANGELOG (### Changed, marked Breaking).

What can't be "fixed" (intrinsic, by design)

Two breaks are inherent to making the encoder real and cannot be removed without reverting the feature:

Lint Why it's unavoidable
Encoder no longer derives Copy The working encoder buffers chunk state (Vec<u8>), so it can't be a zero-sized Copy type.
unit_struct_changed_kind A unit struct has no fields; a streaming encoder must hold state across encode/finish calls.

cargo semver-checks therefore (correctly) reports "requires new major version" — i.e. a 0.7.0 bump under pre-1.0 semver. There is no cargo-semver-checks gate in CI; release-plz consumes exactly this signal to pick the version, so the next release PR will be 0.7.0. This PR minimizes the surface so that bump is the only break, and is fully documented.

The only alternative that keeps the crate 0.6.x-compatible would be to revert the raw LZMA2 encoder back to the stub (losing the feature). This PR assumes you want to keep the encoder and accept the 0.7.0 bump; say the word if you'd rather revert.

Checks

  • cargo build --all-features, cargo test --all-features (61 suites green), cargo fmt --check, cargo clippy --all-features --all-targets -D warnings, rustdoc -D warnings — all clean.
  • cargo semver-checks: down from 4 breaks to the 2 intrinsic ones above.

🤖 Generated with Claude Code

…break

The raw LZMA2 encoder (added in the previous release cycle) turned the
former permanently-`Unsupported` `lzma2::Encoder` unit-struct stub into a
real stateful encoder. cargo-semver-checks flagged four API changes; two of
them — the dropped `Debug` and `Clone` derives — were an oversight, not
inherent to the change.

- Re-derive `Debug` + `Clone` on `lzma2::Encoder` (and add `Debug` to the
  internal `EncoderParams` so the derive composes).
- Document, in the type docs and the CHANGELOG, that the encoder is now a
  stateful struct and intentionally no longer `Copy` / no longer a unit
  struct — the two remaining, unavoidable breaking changes (a buffering
  encoder cannot be a zero-sized `Copy` type). These drive the next
  minor (0.7.0) release per pre-1.0 semver.

No behavior change; full suite, fmt, clippy, and docs remain green.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@MagicalTux MagicalTux merged commit d2b8e1f into master Jun 14, 2026
41 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant