@@ -823,8 +823,9 @@ impl Step for Std {
823823/// (Don't confuse this with [`RustDev`], without the `c`!)
824824#[ derive( Debug , Clone , Hash , PartialEq , Eq ) ]
825825pub struct RustcDev {
826- pub compiler : Compiler ,
827- pub target : TargetSelection ,
826+ /// The compiler that will build rustc which will be shipped in this component.
827+ build_compiler : Compiler ,
828+ target : TargetSelection ,
828829}
829830
830831impl Step for RustcDev {
@@ -838,28 +839,27 @@ impl Step for RustcDev {
838839
839840 fn make_run ( run : RunConfig < ' _ > ) {
840841 run. builder . ensure ( RustcDev {
841- compiler : run. builder . compiler_for (
842- run. builder . top_stage ,
843- run. builder . config . host_target ,
844- run. target ,
845- ) ,
842+ // We currently always ship a stage 2 rustc-dev component, so we build it with the
843+ // stage 1 compiler. This might change in the future.
844+ // The precise stage used here is important, so we hard-code it.
845+ build_compiler : run. builder . compiler ( 1 , run. builder . config . host_target ) ,
846846 target : run. target ,
847847 } ) ;
848848 }
849849
850850 fn run ( self , builder : & Builder < ' _ > ) -> Option < GeneratedTarball > {
851- let compiler = self . compiler ;
851+ let build_compiler = self . build_compiler ;
852852 let target = self . target ;
853- if skip_host_target_lib ( builder, compiler ) {
853+ if skip_host_target_lib ( builder, build_compiler ) {
854854 return None ;
855855 }
856856
857- builder. ensure ( compile:: Rustc :: new ( compiler, target) ) ;
857+ // Build the compiler that we will ship
858+ builder. ensure ( compile:: Rustc :: new ( build_compiler, target) ) ;
858859
859860 let tarball = Tarball :: new ( builder, "rustc-dev" , & target. triple ) ;
860861
861- let compiler_to_use = builder. compiler_for ( compiler. stage , compiler. host , target) ;
862- let stamp = build_stamp:: librustc_stamp ( builder, compiler_to_use, target) ;
862+ let stamp = build_stamp:: librustc_stamp ( builder, build_compiler, target) ;
863863 copy_target_libs ( builder, target, tarball. image_dir ( ) , & stamp) ;
864864
865865 let src_files = & [ "Cargo.lock" ] ;
@@ -883,6 +883,10 @@ impl Step for RustcDev {
883883
884884 Some ( tarball. generate ( ) )
885885 }
886+
887+ fn metadata ( & self ) -> Option < StepMetadata > {
888+ Some ( StepMetadata :: dist ( "rustc-dev" , self . target ) . built_by ( self . build_compiler ) )
889+ }
886890}
887891
888892#[ derive( Debug , Clone , Hash , PartialEq , Eq ) ]
0 commit comments