Skip to content
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

feat(add): Fallback to rustc -v when no MSRV is set #13516

Merged
merged 12 commits into from
Mar 3, 2024
Prev Previous commit
Next Next commit
fix(add): Clarify adding-of-old warning
The `note:` was removed because `--ignore-rust-version` is a bit too
late (dependency was already added).
  • Loading branch information
epage committed Mar 1, 2024
commit 5476e544a755be25d9925c9f8b11bafc97d3657a
8 changes: 4 additions & 4 deletions src/cargo/ops/cargo_add/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -638,12 +638,12 @@ fn get_latest_dependency(
})?;

if latest_msrv.version() < latest.version() {
let latest_version = latest.version();
let latest_rust_version = latest.rust_version().unwrap();
let name = spec.name();
gctx.shell().warn(format_args!(
"\
ignoring `{dependency}@{latest_version}` (which has a rust-version of {latest_rust_version}) to satisfy this package's rust-version of {rust_version} (use `--ignore-rust-version` to override)",
latest_version = latest.version(),
latest_rust_version = latest.rust_version().unwrap(),
rust_version = spec.rust_version().unwrap(),
ignoring {dependency}@{latest_version} (which requires rustc {latest_rust_version}) to maintain {name}'s rust-version of {req_msrv}",
))?;

latest = latest_msrv;
Expand Down
4 changes: 2 additions & 2 deletions tests/testsuite/cargo_add/rust_version_older/stderr.term.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.