fix(lzma2): restore Debug/Clone on Encoder; document the stub→struct break#95
Merged
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Addresses the
cargo-semver-checksfindings oncompcol::lzma2::Encoderafter the raw LZMA2 encoder landed (#94). That change turned a permanently-Unsupportedunit-struct stub into a real stateful encoder, whichcargo-semver-checksreported as four API breaks.What this PR does
Debug+Cloneonlzma2::Encoder(and addsDebugto the internalEncoderParamsso the derive composes). Those two derives were dropped by oversight, not by necessity — re-adding them removes two of the four reported breaks.### 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:
Encoderno longer derivesCopyVec<u8>), so it can't be a zero-sizedCopytype.unit_struct_changed_kindencode/finishcalls.cargo semver-checkstherefore (correctly) reports "requires new major version" — i.e. a0.7.0bump under pre-1.0 semver. There is nocargo-semver-checksgate in CI; release-plz consumes exactly this signal to pick the version, so the next release PR will be0.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 the0.7.0bump; 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