Skip to content

Commit

Permalink
Adjusted the suggestion text.
Browse files Browse the repository at this point in the history
  • Loading branch information
torhovland committed May 8, 2024
1 parent 2e8d10f commit 7663e63
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions src/cargo/core/compiler/custom_build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -737,10 +737,12 @@ impl BuildOutput {
let new_syntax_added_in = RustVersion::from_str("1.77.0")?;
if !new_syntax_added_in.is_compatible_with(msrv.as_partial()) {
let old_syntax_suggestion = if has_reserved_prefix(flag) {
format!("Consider using the old `cargo:` syntax in front of `{flag}`.\n")
format!(
"Switch to the old `cargo:{flag}` syntax (note the single colon).\n"
)
} else if flag.starts_with("metadata=") {
let old_format_flag = flag.strip_prefix("metadata=").unwrap();
format!("Consider using the old `cargo:{old_format_flag}` syntax instead of `cargo::{flag}` (note the single colon).\n")
format!("Switch to the old `cargo:{old_format_flag}` syntax instead of `cargo::{flag}` (note the single colon).\n")
} else {
String::new()
};
Expand Down
4 changes: 2 additions & 2 deletions tests/testsuite/build_script.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5501,7 +5501,7 @@ fn test_new_syntax_with_old_msrv() {
[COMPILING] foo [..]
[ERROR] the `cargo::` syntax for build script output instructions was added in Rust 1.77.0, \
but the minimum supported Rust version of `foo v0.5.0 ([ROOT]/foo)` is 1.60.0.
Consider using the old `cargo:foo=bar` syntax instead of `cargo::metadata=foo=bar` (note the single colon).
Switch to the old `cargo:foo=bar` syntax instead of `cargo::metadata=foo=bar` (note the single colon).
See https://doc.rust-lang.org/cargo/reference/build-scripts.html#outputs-of-the-build-script \
for more information about build script outputs.
",
Expand Down Expand Up @@ -5542,7 +5542,7 @@ fn test_new_syntax_with_old_msrv_and_reserved_prefix() {
[COMPILING] foo [..]
[ERROR] the `cargo::` syntax for build script output instructions was added in Rust 1.77.0, \
but the minimum supported Rust version of `foo v0.5.0 ([ROOT]/foo)` is 1.60.0.
Consider using the old `cargo:` syntax in front of `rustc-check-cfg=cfg(foo)`.
Switch to the old `cargo:rustc-check-cfg=cfg(foo)` syntax (note the single colon).
See https://doc.rust-lang.org/cargo/reference/build-scripts.html#outputs-of-the-build-script \
for more information about build script outputs.
",
Expand Down

0 comments on commit 7663e63

Please sign in to comment.