Skip to content

Commit 15fd8d6

Browse files
committed
Fixup rust-analyzer checking
1 parent ad5eca6 commit 15fd8d6

File tree

2 files changed

+24
-6
lines changed

2 files changed

+24
-6
lines changed

src/bootstrap/src/core/build_steps/check.rs

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -323,8 +323,10 @@ impl Step for CodegenBackend {
323323
}
324324
}
325325

326+
/// Checks Rust analyzer that links to .rmetas from a checked rustc.
326327
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
327328
pub struct RustAnalyzer {
329+
pub build_compiler: Compiler,
328330
pub target: TargetSelection,
329331
}
330332

@@ -345,18 +347,17 @@ impl Step for RustAnalyzer {
345347
}
346348

347349
fn make_run(run: RunConfig<'_>) {
348-
run.builder.ensure(RustAnalyzer { target: run.target });
350+
let build_compiler = prepare_compiler_for_tool_rustc(run.builder, run.target);
351+
run.builder.ensure(RustAnalyzer { build_compiler, target: run.target });
349352
}
350353

351354
fn run(self, builder: &Builder<'_>) {
352-
let compiler = builder.compiler(builder.top_stage, builder.config.host_target);
355+
let build_compiler = self.build_compiler;
353356
let target = self.target;
354357

355-
builder.ensure(Rustc::new(target, builder));
356-
357358
let mut cargo = prepare_tool_cargo(
358359
builder,
359-
compiler,
360+
build_compiler,
360361
Mode::ToolRustc,
361362
target,
362363
builder.kind,
@@ -373,12 +374,16 @@ impl Step for RustAnalyzer {
373374

374375
// Cargo's output path in a given stage, compiled by a particular
375376
// compiler for the specified target.
376-
let stamp = BuildStamp::new(&builder.cargo_out(compiler, Mode::ToolRustc, target))
377+
let stamp = BuildStamp::new(&builder.cargo_out(build_compiler, Mode::ToolRustc, target))
377378
.with_prefix("rust-analyzer-check");
378379

379380
let _guard = builder.msg_check("rust-analyzer artifacts", target, None);
380381
run_cargo(builder, cargo, builder.config.free_args.clone(), &stamp, vec![], true, false);
381382
}
383+
384+
fn metadata(&self) -> Option<StepMetadata> {
385+
Some(StepMetadata::check("rust-analyzer", self.target).built_by(self.build_compiler))
386+
}
382387
}
383388

384389
/// Compiletest is implicitly "checked" when it gets built in order to run tests,

src/bootstrap/src/core/builder/tests.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1435,6 +1435,19 @@ mod snapshot {
14351435
");
14361436
}
14371437

1438+
#[test]
1439+
fn check_rust_analyzer() {
1440+
let ctx = TestCtx::new();
1441+
insta::assert_snapshot!(
1442+
ctx.config("check")
1443+
.path("rust-analyzer")
1444+
.render_steps(), @r"
1445+
[build] llvm <host>
1446+
[check] rustc 0 <host> -> rustc 1 <host>
1447+
[check] rustc 0 <host> -> rust-analyzer 1 <host>
1448+
");
1449+
}
1450+
14381451
#[test]
14391452
fn test_exclude() {
14401453
let ctx = TestCtx::new();

0 commit comments

Comments
 (0)