test(lints): Verify precedence with profile.rustflags

This commit is contained in:
Ed Page 2023-05-19 15:05:55 -05:00
parent 1dfa101cd1
commit e82fe885b5
1 changed files with 36 additions and 0 deletions

View File

@ -434,6 +434,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();