Skip to content

Commit

Permalink
test(cargo-rustc): show the current precedence
Browse files Browse the repository at this point in the history
  • Loading branch information
weihanglo committed Sep 24, 2024
1 parent d7bffc3 commit 9311738
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions tests/testsuite/rustc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -795,3 +795,37 @@ windows
)
.run();
}

#[cargo_test]
fn precedence() {
// Ensure that the precedence of cargo-rustc is only lower than RUSTFLAGS,
// but higher than most flags set by cargo.
//
// See rust-lang/cargo#14346
let p = project()
.file(
"Cargo.toml",
r#"
[package]
name = "foo"
edition = "2021"
[lints.rust]
unexpected_cfgs = "allow"
"#,
)
.file("src/lib.rs", "")
.build();

p.cargo("rustc --release -v -- --cfg cargo_rustc -C strip=symbols")
.env("RUSTFLAGS", "--cfg from_rustflags")
.with_stderr_data(
str![[r#"
[COMPILING] foo v0.0.0 ([ROOT]/foo)
[RUNNING] `rustc [..]--cfg cargo_rustc -C strip=symbols [..]-C strip=debuginfo [..]--cfg from_rustflags`
[FINISHED] `release` profile [optimized] target(s) in [ELAPSED]s
"#]]
)
.run();
}

0 comments on commit 9311738

Please sign in to comment.