mirror of
https://github.com/rust-lang/cargo.git
synced 2025-09-28 11:20:36 +00:00
feat(add): Stabilize MSRV-aware version req selection
This is part of #9930 for rust-lang/rfcs#3537 This will make it easier to maintain an MSRV-compliant `Cargo.toml` but leaves validation up to the user as the resolver will pick newer versions. This helps the MSRV-aware workflows enumerated in rust-lang/rfcs#3537 though it could be confusing to the workflow with an MSRV-compatible lockfile. PR #13561 at least raises awareness of that discrepancy. There is an unresolved question on differences in the resolver vs `cargo add` for dealing with an unset `rust-version`. However, we are only stabilizing the `cargo add` side which is a very light two-way door as this is a UX-focused command and not a programmatic command. This hasn't gotten much end-user testing but, as its UX focused, that seems fine. As such, this seems like it is ready to stabilize.
This commit is contained in:
parent
80124ada8f
commit
6e4e31bec0
@ -87,7 +87,7 @@ Example uses:
|
||||
- Depend on crates with the same name from different registries"),
|
||||
flag(
|
||||
"ignore-rust-version",
|
||||
"Ignore `rust-version` specification in packages (unstable)"
|
||||
"Ignore `rust-version` specification in packages"
|
||||
),
|
||||
])
|
||||
.arg_manifest_path_without_unsupported_path_tip()
|
||||
@ -206,14 +206,6 @@ pub fn exec(gctx: &mut GlobalContext, args: &ArgMatches) -> CliResult {
|
||||
let dependencies = parse_dependencies(gctx, args)?;
|
||||
|
||||
let ignore_rust_version = args.flag("ignore-rust-version");
|
||||
if ignore_rust_version && !gctx.cli_unstable().msrv_policy {
|
||||
return Err(CliError::new(
|
||||
anyhow::format_err!(
|
||||
"`--ignore-rust-version` is unstable; pass `-Zmsrv-policy` to enable support for it"
|
||||
),
|
||||
101,
|
||||
));
|
||||
}
|
||||
let honor_rust_version = !ignore_rust_version;
|
||||
|
||||
let options = AddOptions {
|
||||
|
@ -608,7 +608,7 @@ fn get_latest_dependency(
|
||||
)
|
||||
})?;
|
||||
|
||||
if gctx.cli_unstable().msrv_policy && honor_rust_version {
|
||||
if honor_rust_version {
|
||||
let (req_msrv, is_msrv) = spec
|
||||
.rust_version()
|
||||
.cloned()
|
||||
|
@ -141,11 +141,6 @@ which enables all specified features.
|
||||
|
||||
{{#option "`--ignore-rust-version`" }}
|
||||
Ignore `rust-version` specification in packages.
|
||||
|
||||
This option is unstable and available only on the
|
||||
[nightly channel](https://doc.rust-lang.org/book/appendix-07-nightly-rust.html)
|
||||
and requires the `-Z unstable-options` flag to enable.
|
||||
See <https://github.com/rust-lang/cargo/issues/5579> for more information.
|
||||
{{/option}}
|
||||
|
||||
{{/options}}
|
||||
|
@ -131,12 +131,6 @@ OPTIONS
|
||||
--ignore-rust-version
|
||||
Ignore rust-version specification in packages.
|
||||
|
||||
This option is unstable and available only on the nightly channel
|
||||
<https://doc.rust-lang.org/book/appendix-07-nightly-rust.html> and
|
||||
requires the -Z unstable-options flag to enable. See
|
||||
<https://github.com/rust-lang/cargo/issues/5579> for more
|
||||
information.
|
||||
|
||||
Display Options
|
||||
-v, --verbose
|
||||
Use verbose output. May be specified twice for “very verbose”
|
||||
|
@ -137,11 +137,7 @@ which enables all specified features.</dd>
|
||||
|
||||
|
||||
<dt class="option-term" id="option-cargo-add---ignore-rust-version"><a class="option-anchor" href="#option-cargo-add---ignore-rust-version"></a><code>--ignore-rust-version</code></dt>
|
||||
<dd class="option-desc">Ignore <code>rust-version</code> specification in packages.</p>
|
||||
<p>This option is unstable and available only on the
|
||||
<a href="https://doc.rust-lang.org/book/appendix-07-nightly-rust.html">nightly channel</a>
|
||||
and requires the <code>-Z unstable-options</code> flag to enable.
|
||||
See <a href="https://github.com/rust-lang/cargo/issues/5579">https://github.com/rust-lang/cargo/issues/5579</a> for more information.</dd>
|
||||
<dd class="option-desc">Ignore <code>rust-version</code> specification in packages.</dd>
|
||||
|
||||
|
||||
</dl>
|
||||
|
@ -326,8 +326,6 @@ Documentation updates:
|
||||
|
||||
## msrv-policy
|
||||
- [#9930](https://github.com/rust-lang/cargo/issues/9930) (MSRV-aware resolver)
|
||||
- [#10653](https://github.com/rust-lang/cargo/issues/10653) (MSRV-aware cargo-add)
|
||||
- [#10903](https://github.com/rust-lang/cargo/issues/10903) (MSRV-aware cargo-install)
|
||||
|
||||
The `msrv-policy` feature enables experiments in MSRV-aware policy for cargo in
|
||||
preparation for an upcoming RFC.
|
||||
|
@ -162,11 +162,6 @@ which enables all specified features.
|
||||
\fB\-\-ignore\-rust\-version\fR
|
||||
.RS 4
|
||||
Ignore \fBrust\-version\fR specification in packages.
|
||||
.sp
|
||||
This option is unstable and available only on the
|
||||
\fInightly channel\fR <https://doc.rust\-lang.org/book/appendix\-07\-nightly\-rust.html>
|
||||
and requires the \fB\-Z unstable\-options\fR flag to enable.
|
||||
See <https://github.com/rust\-lang/cargo/issues/5579> for more information.
|
||||
.RE
|
||||
.SS "Display Options"
|
||||
.sp
|
||||
|
@ -125,7 +125,7 @@
|
||||
</tspan>
|
||||
<tspan x="10px" y="964px"><tspan> </tspan><tspan class="fg-cyan bold">--ignore-rust-version</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="982px"><tspan> Ignore `rust-version` specification in packages (unstable)</tspan>
|
||||
<tspan x="10px" y="982px"><tspan> Ignore `rust-version` specification in packages</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="1000px">
|
||||
</tspan>
|
||||
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
Loading…
x
Reference in New Issue
Block a user