File tree 1 file changed +12
-2
lines changed
1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -804,7 +804,7 @@ impl<'a> Builder<'a> {
804
804
stage = compiler. stage ;
805
805
}
806
806
807
- let mut rustflags = Rustflags :: new ( ) ;
807
+ let mut rustflags = Rustflags :: new ( & target , & mut cargo ) ;
808
808
if stage != 0 {
809
809
rustflags. env ( "RUSTFLAGS_NOT_BOOTSTRAP" ) ;
810
810
} else {
@@ -1258,9 +1258,19 @@ mod tests;
1258
1258
struct Rustflags ( String ) ;
1259
1259
1260
1260
impl Rustflags {
1261
- fn new ( ) -> Rustflags {
1261
+ fn new ( target : & str , cmd : & mut Command ) -> Rustflags {
1262
1262
let mut ret = Rustflags ( String :: new ( ) ) ;
1263
+
1264
+ // Inherit `RUSTFLAGS` by default
1263
1265
ret. env ( "RUSTFLAGS" ) ;
1266
+
1267
+ // ... and also handle target-specific env RUSTFLAGS if they're
1268
+ // configured. If this is configured we also remove it from the
1269
+ // environment because Cargo will prefer it over RUSTFLAGS.
1270
+ let target_specific = format ! ( "CARGO_TARGET_{}_RUSTFLAGS" , crate :: envify( target) ) ;
1271
+ ret. env ( & target_specific) ;
1272
+ cmd. env_remove ( & target_specific) ;
1273
+
1264
1274
return ret;
1265
1275
}
1266
1276
You can’t perform that action at this time.
0 commit comments