Skip to content

Commit df6e2cc

Browse files
committed
Only show advice to use cargo update --precise for non-local packages
Packages in the local workspace can't get updated this way; the user just needs to point to a different source, or otherwise update the package themselves.
1 parent 0b002e4 commit df6e2cc

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

src/cargo/ops/cargo_compile.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -667,7 +667,7 @@ pub fn create_bcx<'a, 'cfg>(
667667
} else {
668668
String::new()
669669
}
670-
} else {
670+
} else if !unit.is_local() {
671671
format!(
672672
"Either upgrade to rustc {} or newer, or use\n\
673673
cargo update -p {}@{} --precise ver\n\
@@ -678,6 +678,8 @@ pub fn create_bcx<'a, 'cfg>(
678678
unit.pkg.name(),
679679
current_version,
680680
)
681+
} else {
682+
String::new()
681683
};
682684

683685
anyhow::bail!(

tests/testsuite/rust_version.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,10 +124,7 @@ fn rust_version_too_high() {
124124
.with_status(101)
125125
.with_stderr(
126126
"error: package `foo v0.0.1 ([..])` cannot be built because it requires \
127-
rustc 1.9876.0 or newer, while the currently active rustc version is [..]\n\
128-
Either upgrade to rustc 1.9876.0 or newer, or use\n\
129-
cargo update -p foo@0.0.1 --precise ver\n\
130-
where `ver` is the latest version of `foo` supporting rustc [..]",
127+
rustc 1.9876.0 or newer, while the currently active rustc version is [..]\n\n",
131128
)
132129
.run();
133130
p.cargo("build --ignore-rust-version").run();

0 commit comments

Comments
 (0)