Skip to content

x clippy implementation is deeply coupled with the core bootstrap #122825

Closed
@onur-ozkan

Description

@onur-ozkan

It's not possible to run x clippy only on certain paths. When running x clippy $tool, clippy starts giving warnings on the entire compiler and library tree as well. Therefore we are unable to run clippy with different set of rules indivudually for each tool/path.

The root cause of this problem is that bootstrap overrides all the commands before invocations with clippy as seen here:

/// Like `cargo`, but only passes flags that are valid for all commands.
pub fn bare_cargo(
&self,
compiler: Compiler,
mode: Mode,
target: TargetSelection,
cmd: &str,
) -> Command {
let mut cargo = if cmd == "clippy" {
self.cargo_clippy_cmd(compiler)

And that is because clippy is sharing the same logic with x check:

Kind::Check | Kind::Clippy | Kind::Fix => describe!(
check::Std,
check::Rustc,
check::Rustdoc,
check::CodegenBackend,
check::Clippy,
check::Miri,
check::CargoMiri,
check::MiroptTestTools,
check::Rls,
check::Rustfmt,
check::RustAnalyzer,
check::Bootstrap,
),

To prevent this problem we can create a new build step for clippy and then remove clippy-specific conditions from the core bootstrap flow.

Metadata

Metadata

Assignees

Labels

T-bootstrapRelevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions