File tree 1 file changed +34
-0
lines changed
1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -795,3 +795,37 @@ windows
795
795
)
796
796
. run ( ) ;
797
797
}
798
+
799
+ #[ cargo_test]
800
+ fn precedence ( ) {
801
+ // Ensure that the precedence of cargo-rustc is only lower than RUSTFLAGS,
802
+ // but higher than most flags set by cargo.
803
+ //
804
+ // See rust-lang/cargo#14346
805
+ let p = project ( )
806
+ . file (
807
+ "Cargo.toml" ,
808
+ r#"
809
+ [package]
810
+ name = "foo"
811
+ edition = "2021"
812
+
813
+ [lints.rust]
814
+ unexpected_cfgs = "allow"
815
+ "# ,
816
+ )
817
+ . file ( "src/lib.rs" , "" )
818
+ . build ( ) ;
819
+
820
+ p. cargo ( "rustc --release -v -- --cfg cargo_rustc -C strip=symbols" )
821
+ . env ( "RUSTFLAGS" , "--cfg from_rustflags" )
822
+ . with_stderr_data (
823
+ str![ [ r#"
824
+ [COMPILING] foo v0.0.0 ([ROOT]/foo)
825
+ [RUNNING] `rustc [..]--cfg cargo_rustc -C strip=symbols [..]-C strip=debuginfo [..]--cfg from_rustflags`
826
+ [FINISHED] `release` profile [optimized] target(s) in [ELAPSED]s
827
+
828
+ "# ] ]
829
+ )
830
+ . run ( ) ;
831
+ }
You can’t perform that action at this time.
0 commit comments