@@ -92,7 +92,8 @@ impl Step for Docs {
9292
9393#[ derive( Debug , PartialOrd , Ord , Clone , Hash , PartialEq , Eq ) ]
9494pub struct JsonDocs {
95- pub host : TargetSelection ,
95+ build_compiler : Compiler ,
96+ target : TargetSelection ,
9697}
9798
9899impl Step for JsonDocs {
@@ -105,24 +106,27 @@ impl Step for JsonDocs {
105106 }
106107
107108 fn make_run ( run : RunConfig < ' _ > ) {
108- run. builder . ensure ( JsonDocs { host : run. target } ) ;
109+ run. builder . ensure ( JsonDocs {
110+ build_compiler : run. builder . compiler ( run. builder . top_stage , run. builder . host_target ) ,
111+ target : run. target ,
112+ } ) ;
109113 }
110114
111115 /// Builds the `rust-docs-json` installer component.
112116 fn run ( self , builder : & Builder < ' _ > ) -> Option < GeneratedTarball > {
113- let host = self . host ;
114- builder. ensure ( crate :: core:: build_steps:: doc:: Std :: new (
115- builder . top_stage ,
116- host ,
117+ let target = self . target ;
118+ let directory = builder. ensure ( crate :: core:: build_steps:: doc:: Std :: from_build_compiler (
119+ self . build_compiler ,
120+ target ,
117121 DocumentationFormat :: Json ,
118122 ) ) ;
119123
120124 let dest = "share/doc/rust/json" ;
121125
122- let mut tarball = Tarball :: new ( builder, "rust-docs-json" , & host . triple ) ;
126+ let mut tarball = Tarball :: new ( builder, "rust-docs-json" , & target . triple ) ;
123127 tarball. set_product_name ( "Rust Documentation In JSON Format" ) ;
124128 tarball. is_preview ( true ) ;
125- tarball. add_bulk_dir ( builder . json_doc_out ( host ) , dest) ;
129+ tarball. add_bulk_dir ( directory , dest) ;
126130 Some ( tarball. generate ( ) )
127131 }
128132}
@@ -1571,19 +1575,21 @@ impl Step for Extended {
15711575 } ;
15721576 }
15731577
1578+ let target_compiler = builder. compiler ( stage, target) ;
15741579 // When rust-std package split from rustc, we needed to ensure that during
15751580 // upgrades rustc was upgraded before rust-std. To avoid rustc clobbering
15761581 // the std files during uninstall. To do this ensure that rustc comes
15771582 // before rust-std in the list below.
1578- tarballs. push ( builder. ensure ( Rustc { compiler : builder . compiler ( stage , target ) } ) ) ;
1583+ tarballs. push ( builder. ensure ( Rustc { compiler : target_compiler } ) ) ;
15791584 tarballs. push ( builder. ensure ( Std { compiler, target } ) . expect ( "missing std" ) ) ;
15801585
15811586 if target. is_windows_gnu ( ) {
15821587 tarballs. push ( builder. ensure ( Mingw { host : target } ) . expect ( "missing mingw" ) ) ;
15831588 }
15841589
15851590 add_component ! ( "rust-docs" => Docs { host: target } ) ;
1586- add_component ! ( "rust-json-docs" => JsonDocs { host: target } ) ;
1591+ // Std stage N is documented with compiler stage N
1592+ add_component ! ( "rust-json-docs" => JsonDocs { build_compiler: target_compiler, target } ) ;
15871593 add_component ! ( "cargo" => Cargo { build_compiler: compiler, target } ) ;
15881594 add_component ! ( "rustfmt" => Rustfmt { build_compiler: compiler, target } ) ;
15891595 add_component ! ( "rust-analyzer" => RustAnalyzer { build_compiler: compiler, target } ) ;
0 commit comments