@@ -791,6 +791,11 @@ impl<'a> Builder<'a> {
791791 rustflags. arg ( "--cfg=bootstrap" ) ;
792792 }
793793
794+ // FIXME: It might be better to use the same value for both `RUSTFLAGS` and `RUSTDOCFLAGS`,
795+ // but this breaks CI. At the very least, stage0 `rustdoc` needs `--cfg bootstrap`. See
796+ // #71458.
797+ let rustdocflags = rustflags. clone ( ) ;
798+
794799 if let Ok ( s) = env:: var ( "CARGOFLAGS" ) {
795800 cargo. args ( s. split_whitespace ( ) ) ;
796801 }
@@ -1269,7 +1274,7 @@ impl<'a> Builder<'a> {
12691274 }
12701275 }
12711276
1272- Cargo { command : cargo, rustflags }
1277+ Cargo { command : cargo, rustflags, rustdocflags }
12731278 }
12741279
12751280 /// Ensure that a given step is built, returning its output. This will
@@ -1327,7 +1332,7 @@ impl<'a> Builder<'a> {
13271332#[ cfg( test) ]
13281333mod tests;
13291334
1330- #[ derive( Debug ) ]
1335+ #[ derive( Debug , Clone ) ]
13311336struct Rustflags ( String ) ;
13321337
13331338impl Rustflags {
@@ -1367,6 +1372,7 @@ impl Rustflags {
13671372pub struct Cargo {
13681373 command : Command ,
13691374 rustflags : Rustflags ,
1375+ rustdocflags : Rustflags ,
13701376}
13711377
13721378impl Cargo {
@@ -1400,6 +1406,7 @@ impl Cargo {
14001406impl From < Cargo > for Command {
14011407 fn from ( mut cargo : Cargo ) -> Command {
14021408 cargo. command . env ( "RUSTFLAGS" , & cargo. rustflags . 0 ) ;
1409+ cargo. command . env ( "RUSTDOCFLAGS" , & cargo. rustdocflags . 0 ) ;
14031410 cargo. command
14041411 }
14051412}
0 commit comments