mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-21 17:52:12 +03:00
Fix staging for x clippy std
This commit is contained in:
@@ -134,12 +134,29 @@ fn merge(&self, other: &Self) -> Self {
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||
pub struct Std {
|
||||
pub target: TargetSelection,
|
||||
build_compiler: Compiler,
|
||||
target: TargetSelection,
|
||||
config: LintConfig,
|
||||
/// Whether to lint only a subset of crates.
|
||||
crates: Vec<String>,
|
||||
}
|
||||
|
||||
impl Std {
|
||||
fn new(
|
||||
builder: &Builder<'_>,
|
||||
target: TargetSelection,
|
||||
config: LintConfig,
|
||||
crates: Vec<String>,
|
||||
) -> Self {
|
||||
Self {
|
||||
build_compiler: builder.compiler(builder.top_stage, builder.host_target),
|
||||
target,
|
||||
config,
|
||||
crates,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Step for Std {
|
||||
type Output = ();
|
||||
const DEFAULT: bool = true;
|
||||
@@ -151,12 +168,12 @@ fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
|
||||
fn make_run(run: RunConfig<'_>) {
|
||||
let crates = std_crates_for_run_make(&run);
|
||||
let config = LintConfig::new(run.builder);
|
||||
run.builder.ensure(Std { target: run.target, config, crates });
|
||||
run.builder.ensure(Std::new(run.builder, run.target, config, crates));
|
||||
}
|
||||
|
||||
fn run(self, builder: &Builder<'_>) {
|
||||
let target = self.target;
|
||||
let build_compiler = builder.compiler(builder.top_stage, builder.config.host_target);
|
||||
let build_compiler = self.build_compiler;
|
||||
|
||||
let mut cargo = builder::Cargo::new(
|
||||
builder,
|
||||
@@ -193,7 +210,7 @@ fn run(self, builder: &Builder<'_>) {
|
||||
}
|
||||
|
||||
fn metadata(&self) -> Option<StepMetadata> {
|
||||
Some(StepMetadata::clippy("std", self.target))
|
||||
Some(StepMetadata::clippy("std", self.target).built_by(self.build_compiler))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -510,11 +527,12 @@ fn run(self, builder: &Builder<'_>) -> Self::Output {
|
||||
],
|
||||
forbid: vec![],
|
||||
};
|
||||
builder.ensure(Std {
|
||||
target: self.target,
|
||||
config: self.config.merge(&library_clippy_cfg),
|
||||
crates: vec![],
|
||||
});
|
||||
builder.ensure(Std::new(
|
||||
builder,
|
||||
self.target,
|
||||
self.config.merge(&library_clippy_cfg),
|
||||
vec![],
|
||||
));
|
||||
|
||||
let compiler_clippy_cfg = LintConfig {
|
||||
allow: vec!["clippy::all".into()],
|
||||
|
||||
@@ -1556,38 +1556,6 @@ pub fn rustdoc_for_compiler(&self, target_compiler: Compiler) -> PathBuf {
|
||||
self.ensure(tool::Rustdoc { target_compiler })
|
||||
}
|
||||
|
||||
/// Create a Cargo command for running Clippy.
|
||||
/// The used Clippy is (or in the case of stage 0, already was) built using `build_compiler`.
|
||||
pub fn cargo_clippy_cmd(&self, build_compiler: Compiler) -> BootstrapCommand {
|
||||
if build_compiler.stage == 0 {
|
||||
let cargo_clippy = self
|
||||
.config
|
||||
.initial_cargo_clippy
|
||||
.clone()
|
||||
.unwrap_or_else(|| self.build.config.download_clippy());
|
||||
|
||||
let mut cmd = command(cargo_clippy);
|
||||
cmd.env("CARGO", &self.initial_cargo);
|
||||
return cmd;
|
||||
}
|
||||
|
||||
let compilers = RustcPrivateCompilers::from_build_compiler(
|
||||
self,
|
||||
build_compiler,
|
||||
self.build.host_target,
|
||||
);
|
||||
|
||||
let _ = self.ensure(tool::Clippy::from_compilers(compilers));
|
||||
let cargo_clippy = self.ensure(tool::CargoClippy::from_compilers(compilers));
|
||||
let mut dylib_path = helpers::dylib_path();
|
||||
dylib_path.insert(0, self.sysroot(build_compiler).join("lib"));
|
||||
|
||||
let mut cmd = command(cargo_clippy.tool_path);
|
||||
cmd.env(helpers::dylib_path_var(), env::join_paths(&dylib_path).unwrap());
|
||||
cmd.env("CARGO", &self.initial_cargo);
|
||||
cmd
|
||||
}
|
||||
|
||||
pub fn cargo_miri_cmd(&self, run_compiler: Compiler) -> BootstrapCommand {
|
||||
assert!(run_compiler.stage > 0, "miri can not be invoked at stage 0");
|
||||
|
||||
@@ -1614,6 +1582,37 @@ pub fn cargo_miri_cmd(&self, run_compiler: Compiler) -> BootstrapCommand {
|
||||
cmd
|
||||
}
|
||||
|
||||
/// Create a Cargo command for running Clippy.
|
||||
/// The used Clippy is (or in the case of stage 0, already was) built using `build_compiler`.
|
||||
pub fn cargo_clippy_cmd(&self, build_compiler: Compiler) -> BootstrapCommand {
|
||||
if build_compiler.stage == 0 {
|
||||
let cargo_clippy = self
|
||||
.config
|
||||
.initial_cargo_clippy
|
||||
.clone()
|
||||
.unwrap_or_else(|| self.build.config.download_clippy());
|
||||
|
||||
let mut cmd = command(cargo_clippy);
|
||||
cmd.env("CARGO", &self.initial_cargo);
|
||||
return cmd;
|
||||
}
|
||||
|
||||
// If we're linting something with build_compiler stage N, we want to build Clippy stage N
|
||||
// and use that to lint it. That is why we use the `build_compiler` as the target compiler
|
||||
// for RustcPrivateCompilers. We will use build compiler stage N-1 to build Clippy stage N.
|
||||
let compilers = RustcPrivateCompilers::from_target_compiler(self, build_compiler);
|
||||
|
||||
let _ = self.ensure(tool::Clippy::from_compilers(compilers));
|
||||
let cargo_clippy = self.ensure(tool::CargoClippy::from_compilers(compilers));
|
||||
let mut dylib_path = helpers::dylib_path();
|
||||
dylib_path.insert(0, self.sysroot(build_compiler).join("lib"));
|
||||
|
||||
let mut cmd = command(cargo_clippy.tool_path);
|
||||
cmd.env(helpers::dylib_path_var(), env::join_paths(&dylib_path).unwrap());
|
||||
cmd.env("CARGO", &self.initial_cargo);
|
||||
cmd
|
||||
}
|
||||
|
||||
pub fn rustdoc_cmd(&self, compiler: Compiler) -> BootstrapCommand {
|
||||
let mut cmd = command(self.bootstrap_out.join("rustdoc"));
|
||||
cmd.env("RUSTC_STAGE", compiler.stage.to_string())
|
||||
|
||||
@@ -2076,12 +2076,10 @@ fn clippy_ci() {
|
||||
[build] llvm <host>
|
||||
[build] rustc 0 <host> -> rustc 1 <host>
|
||||
[check] rustc 1 <host> -> rustc 2 <host>
|
||||
[build] rustc 1 <host> -> std 1 <host>
|
||||
[build] rustc 1 <host> -> rustc 2 <host>
|
||||
[build] rustc 1 <host> -> clippy-driver 2 <host>
|
||||
[build] rustc 1 <host> -> cargo-clippy 2 <host>
|
||||
[build] rustc 0 <host> -> clippy-driver 1 <host>
|
||||
[build] rustc 0 <host> -> cargo-clippy 1 <host>
|
||||
[clippy] bootstrap <host>
|
||||
[clippy] std <host>
|
||||
[clippy] rustc 1 <host> -> std 1 <host>
|
||||
[clippy] rustc 0 <host> -> rustc 1 <host>
|
||||
[clippy] rustc 0 <host> -> rustc_codegen_gcc 1 <host>
|
||||
");
|
||||
@@ -2100,14 +2098,12 @@ fn clippy_ci_stage_2() {
|
||||
[build] rustc 1 <host> -> std 1 <host>
|
||||
[build] rustc 1 <host> -> rustc 2 <host>
|
||||
[check] rustc 2 <host> -> rustc 3 <host>
|
||||
[build] rustc 2 <host> -> std 2 <host>
|
||||
[build] rustc 2 <host> -> rustc 3 <host>
|
||||
[build] rustc 2 <host> -> clippy-driver 3 <host>
|
||||
[build] rustc 2 <host> -> cargo-clippy 3 <host>
|
||||
[clippy] bootstrap <host>
|
||||
[clippy] std <host>
|
||||
[build] rustc 1 <host> -> clippy-driver 2 <host>
|
||||
[build] rustc 1 <host> -> cargo-clippy 2 <host>
|
||||
[clippy] bootstrap <host>
|
||||
[clippy] rustc 2 <host> -> std 2 <host>
|
||||
[build] rustc 0 <host> -> clippy-driver 1 <host>
|
||||
[build] rustc 0 <host> -> cargo-clippy 1 <host>
|
||||
[clippy] rustc 1 <host> -> rustc 2 <host>
|
||||
[clippy] rustc 1 <host> -> rustc_codegen_gcc 2 <host>
|
||||
");
|
||||
@@ -2134,11 +2130,9 @@ fn clippy_std() {
|
||||
.render_steps(), @r"
|
||||
[build] llvm <host>
|
||||
[build] rustc 0 <host> -> rustc 1 <host>
|
||||
[build] rustc 1 <host> -> std 1 <host>
|
||||
[build] rustc 1 <host> -> rustc 2 <host>
|
||||
[build] rustc 1 <host> -> clippy-driver 2 <host>
|
||||
[build] rustc 1 <host> -> cargo-clippy 2 <host>
|
||||
[clippy] std <host>
|
||||
[build] rustc 0 <host> -> clippy-driver 1 <host>
|
||||
[build] rustc 0 <host> -> cargo-clippy 1 <host>
|
||||
[clippy] rustc 1 <host> -> std 1 <host>
|
||||
");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user