@@ -185,8 +185,17 @@ impl Step for Rustc {
185185 let compiler = builder. compiler ( builder. top_stage , builder. config . build ) ;
186186 let target = self . target ;
187187
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+ }
190199
191200 let mut cargo = builder:: Cargo :: new (
192201 builder,
@@ -197,7 +206,7 @@ impl Step for Rustc {
197206 "clippy" ,
198207 ) ;
199208
200- rustc_cargo ( builder, & mut cargo, target, compiler. stage ) ;
209+ rustc_cargo ( builder, & mut cargo, target, & compiler) ;
201210
202211 // Explicitly pass -p for all compiler crates -- this will force cargo
203212 // to also lint the tests/benches/examples for these crates, rather
@@ -224,9 +233,7 @@ impl Step for Rustc {
224233macro_rules! lint_any {
225234 ( $(
226235 $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) *
230237 ;
231238 ) +) => {
232239 $(
@@ -238,6 +245,7 @@ macro_rules! lint_any {
238245
239246 impl Step for $name {
240247 type Output = ( ) ;
248+ const DEFAULT : bool = if false $( || $lint_by_default) * { true } else { false } ;
241249
242250 fn should_run( run: ShouldRun <' _>) -> ShouldRun <' _> {
243251 run. path( $path)
@@ -275,11 +283,15 @@ macro_rules! lint_any {
275283 & target,
276284 ) ;
277285
286+ let stamp = builder
287+ . cargo_out( compiler, Mode :: ToolRustc , target)
288+ . join( format!( ".{}-check.stamp" , stringify!( $name) . to_lowercase( ) ) ) ;
289+
278290 run_cargo(
279291 builder,
280292 cargo,
281293 lint_args( builder, & [ ] ) ,
282- & libstd_stamp ( builder , compiler , target ) ,
294+ & stamp ,
283295 vec![ ] ,
284296 true ,
285297 false ,
@@ -293,9 +305,26 @@ macro_rules! lint_any {
293305lint_any ! (
294306 Bootstrap , "src/bootstrap" , "bootstrap" ;
295307 BuildHelper , "src/tools/build_helper" , "build_helper" ;
296- CoverageDump , "src/tools/coverage-dump" , "coverage-dump" ;
297- Tidy , "src/tools/tidy" , "tidy" ;
308+ BuildManifest , "src/tools/build-manifest" , "build-manifest" ;
309+ CargoMiri , "src/tools/miri/cargo-miri" , "cargo-miri" ;
310+ Clippy , "src/tools/clippy" , "clippy" ;
311+ CollectLicenseMetadata , "src/tools/collect-license-metadata" , "collect-license-metadata" ;
298312 Compiletest , "src/tools/compiletest" , "compiletest" ;
299- RemoteTestServer , "src/tools/remote-test-server" , "remote-test-server" ;
313+ CoverageDump , "src/tools/coverage-dump" , "coverage-dump" ;
314+ Jsondocck , "src/tools/jsondocck" , "jsondocck" ;
315+ Jsondoclint , "src/tools/jsondoclint" , "jsondoclint" ;
316+ LintDocs , "src/tools/lint-docs" , "lint-docs" ;
317+ LlvmBitcodeLinker , "src/tools/llvm-bitcode-linker" , "llvm-bitcode-linker" ;
318+ Miri , "src/tools/miri" , "miri" ;
319+ MiroptTestTools , "src/tools/miropt-test-tools" , "miropt-test-tools" ;
320+ OptDist , "src/tools/opt-dist" , "opt-dist" ;
300321 RemoteTestClient , "src/tools/remote-test-client" , "remote-test-client" ;
322+ RemoteTestServer , "src/tools/remote-test-server" , "remote-test-server" ;
323+ Rls , "src/tools/rls" , "rls" ;
324+ RustAnalyzer , "src/tools/rust-analyzer" , "rust-analyzer" ;
325+ RustDemangler , "src/tools/rust-demangler" , "rust-demangler" ;
326+ Rustdoc , "src/tools/rustdoc" , "clippy" ;
327+ Rustfmt , "src/tools/rustfmt" , "rustfmt" ;
328+ RustInstaller , "src/tools/rust-installer" , "rust-installer" ;
329+ Tidy , "src/tools/tidy" , "tidy" ;
301330) ;
0 commit comments