File tree 1 file changed +39
-0
lines changed
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 {
516
516
. run ( ) ;
517
517
}
518
518
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
+
519
558
#[ cargo_test]
520
559
fn without_priority ( ) {
521
560
Package :: new ( "reg-dep" , "1.0.0" ) . publish ( ) ;
You can’t perform that action at this time.
0 commit comments