Skip to content

Commit 879b09a

Browse files
committed
lint bootstrap, compiletest and tidy by default
Signed-off-by: onur-ozkan <[email protected]>
1 parent 006354c commit 879b09a

File tree

2 files changed

+23
-11
lines changed

2 files changed

+23
-11
lines changed

src/bootstrap/src/core/build_steps/clippy.rs

+22-10
Original file line numberDiff line numberDiff line change
@@ -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,
@@ -224,9 +233,7 @@ impl Step for Rustc {
224233
macro_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,
@@ -291,11 +303,11 @@ macro_rules! lint_any {
291303
}
292304

293305
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;
296308
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;
299311
RemoteTestServer, "src/tools/remote-test-server", "remote-test-server";
300312
RemoteTestClient, "src/tools/remote-test-client", "remote-test-client";
301313
);

src/bootstrap/src/core/build_steps/compile.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2015,7 +2015,7 @@ pub fn run_cargo(
20152015
crate::exit!(1);
20162016
}
20172017

2018-
if builder.config.dry_run() || builder.kind == Kind::Clippy {
2018+
if builder.config.dry_run() {
20192019
return Vec::new();
20202020
}
20212021

0 commit comments

Comments
 (0)