@@ -185,8 +185,17 @@ impl Step for Rustc {
185
185
let compiler = builder. compiler ( builder. top_stage , builder. config . build ) ;
186
186
let target = self . target ;
187
187
188
- builder. ensure ( compile:: Std :: new ( compiler, compiler. host ) ) ;
189
- builder. ensure ( compile:: Std :: new ( compiler, target) ) ;
188
+ if compiler. stage != 0 {
189
+ // If we're not in stage 0, then we won't have a std from the beta
190
+ // compiler around. That means we need to make sure there's one in
191
+ // the sysroot for the compiler to find. Otherwise, we're going to
192
+ // fail when building crates that need to generate code (e.g., build
193
+ // scripts and their dependencies).
194
+ builder. ensure ( compile:: Std :: new ( compiler, compiler. host ) ) ;
195
+ builder. ensure ( compile:: Std :: new ( compiler, target) ) ;
196
+ } else {
197
+ builder. ensure ( check:: Std :: new ( target) ) ;
198
+ }
190
199
191
200
let mut cargo = builder:: Cargo :: new (
192
201
builder,
@@ -224,9 +233,7 @@ impl Step for Rustc {
224
233
macro_rules! lint_any {
225
234
( $(
226
235
$name: ident, $path: expr, $readable_name: expr
227
- $( , is_external_tool = $external: expr) *
228
- $( , is_unstable_tool = $unstable: expr) *
229
- $( , allow_features = $allow_features: expr) ?
236
+ $( , lint_by_default = $lint_by_default: expr) *
230
237
;
231
238
) +) => {
232
239
$(
@@ -238,6 +245,7 @@ macro_rules! lint_any {
238
245
239
246
impl Step for $name {
240
247
type Output = ( ) ;
248
+ const DEFAULT : bool = if false $( || $lint_by_default) * { true } else { false } ;
241
249
242
250
fn should_run( run: ShouldRun <' _>) -> ShouldRun <' _> {
243
251
run. path( $path)
@@ -275,11 +283,15 @@ macro_rules! lint_any {
275
283
& target,
276
284
) ;
277
285
286
+ let stamp = builder
287
+ . cargo_out( compiler, Mode :: ToolRustc , target)
288
+ . join( format!( ".{}-check.stamp" , stringify!( $name) . to_lowercase( ) ) ) ;
289
+
278
290
run_cargo(
279
291
builder,
280
292
cargo,
281
293
lint_args( builder, & [ ] ) ,
282
- & libstd_stamp ( builder , compiler , target ) ,
294
+ & stamp ,
283
295
vec![ ] ,
284
296
true ,
285
297
false ,
@@ -291,11 +303,11 @@ macro_rules! lint_any {
291
303
}
292
304
293
305
lint_any ! (
294
- Bootstrap , "src/bootstrap" , "bootstrap" ;
295
- BuildHelper , "src/tools/build_helper" , "build_helper" ;
306
+ Bootstrap , "src/bootstrap" , "bootstrap" , lint_by_default = true ;
307
+ BuildHelper , "src/tools/build_helper" , "build_helper" , lint_by_default = true ;
296
308
CoverageDump , "src/tools/coverage-dump" , "coverage-dump" ;
297
- Tidy , "src/tools/tidy" , "tidy" ;
298
- Compiletest , "src/tools/compiletest" , "compiletest" ;
309
+ Tidy , "src/tools/tidy" , "tidy" , lint_by_default = true ;
310
+ Compiletest , "src/tools/compiletest" , "compiletest" , lint_by_default = true ;
299
311
RemoteTestServer , "src/tools/remote-test-server" , "remote-test-server" ;
300
312
RemoteTestClient , "src/tools/remote-test-client" , "remote-test-client" ;
301
313
) ;
0 commit comments