@@ -31,6 +31,8 @@ pub struct Std {
3131}
3232
3333impl Std {
34+ const CRATE_OR_DEPS : & [ & str ] = & [ "sysroot" , "coretests" , "alloctests" ] ;
35+
3436 pub fn new ( target : TargetSelection ) -> Self {
3537 Self { target, crates : vec ! [ ] , override_build_kind : None }
3638 }
@@ -47,11 +49,13 @@ impl Step for Std {
4749
4850 fn should_run ( run : ShouldRun < ' _ > ) -> ShouldRun < ' _ > {
4951 let stage = run. builder . top_stage ;
50- run. crate_or_deps ( "sysroot" )
51- . crate_or_deps ( "coretests" )
52- . crate_or_deps ( "alloctests" )
53- . path ( "library" )
54- . default_condition ( stage != 0 )
52+
53+ let mut run = run;
54+ for c in Std :: CRATE_OR_DEPS {
55+ run = run. crate_or_deps ( c) ;
56+ }
57+
58+ run. path ( "library" ) . default_condition ( stage != 0 )
5559 }
5660
5761 fn make_run ( run : RunConfig < ' _ > ) {
@@ -66,6 +70,19 @@ impl Step for Std {
6670 let compiler = builder. compiler ( builder. top_stage , builder. config . build ) ;
6771
6872 if builder. top_stage == 0 {
73+ let mut is_explicitly_called =
74+ builder. paths . iter ( ) . any ( |p| p. starts_with ( "library" ) || p. starts_with ( "std" ) ) ;
75+
76+ if !is_explicitly_called {
77+ for c in Std :: CRATE_OR_DEPS {
78+ is_explicitly_called = builder. paths . iter ( ) . any ( |p| p. starts_with ( c) ) ;
79+ }
80+ }
81+
82+ if is_explicitly_called {
83+ eprintln ! ( "WARNING: stage 0 std is precompiled and does nothing during `x check`." ) ;
84+ }
85+
6986 // Reuse the stage0 libstd
7087 builder. ensure ( compile:: Std :: new ( compiler, target) ) ;
7188 return ;
0 commit comments