File tree Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Original file line number Diff line number Diff line change @@ -516,6 +516,45 @@ pub fn foo(num: i32) -> u32 {
516516 . run ( ) ;
517517}
518518
519+ #[ cargo_test]
520+ fn build_rustflags_has_precedence ( ) {
521+ let foo = project ( )
522+ . file (
523+ "Cargo.toml" ,
524+ r#"
525+ cargo-features = ["lints", "profile-rustflags"]
526+
527+ [package]
528+ name = "foo"
529+ version = "0.0.1"
530+
531+ [lints.rust]
532+ "unsafe_code" = "deny"
533+ "# ,
534+ )
535+ . file (
536+ ".cargo/config.toml" ,
537+ r#"
538+ [build]
539+ rustflags = ["-A", "unsafe_code"]
540+ "# ,
541+ )
542+ . file (
543+ "src/lib.rs" ,
544+ "
545+ pub fn foo(num: i32) -> u32 {
546+ unsafe { std::mem::transmute(num) }
547+ }
548+ " ,
549+ )
550+ . build ( ) ;
551+
552+ foo. cargo ( "check" )
553+ . arg ( "-v" ) // Show order of rustflags on failure
554+ . masquerade_as_nightly_cargo ( & [ "lints" , "profile-rustflags" ] )
555+ . run ( ) ;
556+ }
557+
519558#[ cargo_test]
520559fn without_priority ( ) {
521560 Package :: new ( "reg-dep" , "1.0.0" ) . publish ( ) ;
You can’t perform that action at this time.
0 commit comments