mirror of
https://github.com/rust-lang/cargo.git
synced 2025-09-28 11:20:36 +00:00
test(lints): Verify precedence with build.rustflags
This commit is contained in:
parent
3cba0c1b52
commit
be76a55358
@ -516,6 +516,45 @@ pub fn foo(num: i32) -> u32 {
|
||||
.run();
|
||||
}
|
||||
|
||||
#[cargo_test]
|
||||
fn build_rustflags_has_precedence() {
|
||||
let foo = project()
|
||||
.file(
|
||||
"Cargo.toml",
|
||||
r#"
|
||||
cargo-features = ["lints", "profile-rustflags"]
|
||||
|
||||
[package]
|
||||
name = "foo"
|
||||
version = "0.0.1"
|
||||
|
||||
[lints.rust]
|
||||
"unsafe_code" = "deny"
|
||||
"#,
|
||||
)
|
||||
.file(
|
||||
".cargo/config.toml",
|
||||
r#"
|
||||
[build]
|
||||
rustflags = ["-A", "unsafe_code"]
|
||||
"#,
|
||||
)
|
||||
.file(
|
||||
"src/lib.rs",
|
||||
"
|
||||
pub fn foo(num: i32) -> u32 {
|
||||
unsafe { std::mem::transmute(num) }
|
||||
}
|
||||
",
|
||||
)
|
||||
.build();
|
||||
|
||||
foo.cargo("check")
|
||||
.arg("-v") // Show order of rustflags on failure
|
||||
.masquerade_as_nightly_cargo(&["lints", "profile-rustflags"])
|
||||
.run();
|
||||
}
|
||||
|
||||
#[cargo_test]
|
||||
fn without_priority() {
|
||||
Package::new("reg-dep", "1.0.0").publish();
|
||||
|
Loading…
x
Reference in New Issue
Block a user