Skip to content

Commit c2a8d8c

Browse files
committed
test: Verify precedence with profile.rustflags
1 parent 01a93e4 commit c2a8d8c

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

tests/testsuite/lints.rs

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -434,6 +434,42 @@ pub fn foo(num: i32) -> u32 {
434434
.run();
435435
}
436436

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

0 commit comments

Comments
 (0)