Releases: obi1kenobi/cargo-semver-checks
v0.36.0
What's changed
We're debuting a new "Spotlight" section in the release notes! We'll use it to shine a spotlight at aspects of cargo-semver-checks that don't usually get flashy headlines, even though they play a critical role.
In this release:
- Spotlight: Supporting many Rust versions at once
- 5 new lints (94 total, who will add lint number 💯?)
- Performance upgrades
- Support for comma-separated feature lists
This release requires Rust 1.77+ both to install (MSRV) and at runtime. Future releases will require Rust 1.80+.
Spotlight: Supporting many Rust versions at once
cargo-semver-checks uses the JSON output of Rust's rustdoc
tool to analyze your APIs. This JSON format is not stable: between the release of Rust 1.77 on March 21, 2024 and today, we've had 9 mutually-incompatible format versions. That's more than one per month!
Most tools that rely on rustdoc JSON support only a single rustdoc format at a time. The user is required to install the version of the tool that matches the rustdoc format their Rust version provides. This works, but at the cost of pushing extra complexity onto the users.
Instead, we wanted to offer a seamless experience: use reasonably new Rust and newer cargo-semver-checks, and everything just works! Pulling this off required declarative queries, cutting-edge database technology, and the Trustfall query engine, and were described in depth in UA Rust 2024 and RustConf 2024 talks. The talk videos aren't online yet, so please follow along on social media (bsky, Mastodon, Twitter) or by subscribing to blog posts to make sure you don't miss them when they come out ✨
Today's cargo-semver-checks supports all stable Rust versions 1.77-1.82, as well as 1.83 beta and the most recent nightly. Today we set a new record in how many rustdoc formats we support at once! All the maintenance required to make this work is a challenge, and we are grateful to our GitHub Sponsors for supporting this work 💖
New lints
enum_no_repr_variant_discriminant_changed
by @dmatos2012 in #912struct_with_no_pub_fields_changed
by @CommanderStorm in #962struct_marked_non_exhaustive_changed_type
by @CommanderStorm in #963declarative_macro_missing
by @miikka in #966trait_added_supertrait
by @mrnossiom in #892
We're now at 94 lints! Who is going to add lint number 💯?
Performance upgrades
In any reasonably well-optimized system, ongoing performance wins usually come in the form of "5% here, 10% there" rather than "10x with this one weird trick." This is now true for cargo-semver-checks as well.
In coordination with the Rust project's T-rustdoc team, and with the tireless efforts of @jalil-salame, cargo-semver-checks users now benefit from:
- ~6-7% smaller rustdoc JSON files, which consume less disk space to cache and are ~28% faster to load
- more compact indexes which are ~12% faster to build
This translates to up to ~0.8s time savings for our largest projects, and even more speedup on resource-constrained CI hardware where disk and network I/O are usually much slower than on a desktop machine.
Support for comma-separated feature lists
Previously, our CLI did not support specifying multiple features as a comma-separated list — the following did not work:
cargo semver-checks --features foo,bar
Instead, users had to specify each feature separately, which was quite tedious:
cargo semver-checks --features foo --features bar
Thanks to @dmatos2012, the --features
, --baseline-features
, and --curent-features
CLI options now all support comma-separated lists. What a lovely user experience win!
All Merged PRs
- Filter versions in lint reference links in snapshots by @suaviloquence in #913
- Functionality for unstable feature flags and options by @suaviloquence in #896
- Add next Rust minor to test matrix by @obi1kenobi in #917
- Add support for specifying features with commas
feat1,feat2
by @dmatos2012 in #918 - Encapsulate query deserializing logic by @suaviloquence in #919
- Weekly
cargo update
of dependencies by @obi1kenobi in #920 - Weekly
cargo update
of dependencies by @obi1kenobi in #921 - Enable the
rayon
andrustc-hash
optimization features. by @obi1kenobi in #924 - Weekly
cargo update
of dependencies by @obi1kenobi in #925 - Weekly
cargo update
of dependencies by @obi1kenobi in #929 cargo upgrade --incompatible
across all versions. by @obi1kenobi in #931- Handle
priority
in the lints table by @suaviloquence in #932 - add witness template to lints by @suaviloquence in #893
- change
function_missing
witness hint by @suaviloquence in #934 - Add enum variant discriminant changed lint by @dmatos2012 in #912
- use
insta
for witness tests by @suaviloquence in #935 - Document contributor process for adding witness hint templates by @suaviloquence in #933
- Reduce size of uploaded crate by @DaniPopes in #936
- change log callbacks to
FnOnce
by @suaviloquence in #938 - feat: add
trait_added_supertrait
by @mrnossiom in #892 - Weekly
cargo update
of dependencies by @obi1kenobi in #942 - Add LSP setup information to CONTRIBUTING.md file by @obi1kenobi in #941
- Weekly
cargo update
of dependencies by @obi1kenobi in #947 - Improve
union_field_missing
query formatting. by @obi1kenobi in #948 - Weekly
cargo update
of dependencies by @obi1kenobi in #958 - docs: add
<details>
to theCONTRIBUTING.md
to make some content visually shorter by @CommanderStorm in #952 - Bump mozilla-actions/sccache-action from 0.0.5 to 0.0.6 by @dependabot in #955
- Reword doc comment that had too long of a first paragraph. by @obi1kenobi in #959
- test: migrate the remaining snapshot-test to
insta
by @CommanderStorm in #951 - feat: add lint
struct_with_no_pub_fields_changed
by @CommanderStorm in #962 - Weekly
cargo update
of dependencies by @obi1kenobi in #964 - fixed a typo in
NoneExhaustiveFieldlessUnit
by @CommanderStorm in #965 - Weekly
cargo update
of dependencies by @obi1kenobi in #967 - Weekly
cargo update
of dependencies by @obi1kenobi in #969 - Weekly
cargo update
of dependencies by @obi1kenobi in #970 - Add lint
declarative_macro_missing
by @miikka in #966 cargo clippy --fix
for the latest lints. by @obi1kenobi in #972- feat: add lint
struct_marked_non_exhaustive_changed_type
by @CommanderStorm in #963 - Add next Rust minor to test matrix by @obi1kenobi in #974
- feat: add witnesses for
function_const_removed
by @CommanderStorm in #977 - Add support for rustdoc JSON format v36. by @obi1kenobi in #979
- Update
tame-index
to v0.14. by @obi1kenobi in #980 - chore: add a witness for
enum_variant_missing
by @CommanderStorm in #978 - Weekly
cargo update
of dependencies by @obi1kenobi in #981 - Release v0.36 with 5 new lints, perf boosts, and new rustdoc formats. by @obi1kenobi in #982
New Contributors
- @DaniPopes made their first contribution in https://github.com/obi1kenobi/cargo-semv...
v0.35.0
What's changed
In this release:
- 10 new lints
- performance upgrades
- improved bug reporting UX & test infra
This release requires Rust 1.77+ both to install (MSRV) and at runtime.
New lints:
We can now detect whether a trait is sealed or not, unlocking many new lints! "Is this lint sealed" is a tricky question full of edge cases — check out our deep-dive into this feature to learn more!
trait_newly_sealed
by @dmatos2012 in #876trait_method_added
by @PedroTurik in #891trait_method_default_impl_removed
by @dmatos2012 in #880trait_associated_type_added
by @PedroTurik in #890trait_associated_const_added
by @mrnossiom in #875trait_associated_type_default_removed
by @mrnossiom in #889trait_associated_const_default_removed
by @mrnossiom in #888enum_unit_variant_changed_kind
by @PedroTurik in #894enum_tuple_variant_changed_kind
by @PedroTurik in #906
Additionally, we enabled the trait_no_longer_object_safe
lint. It was previously implemented but was disabled while awaiting updated Rust functionality.
We also renamed the variant_marked_non_exhaustive
lint to enum_variant_marked_non_exhaustive
, for better naming consistency.
Performance upgrades
cargo-semver-checks
lints are implemented as database queries. The "database" in our case is rustdoc JSON files, which we load in memory and index for faster lookups. For particularly large crates, this indexing process could take up to 2-3 seconds by itself.
This release cuts the indexing time in half, thanks to the work of @jalil-salame:
- using rayon to parallelize index construction: adapter#424, adapter#418, adapter#405
- a faster hash function: adapter#423
- reducing indirections and hash calls: adapter#435, adapter#404
Improved bug reporting UX & test infra
Our GitHub bug reporting form requests the diagnostic output of the cargo semver-checks --bugreport
command. That output is unwieldy, so it's a bit of a hassle to copy-paste it into the GitHub issue UI.
As of this release, --bugreport
will include a URL that pre-fills all the diagnostic information into a GitHub bug report form. Now you can just click the link, and skip the clunky copy-pasting! Thanks to @PedroTurik for shipping this functionality in #862.
@suaviloquence has also been hard at work revamping our test infrastructure so that we can test cargo-semver-checks
more thoroughly and in more configurations. He's already shipped a dozen PRs that have made us more confident in our ability to build bigger and bolder features. Skyskrapers cannot stand on wobbly foundations, so keep his hard work in mind while you enjoy the powerful new features we'll be shipping in the months to come!
All Merged PRs
- Update MSRV in Cargo.toml, which did not match docs. by @obi1kenobi in #854
- Fail Rust matrix updater job if the file we want is missing. by @obi1kenobi in #858
- Re-enable the
trait_no_longer_object_safe
lint. by @obi1kenobi in #857 - Ensure all lints in
src/lints
are registered for use at runtime. by @obi1kenobi in #860 - adds ids to text areas in bug reports by @PedroTurik in #861
- Add snapshot testing with
insta
by @suaviloquence in #846 - add no lib targets test by @suaviloquence in #847
- Add test for when all members in a workspace are
publish = false
by @suaviloquence in #859 - Update FUNDING.yml to add thanks.dev by @obi1kenobi in #864
- Forward verbosity and filter time out of snapshot tests by @suaviloquence in #865
- Filter total # of checks and filenames in snapshots by @suaviloquence in #867
- Add tests for
publish = false
workspace members explicitly included with--package
by @suaviloquence in #866 - Drop rustdoc v27 support. by @obi1kenobi in #869
- Weekly
cargo update
of dependencies by @obi1kenobi in #871 - Allow generating test rustdoc JSON files without git dependency. by @obi1kenobi in #856
- Update to adapter w/ sealed trait analysis & update lints to match. by @obi1kenobi in #872
- fix: regenerate script toplevel resolution by @mrnossiom in #873
cargo update
to grab new rustdoc adapter with function body ability. by @obi1kenobi in #874- Implement trait_newly_sealed new lint by @dmatos2012 in #876
- Upgrade gix and tame-index to new versions in lock-step. by @obi1kenobi in #877
- Upgrade handlebars to new major version. by @obi1kenobi in #878
- Bugreport auto issue by @PedroTurik in #862
- snapshot tests: save captured stdout/err even on an Err variant by @suaviloquence in #881
- snapshot tests: reproducibility for
cargo doc
by @suaviloquence in #883 - Add snapshot test for when a workspace member's baseline has a compile error. by @suaviloquence in #882
- add lint
trait_associated_const_added
by @mrnossiom in #875 - Add lint for trait default impl removed by @dmatos2012 in #880
- Weekly
cargo update
of dependencies by @obi1kenobi in #886 - Add handling of ambiguous package definitions within the same dir. by @obi1kenobi in #887
- feat: add trait_associated_const_default_removed lint by @mrnossiom in #888
- non-sealed trait added associated type without default value lint by @PedroTurik in #890
- feat: add trait_associated_type_default_removed lint by @mrnossiom in #889
- adds new trait-method-added lint by @PedroTurik in #891
- enable
implicit some
feature on query rons. by @suaviloquence in #897 - Make verbosity a global option by @suaviloquence in #899
- Explicitly
cargo update
in path dependency workspaces. by @obi1kenobi in #901 - Invoke
cargo update
on path dependencies, not registry ones. by @obi1kenobi in #904 - Properly silence cargo output unless
--verbose
. by @obi1kenobi in #903 - Enum unit variant changed kind by @PedroTurik in #894
- Enum tuple variant changed kind by @PedroTurik in #906
- Disable tests currently broken by #902. by @obi1kenobi in #907
- Add integration test snapshots by @suaviloquence in #905
- Rename
variant_marked_non_exhaustive
toenum_variant_marked_non_exhaustive
. by @obi1kenobi in #908 - Weekly
cargo update
of dependencies by @obi1kenobi in #900 - Rename
trait_default_impl_removed
totrait_method_default_impl_removed
by @obi1kenobi in #909 - Weekly
cargo update
of dependencies by @obi1kenobi in #910 - Release v0.35.0. by @obi1kenobi in #911
New Contributors
- @mrnossiom made their first contribution in #873
- @dmatos2012 made their first contribution in #876
Full Changelog: v0.34.0...v0.35.0
v0.34.0
What's Changed
In this release:
- 3 new lints
- support for rustdoc format v33
This release requires Rust 1.77+ both to install (MSRV) and at runtime. It also ensures cargo-semver-checks
continues to build correctly on Rust 1.80, addressing both the inference-breaking change and the floating-point miscompilation issues in 1.80.0.
New lints
inherent_method_now_doc_hidden
by @orblivion in #821union_pub_field_now_doc_hidden
by @PedroTurik in #844union_must_use_added
by @PedroTurik in #845
Support for rustdoc format v33
Latest nightly
Rust has switched to rustdoc format v33. You'll want to update to this new release if you are relying on nightly.
Implemented across:
All Merged PRs
- Require Rust 1.77+ going forward. by @obi1kenobi in #833
- feat: Object safe trait nightly test by @devanbenz in #661
- Add next Rust minor to test matrix by @obi1kenobi in #834
- Add separately-invocable build-binaries workflow. by @obi1kenobi in #837
- Use a GitHub personal auth token to push new tagged versions. by @obi1kenobi in #838
- Inherent method now doc hidden by @orblivion in #821
- Enable tests for async fn in traits by @jw013 in #839
- Add Troubleshooting section to README by @obi1kenobi in #842
- Update Rust versions for cross-version caching job. by @obi1kenobi in #843
- Weekly
cargo update
of dependencies by @obi1kenobi in #840 - Add union pub field now doc hidden lint by @PedroTurik in #844
- Adds union_must_use_added lint by @PedroTurik in #845
- Fix typo in features_simple/old test crate by @suaviloquence in #849
- Weekly
cargo update
of dependencies by @obi1kenobi in #850 - Support latest nightly rustdoc JSON format v33. by @obi1kenobi in #852
- Release v0.34 with 3 new lints and new rustdoc JSON format support. by @obi1kenobi in #853
New Contributors
- @orblivion made their first contribution in #821
- @PedroTurik made their first contribution in #844
Full Changelog: v0.33.0...v0.34.0
v0.33.0
What's Changed
In this release:
- lint configuration
- a new lint
- support for rustdoc format v32
PSA: Installing cargo install cargo-semver-checks --no-default-features
will no longer work, due to a change in our dependencies that unfortunately had to propagate to our own features as well. Users should update that invocation to cargo install cargo-semver-checks --no-default-features --features gix-reqwest
to recover the old behavior. Thanks to @Lorak-mmk for flagging this change!
This release requires Rust 1.74+ both to install (MSRV) and at runtime. This is the last release to support Rust 1.74-1.76; future releases will require Rust 1.77+.
Lint configuration
Thanks to @suaviloquence's hard work as part of our participation in Google Summer of Code, users can now customize the SemVer (major/minor) and severity (deny/warn/allow) levels of cargo-semver-checks
lints 🎉
While we've already extensively tested this feature, we know that complex new code often reveals surprises when it first faces the real world. Please kindly report any bugs or reach out in the GSoC project's Zulip if you have questions or concerns.
Read more about this new feature on @suaviloquence's blog: https://blog.mcarr.one/
New lints
inherent_associated_const_now_doc_hidden
by @DeluxeRaph in #820
Support for rustdoc format v32
Latest nightly
Rust has switched to rustdoc format v32, so you'll want to update to this new release if you are relying on nightly. Implemented in #825, and in obi1kenobi/trustfall-rustdoc-adapter#338 by @Xuanwo.
All Merged PRs
- deserialize [package.metadata] and [workspace.metadata] tables by @suaviloquence in #798
- read package/workspace config from Cargo manifest by @suaviloquence in #799
- Bump mozilla-actions/sccache-action from 0.0.4 to 0.0.5 by @dependabot in #801
- Weekly
cargo update
of dependencies by @obi1kenobi in #802 - use configured required update version by @suaviloquence in #800
- Move lint configuration to [cargo-semver-checks.lints] table by @suaviloquence in #804
- add lint level field to query skeleton by @suaviloquence in #806
- Weekly
cargo update
of dependencies by @obi1kenobi in #807 - Handle lint level in check_release by @suaviloquence in #805
- annotate
unreachable!()
statements by @suaviloquence in #808 - add test for
allow
lint level by @suaviloquence in #809 - Weekly
cargo update
of dependencies by @obi1kenobi in #810 - Add
workspace
key to[cargo-semver-checks.lints]
table by @suaviloquence in #811 - Implement opt-in workspace overrides by @suaviloquence in #812
- make specifying
workspace = false
a hard error by @suaviloquence in #813 - Test that config is only read from new (i.e., current) manifest by @suaviloquence in #814
- Weekly
cargo update
of dependencies by @obi1kenobi in #817 - Make lint table entries compatible with cargo
[lints]
by @suaviloquence in #818 - Added inherent_associated_const_now_doc_hidden by @DeluxeRaph in #820
- Weekly
cargo update
of dependencies by @obi1kenobi in #822 - Add support for rustdoc JSON format v32. by @obi1kenobi in #825
- add lint config guide to README by @suaviloquence in #826
- Add explicit features for gix backend by @ggwpez in #824
- Expand lint-level configuration section in README. by @obi1kenobi in #828
- Minor fixes for lint config docs by @suaviloquence in #829
- Update all dependencies to compatible versions prior to release. by @obi1kenobi in #830
- Adjust semver-checking step for mutually-exclusive features. by @obi1kenobi in #832
- Release v0.33.0. by @obi1kenobi in #831
New Contributors
- @DeluxeRaph made their first contribution in #820
- @ggwpez made their first contribution in #824
Full Changelog: v0.32.0...v0.33.0
v0.32.0
What's Changed
In this release:
- 3 new lints
- support for rustdoc format v30
- performance improvements
This release requires Rust 1.74+ both to install (MSRV) and at runtime.
New lints
pub_static_mut_now_immutable
by @arpity22 in #768trait_associated_type_now_doc_hidden
by @arpity22 in #776trait_associated_const_now_doc_hidden
by @arpity22 in #779
Support for rustdoc format v30
Latest nightly
Rust has switched to rustdoc format v30, so you'll want to update to this new release if you are relying on nightly. Implemented in #790 and obi1kenobi/trustfall-rustdoc-adapter@65dc425
Performance improvements
@jw013 in #777 figured out a way to improve the performance of a lint that could get quite slow on large codebases. Kudos! 🎉
Google Summer of Code (GSoC)
cargo-semver-checks
is participating in Google Summer of Code: @suaviloquence is working on allowing workspaces and packages to customize the SemVer (major/minor/patch) and severity (error/warn/allow) levels of our lints.
Just like how Rustaceans don't enable all clippy
lints in all projects, not all SemVer lints are suitable for every circumstance either. This GSoC project will allow us to ship many more lints that we've been holding off on due to their more situational usefulness. Thank you, @suaviloquence!
You can follow this work at @suaviloquence's blog: https://blog.mcarr.one/rust-lint-config/
All Merged PRs
- Add lint pub_static_mut_now_immutable by @arpity22 in #768
- Weekly
cargo update
of dependencies by @obi1kenobi in #772 - Add next Rust minor to test matrix by @obi1kenobi in #773
- Enable auto-merge for adding new Rust release to CI by @obi1kenobi in #774
- Weekly
cargo update
of dependencies by @obi1kenobi in #775 - Improve function_abi_no_longer_unwind performance by reordering current, baseline by @jw013 in #777
- Added lint trait_associated_type_now_doc_hidden by @arpity22 in #776
- Weekly
cargo update
of dependencies by @obi1kenobi in #778 - Added lint trait_associated_const_now_doc_hidden by @arpity22 in #779
- Weekly
cargo update
of dependencies by @obi1kenobi in #780 - Weekly
cargo update
of dependencies by @obi1kenobi in #782 - Check deserialized query id matches expected id by @jw013 in #783
- Weekly
cargo update
of dependencies by @obi1kenobi in #785 - refactoring to add lint levels on queries by @suaviloquence in #787
- Weekly
cargo update
of dependencies by @obi1kenobi in #789 - Add support for rustdoc JSON format v30. by @obi1kenobi in #790
- Upgrade
gix
andtame-index
in lockstep with each other. by @obi1kenobi in #791 - Upgrade to itertools v0.13.0. by @obi1kenobi in #792
- add query override data structures by @suaviloquence in #788
- Add next Rust minor to test matrix by @obi1kenobi in #794
- Fix typo in docstring. by @obi1kenobi in #795
- Upgrade to cargo_toml v0.20.2. by @obi1kenobi in #793
- Weekly
cargo update
of dependencies by @obi1kenobi in #796 - Release v0.32.0. by @obi1kenobi in #797
Full Changelog: v0.31.0...v0.32.0
v0.31.0
What's Changed
In this release:
- 5 new lints
- support for rustdoc format v29
- improved diagnostic messages
- tightening existing lints to catch more breaking changes
- new CLI flags for color output
- improved API if using
cargo-semver-checks
as a library (breaking changes — see Migration Guide below!)
This release requires Rust 1.74+ both to install (MSRV) and at runtime.
New lints
inherent_associated_pub_const_missing
by @arpity22 in #714pub_static_now_doc_hidden
by @arpity22 in #712function_export_name_changed
by @suaviloquence in #728union_missing
by @jw013 in #731union_field_missing
by @me-diru in #729
Support for rustdoc format v29
Latest nightly
Rust has switched to rustdoc format v29, so you'll want to update to this new release if you are using a nightly released in the last week or so. Implemented in #769 and obi1kenobi/trustfall-rustdoc-adapter@9fb656a
Improved diagnostic messages
cargo-semver-checks
can only semver-check library crates, since binaries have no API surface area to check. But it might not be obvious which crates cargo-semver-checks
considered while looking for library crates to check — that's how we get issues like #723. As of this release, we have a better error message here:
error: no crates with library targets selected, nothing to semver-check
note: only library targets contain an API surface that can be checked for semver
note: skipped the following crates since they have no library target: example, other_example
Implemented in #741.
Two other, smaller quality-of-life improvements here are printing which crate features are enabled in --verbose
mode (#725), and improving the error message when a crate fails to compile in cases where no features are used (#726).
Huge thanks to @jw013 who has been on a roll here 🙏
Tightening existing lints to catch more breaking changes
cargo-semver-checks
has an explicit goal of "zero false-positives" — every lint we emit should point to a real issue deserving of maintainers' attention. (We are decent at this, but not perfect yet. We're working on getting better!)
But many cases aren't clear-cut — some things might be a major breaking change, and the final "yes/no" decision on it depends on many factors. In such cases, cargo-semver-checks
is conservative, meaning that we choose to not emit a lint unless absolutely certain. For example:
pub struct MyIterator;
impl MyIterator {
// We *do not* consider removing this pub method
// a major breaking change!
//
// If removed, *most* callers will seamlessly use
// the `Iterator` trait's version of the `next()` method.
pub fn next(&mut self) -> Option<i64> {
<Self as Iterator>::next(self)
}
}
impl Iterator for MyIterator {
type Item = i64;
fn next(&mut self) -> Option<Self::Item> {
None
}
}
In the above example, removing the inherent MyIterator::next()
method will not trigger a lint because for most users it won't be breaking. (It could still be breaking for some users though! For example, users who use #![no_implicit_prelude]
and don't have the Iterator
trait in scope.)
In some cases, we might overshoot and end up being overly conservative: there was a real breaking change, but we failed to emit it because we were too worried about it being a false positive.
This release removes overly conservative cases in the inherent_associated_pub_const_missing
and inherent_method_missing
lints related to when the impl Trait
whose items we're falling back to is #[doc(hidden)]
and not public API. The PR has the full details: #763
New CLI flags for color output
The CLI now accepts --color=always/never/auto
to match cargo
's own behavior. If set, the CLI flag overrides any CARGO_TERM_COLOR
env variable that might be set.
Implemented by @suaviloquence in #721
Improved API if using cargo-semver-checks
as a library
@suaviloquence took on the work of improving our library APIs:
- Switched us from
termcolor
to the neweranstyle
crate for our terminal color needs, to match whatcargo
itself uses. (#737) - Allow directing our stdout/stderr to buffers instead of the "real" stdout/stderr (#765)
- Improve the naming and structural consistency of our API's methods (#765)
Additional thanks go to @pksunkara for the help and advice around switching to anstyle
!
@suaviloquence put together this handy migration guide to help library users migrate 👏
Major changes
-
Check::check_release
takes a new&mut GlobalConfig
parameter, andGlobalConfig
now holds log level and color settings.- Change:
let mut check = Check::new(rustdoc); check.with_packages(packages) .with_log_level(Some(log_level)) .with_color_choice(Some(termcolor::ColorChoice::Always)); let result = check.check_release();
- To:
let mut config = GlobalConfig::new() .set_level(Some(log_level)); config.set_color_choice(true); // or set_{err,out)_color_choice for finer-grained control let mut check = Check::new(rustdoc); check.with_packages(packages); let result = check.check_release(&mut config);
- Change:
-
Set color choice in one of three ways:
- Change:
let choice: termcolor::ColorChoice = ...; config = config.set_color_choice(choice);
- To: one of the three following options, depending on desired granularity
- Set global color choice for all crates using the
anstream
library:let choice: anstream::ColorChoice = ...; // set *before* creating `GlobalConfig` instance (if using default stdout/stderr) // or before calling `GlobalConfig::set_std{out,err}` (if configuring them) choice.write_global(); // configures `choice` for all crates using `anstream`
- Set whether to use colors for both stdout and stderr in the
cargo-semver-checks
library:let use_colors: bool = ...; config.set_color_choice(use_colors);
- Set whether to use colors for a specific stream in the
cargo-semver-checks
library:let use_colors_for_stderr: bool = ...; let use_colors_for_stdout: bool = ...; config.set_err_color_choice(use_colors_for_stderr); config.set_out_color_choice(use_colors_for_stdout);
- Set global color choice for all crates using the
- Change:
-
config structs (
Check
,GlobalConfig
,PackageSelection
) now have a consistent setter convention:pub fn set_[property](&mut self, prop: T) -> &mut Self
:- note: this does not apply to
Check::with_[...]_features()
methods as they are toggles vs property setters. - Change:
selection.with_excluded_packages(packages); check.with_selection(selection).with_all_features();
- To:
selection.set_excluded_packages(packages); check.set_package_selection(selection).with_all_features();
- Change:
config = config.set_level(level);
- To:
config.set_log_level(level); // now takes and returns &mut Self instead of owned Self
- note: this does not apply to
New features
- Users can configure the stdout and stderr streams for
cargo-semver-checks
to be different from default:let stderr: Box<dyn std::io::Write> = Box::new(stderr_buffer); config.set_stderr(stderr);
Minor changes
#[must_use]
added onGlobalConfig::std{err,out}
GlobalConfig::shell_print
takes ananstyle::Color
instead of atermcolor::Color
:- Change
config.shell_print(status, message, termcolor::Color::Red, justified)
- To
config.shell_print(status, message, anstyle::Color::Ansi(anstyle::AnsiColor::Red, justified)
- Change
- To write colors to stdout/stderr, use
writeln!(config.stdout(), "{}styled text", anstyle::Style::new().bold().[...]);
instead of thetermcolor
API - use
GlobalConfig::{out,err}_color_choice()
to query whether to print colors for the stdout/stderr stream instead of usingGlobalConfig::is_err_tty
as a heuristic GlobalConfig::std{out,err}
returns an opaqueimpl Write + '_
type instead of atermcolor::StandardStream
All Merged PRs
- Weekly
cargo update
of dependencies by @obi1kenobi in #708 - Add reminder to update MSRV in GH Action's CI suite. by @obi1kenobi in #709
- Add lint pub_static_now_doc_hidden by @arpity22 in #712
- Add Rust 1.76 to CI explicitly, now that stable is 1.77. by @obi1kenobi in #713
- Weekly
cargo update
of dependencies by @obi1kenobi in #716 - Fix test_crates directory url typo by @me-diru in #720
- Add
--color
setting to CLI. by @suaviloquence in #721 - Print crate features in verbose mode (#711) by @jw013 in #725
- Do not print --features with empty list (#718) by @jw013 in #726
- Add lint for union field missing case by @me-diru in #729
- add function_export_name_changed lint by @suaviloquence in #728
- Add union_missing lint by @jw013 in https://git...
v0.30.0
What's Changed
In this release: 7 new lints + assorted UX improvements. This release requires Rust 1.74+ both to install (MSRV) and at runtime.
New lints:
union_now_doc_hidden
by @vasucp1207 (#679)trait_method_now_doc_hidden
by @suaviloquence (#684)enum_tuple_variant_field_now_doc_hidden
by @arpity22 (#685)enum_struct_variant_field_now_doc_hidden
by @arpity22 (#687)function_abi_no_longer_unwind
by @qstommyshu (#689)pub_module_level_const_now_doc_hidden
by @arpity22 (#690, #703)repr_c_removed
lint covering all struct/enum/union types, by @pksunkara (#678)- This lint augments and replaces the previous
struct_repr_c_removed
andenum_repr_c_removed
lints.
- This lint augments and replaces the previous
Miscellaneous:
- Improved output of reproduction command when failing to generate rustdoc JSON, by @obi1kenobi (#676)
- Improved new-contributor workflow for better compatibility across platforms, by @jw013 (#681, #682, #683)
- Better description and tests for
inherent_method_must_use_added
lint, by @pksunkara (#677) - Faster compilation times by deduplicating major dependency versions and major dependency version bumps where possible (many PRs, see below)
All Merged PRs
- Output complete repro command when failing to generate rustdoc JSON. by @obi1kenobi in #676
- rule: add
union_now_doc_hidden
by @vasucp1207 in #679 - Fix description and tests for inherent_method_must_use_added by @pksunkara in #677
- Replace per-type
repr(C)
lints with a single lint for all of struct/enum/union by @pksunkara in #678 - Update scripts and contributing guide by @jw013 in #681
- Replace GNU-specific commands with more portable alternatives by @jw013 in #682
- Remove script usage of globstar, improving compatibility by @jw013 in #683
- add trait_method_now_doc_hidden lint by @suaviloquence in #684
- Added lint enum_tuple_variant_field_now_doc_hidden by @arpity22 in #685
- Raise compile-time and runtime MSRV to Rust 1.74. by @obi1kenobi in #686
- Weekly
cargo update
of dependencies by @obi1kenobi in #673 - Added lint enum_struct_variant_field_now_doc_hidden by @arpity22 in #687
- Update
tame_index
andgix
to new major versions. by @obi1kenobi in #691 - Update cargo and toml-related dependencies. by @obi1kenobi in #692
- Update
handlebars
to new major version. by @obi1kenobi in #693 - Update dev dependency major versions. by @obi1kenobi in #694
- Remove
lazy_static
from dev dependencies. by @obi1kenobi in #695 - Update
itertools
to v0.12 by @obi1kenobi in #696 - Set up dependabot updates to GitHub Actions. by @obi1kenobi in #697
- Added lint public_module_level_constant_now_doc_hidden by @arpity22 in #690
- Bump mozilla-actions/sccache-action from 0.0.3 to 0.0.4 by @dependabot in #698
- Bump actions/checkout from 3 to 4 by @dependabot in #702
- Bump actions/upload-artifact from 3 to 4 by @dependabot in #699
- Bump actions/download-artifact from 3 to 4 by @dependabot in #700
- Bump actions/cache from 3 to 4 by @dependabot in #701
- Rename new lint to
pub_module_level_const_now_doc_hidden
. by @obi1kenobi in #703 - Set dependabot to weekly runs. by @obi1kenobi in #704
- New lint: add function_abi_no_longer_unwind lint by @qstommyshu in #689
- Update dependencies in preparation for release. by @obi1kenobi in #705
- Release v0.30 with Rust 1.74+ MSRV and many new lints. by @obi1kenobi in #706
New Contributors
- @vasucp1207 made their first contribution in #679
- @pksunkara made their first contribution in #677
- @suaviloquence made their first contribution in #684
- @arpity22 made their first contribution in #685
- @dependabot made their first contribution in #698
- @qstommyshu made their first contribution in #689
Full Changelog: v0.29.1...v0.30.0
v0.29.1
Just a small maintenance release, to avoid a yanked dependency version that was in our lockfiles. Enjoy!
All Merged PRs
- Update to a non-yanked version of bumpalo by @yottalogical in #671
- Weekly
cargo update
of dependencies by @obi1kenobi in #670 - Release v0.29.1 to avoid yanked dependency version. by @obi1kenobi in #672
Full Changelog: v0.29.0...v0.29.1
v0.29.0
What's Changed
In this release: 5 new lints, one fixed false-positive, and assorted UX improvements.
This is the last release to support Rust 1.71-1.73. Future releases will require Rust 1.74+ both to install (MSRV) and at runtime.
Hat-tip to everyone that came to check out my talk on cargo-semver-checks
at FOSDEM 2024! We even got a chance to pair-program a few lints in the hallway after my talk: #649 with @rubdos, and #650 with @ehiggs.
Unfortunately, the FOSDEM recording had an AV glitch and lost ~10min of audio and video. But all is not lost!
- If you're in the Boston area, come to the Boston Rust meetup this Wednesday (Feb 21) where I'll again talk about cargo-semver-checks!
- I'm going to re-record the missing parts and post a new video, so follow me on Mastodon, Twitter, or Bluesky.
New lints:
exported_function_changed_abi
by @ehiggs (#650)repr_packed_added
by @jw013 (#666)repr_packed_removed
by @jw013 (#666)struct_pub_field_now_doc_hidden
by @rubdos (#649)trait_no_longer_object_safe
(Rust 1.77+ only) by @devanbenz (#659)
False positives fixed:
trait_method_unsafe_removed
no longer triggers on traits sealed using the pub-in-priv supertrait technique. Contributed by @yottalogical in #614.
Miscellaneous:
- Support checking
rlib
,dylib
, andstaticlib
Rust library types, by @obi1kenobi (#662, #663, #664). - Improve diagnostic messages when a crate fails to build, by @obi1kenobi (#656, #658)
All Merged PRs
- Weekly
cargo update
of dependencies by @obi1kenobi in #646 - Only run test with_env_var and with_flag on x86_64 by @Xeonacid in #647
- Weekly
cargo update
of dependencies by @obi1kenobi in #651 - test(with_env_var, with_flag): Add riscv64; Restrict os to Linux by @Xeonacid in #648
- Explicitly test on Rust 1.75 now that 1.76 comes out today. by @obi1kenobi in #652
- Weekly
cargo update
of dependencies by @obi1kenobi in #653 - feat: Trailing comma error message by @devanbenz in #655
- Improve diagnostic messages when surfacing errors from cargo. by @obi1kenobi in #656
- Improve error message readability by adding an extra newline. by @obi1kenobi in #658
- Weekly
cargo update
of dependencies by @obi1kenobi in #657 - Support checking rlib, dylib, and staticlib library types. by @obi1kenobi in #662
- feat: New lint trait_no_longer_object_safe by @devanbenz in #659
- Remove ability to check bin-only targets, to fix
doc = false
issue. by @obi1kenobi in #663 - Add test case for lib targets with a
doc = false
setting. by @obi1kenobi in #664 - Add lint for pub field becoming doc(hidden) by @rubdos in #649
- Fix false-positive in lint trait_method_unsafe_removed by @yottalogical in #614
- Add lints for repr(packed) being added or removed. by @jw013 in #666
- Minor QOL update to speed up reruns of regenerate_test_rustdocs script by @jw013 in #667
- Improves linting for issue 503 by adding lint to check ABI has not changed between functions with same
export_name
by @ehiggs in #650 - Weekly
cargo update
of dependencies by @obi1kenobi in #668 - Release v0.29.0 by @obi1kenobi in #669
New Contributors
- @Xeonacid made their first contribution in #647
- @devanbenz made their first contribution in #655
- @rubdos made their first contribution in #649
- @ehiggs made their first contribution in #650
Full Changelog: v0.28.0...v0.29.0
v0.28.0
What's Changed
New lints, new functionality, UX improvements, and an awesome new logo courtesy of NUMI!
Performance
Now running lints in parallel using rayon
(#625), for a ~3-4x speedup in lint execution time (i.e. not counting rustdoc generation and parsing time, which still dominate).
- In my measurements, the wall-clock time gains here are on the order of 12s (16s -> 4s) on the biggest crate I know of (
aws-sdk-ec2
, 240k+ items), and ~1s on most crates of more reasonable size. - Also added a better breakdown of where time is actually spent, between generating rustdoc, parsing the JSON, and running lints: #630
- The parallelization and the time breakdown improvements were both contributed by @jw013 🎉
New lints
enum_repr_transparent_removed
, contributed by @fprasx in #627- Ability to write lints for
union
types, also contributed by @fprasx: obi1kenobi/trustfall-rustdoc-adapter#309- This immediately enables writing at least a half dozen new lints, for which I'm happy to mentor contributors: #633
New functionality
Support for custom build.target
cargo configurations, contributed by @Nemo157: #619
It also supports setting an explicit cargo build target via our new --build-target
CLI flag.
Bugfixes
Bugfix for an unusual situation where having RUSTFLAGS="-Dwarnings"
would prevent rustdoc JSON from being built in case a dependency of the crate we're checking had warnings.
This would sometimes happen with the actions-rust-lang/setup-rust-toolchain
GitHub Action, which sets RUSTFLAGS="-Dwarnings"
by default.
All Merged PRs
- Add table of contents to FAQ and add a few more questions and answers. by @obi1kenobi in #618
- Add Rust 1.74 to the test matrix. by @obi1kenobi in #623
- Add test crate to test async fn and impl Future by @jw013 in #622
- update repr-related reference links by @fprasx in #626
- implement enum_repr_transparent_removed lint by @fprasx in #627
- Add timing output for rustdoc and crate total by @jw013 in #630
- Parallel lints by @jw013 in #625
cargo update
to enable queryingUnion
types' information. by @obi1kenobi in #631- Weekly
cargo update
of dependencies by @obi1kenobi in #636 - New Logo by @agreea in #628
- Add separate issue templates for false-positive and false-negatives. by @obi1kenobi in #639
- Mention our lint wishlist issue in the false-negative issue template. by @obi1kenobi in #640
- Update schema link in CONTRIBUTING.md by @obi1kenobi in #641
- Weekly
cargo update
of dependencies by @obi1kenobi in #642 - Detect when
build.target
is configured, and allow overriding it from the command line by @Nemo157 in #619 - Fix occasional failure to generate rustdoc when
RUSTFLAGS="-Dwarnings"
. by @obi1kenobi in #643 - Manually update dependencies before publishing new release. by @obi1kenobi in #644
- Release v0.28.0. by @obi1kenobi in #645
New Contributors
- @fprasx made their first contribution in #626
- @agreea made their first contribution in #628
- @Nemo157 made their first contribution in #619
Full Changelog: v0.27.0...v0.28.0