@@ -708,7 +708,7 @@ pub fn build_rules<'a>(build: &'a Build) -> Rules {
708708         . host ( true ) 
709709         . only_host_build ( true ) 
710710         . default ( true ) 
711-          . dep ( |s| s . name ( "tool-rust-installer" ) . stage ( 0 ) ) 
711+          . dep ( move   |s| tool_rust_installer ( build ,  s ) ) 
712712         . run ( move  |s| dist:: rustc ( build,  s. stage ,  s. target ) ) ; 
713713    rules. dist ( "dist-std" ,  "src/libstd" ) 
714714         . dep ( move  |s| { 
@@ -723,12 +723,12 @@ pub fn build_rules<'a>(build: &'a Build) -> Rules {
723723         } ) 
724724         . default ( true ) 
725725         . only_host_build ( true ) 
726-          . dep ( |s| s . name ( "tool-rust-installer" ) . stage ( 0 ) ) 
726+          . dep ( move   |s| tool_rust_installer ( build ,  s ) ) 
727727         . run ( move  |s| dist:: std ( build,  & s. compiler ( ) ,  s. target ) ) ; 
728728    rules. dist ( "dist-mingw" ,  "path/to/nowhere" ) 
729729         . default ( true ) 
730730         . only_host_build ( true ) 
731-          . dep ( |s| s . name ( "tool-rust-installer" ) . stage ( 0 ) ) 
731+          . dep ( move   |s| tool_rust_installer ( build ,  s ) ) 
732732         . run ( move  |s| { 
733733             if  s. target . contains ( "pc-windows-gnu" )  { 
734734                 dist:: mingw ( build,  s. target ) 
@@ -739,25 +739,25 @@ pub fn build_rules<'a>(build: &'a Build) -> Rules {
739739         . host ( true ) 
740740         . only_build ( true ) 
741741         . only_host_build ( true ) 
742-          . dep ( |s| s . name ( "tool-rust-installer" ) . stage ( 0 ) ) 
742+          . dep ( move   |s| tool_rust_installer ( build ,  s ) ) 
743743         . run ( move  |_| dist:: rust_src ( build) ) ; 
744744    rules. dist ( "dist-docs" ,  "src/doc" ) 
745745         . default ( true ) 
746746         . only_host_build ( true ) 
747747         . dep ( |s| s. name ( "default:doc" ) ) 
748-          . dep ( |s| s . name ( "tool-rust-installer" ) . stage ( 0 ) ) 
748+          . dep ( move   |s| tool_rust_installer ( build ,  s ) ) 
749749         . run ( move  |s| dist:: docs ( build,  s. stage ,  s. target ) ) ; 
750750    rules. dist ( "dist-analysis" ,  "analysis" ) 
751751         . default ( build. config . extended ) 
752752         . dep ( |s| s. name ( "dist-std" ) ) 
753753         . only_host_build ( true ) 
754-          . dep ( |s| s . name ( "tool-rust-installer" ) . stage ( 0 ) ) 
754+          . dep ( move   |s| tool_rust_installer ( build ,  s ) ) 
755755         . run ( move  |s| dist:: analysis ( build,  & s. compiler ( ) ,  s. target ) ) ; 
756756    rules. dist ( "dist-rls" ,  "rls" ) 
757757         . host ( true ) 
758758         . only_host_build ( true ) 
759759         . dep ( |s| s. name ( "tool-rls" ) ) 
760-          . dep ( |s| s . name ( "tool-rust-installer" ) . stage ( 0 ) ) 
760+          . dep ( move   |s| tool_rust_installer ( build ,  s ) ) 
761761         . run ( move  |s| dist:: rls ( build,  s. stage ,  s. target ) ) ; 
762762    rules. dist ( "install" ,  "path/to/nowhere" ) 
763763         . dep ( |s| s. name ( "default:dist" ) ) 
@@ -766,7 +766,7 @@ pub fn build_rules<'a>(build: &'a Build) -> Rules {
766766         . host ( true ) 
767767         . only_host_build ( true ) 
768768         . dep ( |s| s. name ( "tool-cargo" ) ) 
769-          . dep ( |s| s . name ( "tool-rust-installer" ) . stage ( 0 ) ) 
769+          . dep ( move   |s| tool_rust_installer ( build ,  s ) ) 
770770         . run ( move  |s| dist:: cargo ( build,  s. stage ,  s. target ) ) ; 
771771    rules. dist ( "dist-extended" ,  "extended" ) 
772772         . default ( build. config . extended ) 
@@ -779,7 +779,7 @@ pub fn build_rules<'a>(build: &'a Build) -> Rules {
779779         . dep ( |d| d. name ( "dist-cargo" ) ) 
780780         . dep ( |d| d. name ( "dist-rls" ) ) 
781781         . dep ( |d| d. name ( "dist-analysis" ) ) 
782-          . dep ( |s| s . name ( "tool-rust-installer" ) . stage ( 0 ) ) 
782+          . dep ( move   |s| tool_rust_installer ( build ,  s ) ) 
783783         . run ( move  |s| dist:: extended ( build,  s. stage ,  s. target ) ) ; 
784784
785785    rules. dist ( "dist-sign" ,  "hash-and-sign" ) 
@@ -791,6 +791,14 @@ pub fn build_rules<'a>(build: &'a Build) -> Rules {
791791
792792    rules. verify ( ) ; 
793793    return  rules; 
794+ 
795+     /// Helper to depend on a stage0 build-only rust-installer tool. 
796+ fn  tool_rust_installer < ' a > ( build :  & ' a  Build ,  step :  & Step < ' a > )  -> Step < ' a >  { 
797+         step. name ( "tool-rust-installer" ) 
798+             . host ( & build. config . build ) 
799+             . target ( & build. config . build ) 
800+             . stage ( 0 ) 
801+     } 
794802} 
795803
796804#[ derive( PartialEq ,  Eq ,  Hash ,  Clone ,  Debug ) ]  
0 commit comments