Skip to content

Commit 6b7a945

Browse files
committed
Remove compiler_for from dist::RustAnalyzer
1 parent cdf54bb commit 6b7a945

File tree

3 files changed

+18
-14
lines changed

3 files changed

+18
-14
lines changed

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

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1268,7 +1268,7 @@ impl Step for PlainSourceTarball {
12681268
}
12691269
}
12701270

1271-
#[derive(Debug, PartialOrd, Ord, Clone, Hash, PartialEq, Eq)]
1271+
#[derive(Debug, Clone, Hash, PartialEq, Eq)]
12721272
pub struct Cargo {
12731273
pub build_compiler: Compiler,
12741274
pub target: TargetSelection,
@@ -1325,9 +1325,10 @@ impl Step for Cargo {
13251325
}
13261326
}
13271327

1328-
#[derive(Debug, PartialOrd, Ord, Clone, Hash, PartialEq, Eq)]
1328+
/// Distribute the rust-analyzer component, which is used as a LSP by various IDEs.
1329+
#[derive(Debug, Clone, Hash, PartialEq, Eq)]
13291330
pub struct RustAnalyzer {
1330-
pub build_compiler: Compiler,
1331+
pub compilers: RustcPrivateCompilers,
13311332
pub target: TargetSelection,
13321333
}
13331334

@@ -1343,21 +1344,14 @@ impl Step for RustAnalyzer {
13431344

13441345
fn make_run(run: RunConfig<'_>) {
13451346
run.builder.ensure(RustAnalyzer {
1346-
build_compiler: run.builder.compiler_for(
1347-
run.builder.top_stage,
1348-
run.builder.config.host_target,
1349-
run.target,
1350-
),
1347+
compilers: RustcPrivateCompilers::new(run.builder, run.builder.top_stage, run.target),
13511348
target: run.target,
13521349
});
13531350
}
13541351

13551352
fn run(self, builder: &Builder<'_>) -> Option<GeneratedTarball> {
13561353
let target = self.target;
1357-
let compilers =
1358-
RustcPrivateCompilers::from_build_compiler(builder, self.build_compiler, self.target);
1359-
1360-
let rust_analyzer = builder.ensure(tool::RustAnalyzer::from_compilers(compilers));
1354+
let rust_analyzer = builder.ensure(tool::RustAnalyzer::from_compilers(self.compilers));
13611355

13621356
let mut tarball = Tarball::new(builder, "rust-analyzer", &target.triple);
13631357
tarball.set_overlay(OverlayKind::RustAnalyzer);
@@ -1366,6 +1360,13 @@ impl Step for RustAnalyzer {
13661360
tarball.add_legal_and_readme_to("share/doc/rust-analyzer");
13671361
Some(tarball.generate())
13681362
}
1363+
1364+
fn metadata(&self) -> Option<StepMetadata> {
1365+
Some(
1366+
StepMetadata::dist("rust-analyzer", self.target)
1367+
.built_by(self.compilers.build_compiler()),
1368+
)
1369+
}
13691370
}
13701371

13711372
#[derive(Debug, Clone, Hash, PartialEq, Eq)]
@@ -1663,7 +1664,7 @@ impl Step for Extended {
16631664
add_component!("rust-json-docs" => JsonDocs { build_compiler: target_compiler, target });
16641665
add_component!("cargo" => Cargo { build_compiler: compiler, target });
16651666
add_component!("rustfmt" => Rustfmt { build_compiler: compiler, target });
1666-
add_component!("rust-analyzer" => RustAnalyzer { build_compiler: compiler, target });
1667+
add_component!("rust-analyzer" => RustAnalyzer { compilers: RustcPrivateCompilers::from_build_compiler(builder, compiler, target), target });
16671668
add_component!("llvm-components" => LlvmTools { target });
16681669
add_component!("clippy" => Clippy { build_compiler: compiler, target });
16691670
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
@@ -1126,6 +1126,7 @@ mod snapshot {
11261126
[build] rustc 1 <host> -> cargo 2 <host>
11271127
[dist] rustc 1 <host> -> cargo 2 <host>
11281128
[build] rustc 1 <host> -> rust-analyzer 2 <host>
1129+
[dist] rustc 1 <host> -> rust-analyzer 2 <host>
11291130
[build] rustc 1 <host> -> rustfmt 2 <host>
11301131
[build] rustc 1 <host> -> cargo-fmt 2 <host>
11311132
[build] rustc 1 <host> -> clippy-driver 2 <host>
@@ -1456,6 +1457,7 @@ mod snapshot {
14561457
[build] rustc 1 <host> -> cargo 2 <target1>
14571458
[dist] rustc 1 <host> -> cargo 2 <target1>
14581459
[build] rustc 1 <host> -> rust-analyzer 2 <target1>
1460+
[dist] rustc 1 <host> -> rust-analyzer 2 <target1>
14591461
[build] rustc 1 <host> -> rustfmt 2 <target1>
14601462
[build] rustc 1 <host> -> cargo-fmt 2 <target1>
14611463
[build] rustc 1 <host> -> clippy-driver 2 <target1>

0 commit comments

Comments
 (0)