Skip to content

Commit fc4bf13

Browse files
committed
Remove compiler_for from dist::RustAnalyzer
1 parent 648d6ce commit fc4bf13

File tree

3 files changed

+16
-12
lines changed

3 files changed

+16
-12
lines changed

src/bootstrap/src/core/build_steps/dist.rs

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1334,9 +1334,10 @@ impl Step for Cargo {
13341334
}
13351335
}
13361336

1337+
/// Distribute the rust-analyzer component, which is used as a LSP by various IDEs.
13371338
#[derive(Debug, Clone, Hash, PartialEq, Eq)]
13381339
pub struct RustAnalyzer {
1339-
pub build_compiler: Compiler,
1340+
pub compilers: RustcPrivateCompilers,
13401341
pub target: TargetSelection,
13411342
}
13421343

@@ -1352,21 +1353,14 @@ impl Step for RustAnalyzer {
13521353

13531354
fn make_run(run: RunConfig<'_>) {
13541355
run.builder.ensure(RustAnalyzer {
1355-
build_compiler: run.builder.compiler_for(
1356-
run.builder.top_stage,
1357-
run.builder.config.host_target,
1358-
run.target,
1359-
),
1356+
compilers: RustcPrivateCompilers::new(run.builder, run.builder.top_stage, run.target),
13601357
target: run.target,
13611358
});
13621359
}
13631360

13641361
fn run(self, builder: &Builder<'_>) -> Option<GeneratedTarball> {
13651362
let target = self.target;
1366-
let compilers =
1367-
RustcPrivateCompilers::from_build_compiler(builder, self.build_compiler, self.target);
1368-
1369-
let rust_analyzer = builder.ensure(tool::RustAnalyzer::from_compilers(compilers));
1363+
let rust_analyzer = builder.ensure(tool::RustAnalyzer::from_compilers(self.compilers));
13701364

13711365
let mut tarball = Tarball::new(builder, "rust-analyzer", &target.triple);
13721366
tarball.set_overlay(OverlayKind::RustAnalyzer);
@@ -1375,6 +1369,13 @@ impl Step for RustAnalyzer {
13751369
tarball.add_legal_and_readme_to("share/doc/rust-analyzer");
13761370
Some(tarball.generate())
13771371
}
1372+
1373+
fn metadata(&self) -> Option<StepMetadata> {
1374+
Some(
1375+
StepMetadata::dist("rust-analyzer", self.target)
1376+
.built_by(self.compilers.build_compiler()),
1377+
)
1378+
}
13781379
}
13791380

13801381
#[derive(Debug, Clone, Hash, PartialEq, Eq)]
@@ -1672,7 +1673,7 @@ impl Step for Extended {
16721673
add_component!("rust-json-docs" => JsonDocs { build_compiler: target_compiler, target });
16731674
add_component!("cargo" => Cargo { build_compiler: compiler, target });
16741675
add_component!("rustfmt" => Rustfmt { build_compiler: compiler, target });
1675-
add_component!("rust-analyzer" => RustAnalyzer { build_compiler: compiler, target });
1676+
add_component!("rust-analyzer" => RustAnalyzer { compilers: RustcPrivateCompilers::from_build_compiler(builder, compiler, target), target });
16761677
add_component!("llvm-components" => LlvmTools { target });
16771678
add_component!("clippy" => Clippy { build_compiler: compiler, target });
16781679
add_component!("miri" => Miri { build_compiler: compiler, target });

src/bootstrap/src/core/build_steps/install.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ use std::path::{Component, Path, PathBuf};
77
use std::{env, fs};
88

99
use crate::core::build_steps::dist;
10+
use crate::core::build_steps::tool::RustcPrivateCompilers;
1011
use crate::core::builder::{Builder, RunConfig, ShouldRun, Step};
1112
use crate::core::config::{Config, TargetSelection};
1213
use crate::utils::exec::command;
@@ -227,7 +228,7 @@ install!((self, builder, _config),
227228
};
228229
RustAnalyzer, alias = "rust-analyzer", Self::should_build(_config), IS_HOST: true, {
229230
if let Some(tarball) =
230-
builder.ensure(dist::RustAnalyzer { build_compiler: self.compiler, target: self.target })
231+
builder.ensure(dist::RustAnalyzer { compilers: RustcPrivateCompilers::from_build_compiler(builder, self.compiler, self.target), target: self.target })
231232
{
232233
install_sh(builder, "rust-analyzer", self.compiler.stage, Some(self.target), &tarball);
233234
} else {

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1203,6 +1203,7 @@ mod snapshot {
12031203
[build] rustc 1 <host> -> cargo 2 <host>
12041204
[dist] rustc 1 <host> -> cargo 2 <host>
12051205
[build] rustc 1 <host> -> rust-analyzer 2 <host>
1206+
[dist] rustc 1 <host> -> rust-analyzer 2 <host>
12061207
[build] rustc 1 <host> -> rustfmt 2 <host>
12071208
[build] rustc 1 <host> -> cargo-fmt 2 <host>
12081209
[build] rustc 1 <host> -> clippy-driver 2 <host>
@@ -1533,6 +1534,7 @@ mod snapshot {
15331534
[build] rustc 1 <host> -> cargo 2 <target1>
15341535
[dist] rustc 1 <host> -> cargo 2 <target1>
15351536
[build] rustc 1 <host> -> rust-analyzer 2 <target1>
1537+
[dist] rustc 1 <host> -> rust-analyzer 2 <target1>
15361538
[build] rustc 1 <host> -> rustfmt 2 <target1>
15371539
[build] rustc 1 <host> -> cargo-fmt 2 <target1>
15381540
[build] rustc 1 <host> -> clippy-driver 2 <target1>

0 commit comments

Comments
 (0)