Skip to content

Commit 9b1843f

Browse files
committed
test: Verify precedence with profile.rustflags
1 parent eca8319 commit 9b1843f

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

tests/testsuite/lints.rs

+36
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,42 @@ pub fn foo(num: i32) -> u32 {
439439
.run();
440440
}
441441

442+
#[cargo_test]
443+
fn profile_rustflags_doesnt_have_precedence() {
444+
let foo = project()
445+
.file(
446+
"Cargo.toml",
447+
r#"
448+
cargo-features = ["lints", "profile-rustflags"]
449+
450+
[package]
451+
name = "foo"
452+
version = "0.0.1"
453+
454+
[lints.rust]
455+
"unsafe_code" = "allow"
456+
457+
[profile.dev]
458+
rustflags = ["-D", "unsafe_code"]
459+
"#,
460+
)
461+
.file(
462+
"src/lib.rs",
463+
"
464+
pub fn foo(num: i32) -> u32 {
465+
unsafe { std::mem::transmute(num) }
466+
}
467+
",
468+
)
469+
.build();
470+
471+
foo.cargo("check")
472+
.arg("-v")
473+
.masquerade_as_nightly_cargo(&["lints", "profile-rustflags"])
474+
.with_status(0)
475+
.run();
476+
}
477+
442478
#[cargo_test]
443479
fn without_priority() {
444480
Package::new("reg-dep", "1.0.0").publish();

0 commit comments

Comments
 (0)