@@ -66,6 +66,43 @@ impl Step for Std {
66
66
let libdir = builder. sysroot_libdir ( compiler, target) ;
67
67
let hostdir = builder. sysroot_libdir ( compiler, compiler. host ) ;
68
68
add_to_sysroot ( & builder, & libdir, & hostdir, & libstd_stamp ( builder, compiler, target) ) ;
69
+
70
+ // Then run cargo again, once we've put the rmeta files for the library
71
+ // crates into the sysroot. This is needed because e.g., core's tests
72
+ // depend on `libtest` -- Cargo presumes it will exist, but it doesn't
73
+ // since we initialize with an empty sysroot.
74
+ //
75
+ // Currently only the "libtest" tree of crates does this.
76
+
77
+ let mut cargo = builder. cargo (
78
+ compiler,
79
+ Mode :: Std ,
80
+ SourceType :: InTree ,
81
+ target,
82
+ cargo_subcommand ( builder. kind ) ,
83
+ ) ;
84
+ std_cargo ( builder, target, compiler. stage , & mut cargo) ;
85
+ cargo. arg ( "--all-targets" ) ;
86
+
87
+ // Explicitly pass -p for all dependencies krates -- this will force cargo
88
+ // to also check the tests/benches/examples for these crates, rather
89
+ // than just the leaf crate.
90
+ for krate in builder. in_tree_crates ( "test" ) {
91
+ cargo. arg ( "-p" ) . arg ( krate. name ) ;
92
+ }
93
+
94
+ builder. info ( & format ! (
95
+ "Checking std test/bench/example targets ({} -> {})" ,
96
+ & compiler. host, target
97
+ ) ) ;
98
+ run_cargo (
99
+ builder,
100
+ cargo,
101
+ args ( builder. kind ) ,
102
+ & libstd_test_stamp ( builder, compiler, target) ,
103
+ vec ! [ ] ,
104
+ true ,
105
+ ) ;
69
106
}
70
107
}
71
108
@@ -106,6 +143,14 @@ impl Step for Rustc {
106
143
cargo_subcommand ( builder. kind ) ,
107
144
) ;
108
145
rustc_cargo ( builder, & mut cargo, target) ;
146
+ cargo. arg ( "--all-targets" ) ;
147
+
148
+ // Explicitly pass -p for all compiler krates -- this will force cargo
149
+ // to also check the tests/benches/examples for these crates, rather
150
+ // than just the leaf crate.
151
+ for krate in builder. in_tree_crates ( "rustc-main" ) {
152
+ cargo. arg ( "-p" ) . arg ( krate. name ) ;
153
+ }
109
154
110
155
builder. info ( & format ! ( "Checking compiler artifacts ({} -> {})" , & compiler. host, target) ) ;
111
156
run_cargo (
@@ -149,7 +194,7 @@ macro_rules! tool_check_step {
149
194
150
195
builder. ensure( Rustc { target } ) ;
151
196
152
- let cargo = prepare_tool_cargo(
197
+ let mut cargo = prepare_tool_cargo(
153
198
builder,
154
199
compiler,
155
200
Mode :: ToolRustc ,
@@ -160,6 +205,8 @@ macro_rules! tool_check_step {
160
205
& [ ] ,
161
206
) ;
162
207
208
+ cargo. arg( "--all-targets" ) ;
209
+
163
210
builder. info( & format!(
164
211
"Checking {} artifacts ({} -> {})" ,
165
212
stringify!( $name) . to_lowercase( ) ,
@@ -202,12 +249,24 @@ tool_check_step!(Rustdoc, "src/tools/rustdoc", SourceType::InTree);
202
249
// rejected.
203
250
tool_check_step ! ( Clippy , "src/tools/clippy" , SourceType :: InTree ) ;
204
251
252
+ tool_check_step ! ( Bootstrap , "src/bootstrap" , SourceType :: InTree ) ;
253
+
205
254
/// Cargo's output path for the standard library in a given stage, compiled
206
255
/// by a particular compiler for the specified target.
207
256
fn libstd_stamp ( builder : & Builder < ' _ > , compiler : Compiler , target : TargetSelection ) -> PathBuf {
208
257
builder. cargo_out ( compiler, Mode :: Std , target) . join ( ".libstd-check.stamp" )
209
258
}
210
259
260
+ /// Cargo's output path for the standard library in a given stage, compiled
261
+ /// by a particular compiler for the specified target.
262
+ fn libstd_test_stamp (
263
+ builder : & Builder < ' _ > ,
264
+ compiler : Compiler ,
265
+ target : TargetSelection ,
266
+ ) -> PathBuf {
267
+ builder. cargo_out ( compiler, Mode :: Std , target) . join ( ".libstd-check-test.stamp" )
268
+ }
269
+
211
270
/// Cargo's output path for librustc in a given stage, compiled by a particular
212
271
/// compiler for the specified target.
213
272
fn librustc_stamp ( builder : & Builder < ' _ > , compiler : Compiler , target : TargetSelection ) -> PathBuf {
0 commit comments