Skip to content

Recommend package.rust-version in the Rust version section of reference/semver.md. #15806

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/doc/src/reference/semver.md
Original file line number Diff line number Diff line change
Expand Up @@ -2028,6 +2028,8 @@ Mitigation strategies:
[`#[cfg(accessible(..))]`][cfg-accessible] features which provide an opt-in
mechanism for new features. These are currently unstable and only available
in the nightly channel.
* Use [`package.rust-version`] to declare your package’s compatibility.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Instead of cargo update, should we say "Cargo's dependency resolution"?
  • MSRV resolver at this moment is best-effort, it will still fall back to incompatible version if nothing found, if we want to be more precise.

This allows `cargo update` to avoid introducing an incompatible update.
Comment on lines +2031 to +2032
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think of:

Suggested change
* Use [`package.rust-version`] to declare your package’s compatibility.
This allows `cargo update` to avoid introducing an incompatible update.
* Specify your minimum-supported Rust version by setting [`package.rust-version`], allowing Cargo to [select older versions of your package] when needed rather than erroring. Be sure to consider the [support expectations] when doing so.
[`package.rust-version`]: https://doc.rust-lang.org/cargo/reference/rust-version.html
[select older versions of your package]: https://doc.rust-lang.org/cargo/reference/resolver.html#rust-version
[support expectations]: https://doc.rust-lang.org/cargo/reference/rust-version.html#support-expectations
  • Re-orders and rewords things so the emphasis is on your package's support, to avoid people setting and forgetting this and it being wrong
  • Explicitly calling out support expectations to avoid people setting and forgetting this and it being wrong
  • Applies feedback from weihanglo

Also, based on what we've written for the package.rust-version page, I think it would be fine to list this first, rather than last.


### Possibly-breaking: changing the platform and environment requirements {#env-change-requirements}

Expand Down Expand Up @@ -2296,6 +2298,7 @@ document what your commitments are.

[`cfg` attribute]: ../../reference/conditional-compilation.md#the-cfg-attribute
[`no_std`]: ../../reference/names/preludes.html#the-no_std-attribute
[`package.rust-version`]: https://doc.rust-lang.org/cargo/reference/rust-version.html
[`pub use`]: ../../reference/items/use-declarations.html
[Cargo feature]: features.md
[Cargo features]: features.md
Expand Down
Loading