Skip to content

Commit

Permalink
test: Verify precedence with profile.rustflags
Browse files Browse the repository at this point in the history
  • Loading branch information
epage committed May 19, 2023
1 parent 59a6899 commit e29eaef
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions tests/testsuite/lints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,42 @@ pub fn foo(num: i32) -> u32 {
.run();
}

#[cargo_test]
fn profile_rustflags_doesnt_have_precedence() {
let foo = project()
.file(
"Cargo.toml",
r#"
cargo-features = ["lints", "profile-rustflags"]
[package]
name = "foo"
version = "0.0.1"
[lints.rust]
"unsafe_code" = "allow"
[profile.dev]
rustflags = ["-D", "unsafe_code"]
"#,
)
.file(
"src/lib.rs",
"
pub fn foo(num: i32) -> u32 {
unsafe { std::mem::transmute(num) }
}
",
)
.build();

foo.cargo("check")
.arg("-v")
.masquerade_as_nightly_cargo(&["lints", "profile-rustflags"])
.with_status(0)
.run();
}

#[cargo_test]
fn without_priority() {
Package::new("reg-dep", "1.0.0").publish();
Expand Down

0 comments on commit e29eaef

Please sign in to comment.