Run clippy on cg_gcc in CI
This is to prevent this issue: in cg_gcc repository, we run clippy on our code but not in here, which can create issues.
cc @antoyo r? @Kobzol
Kobzol is not on the review rotation at the moment.
They may take a while to respond.
The job x86_64-gnu-gcc failed! Check out the build log: (web) (plain enhanced) (plain)
Click to see the possible cause of the failure (guessed by this bot)
downloading https://static.rust-lang.org/dist/2025-10-28/rustc-nightly-x86_64-unknown-linux-gnu.tar.xz
extracting /checkout/obj/build/cache/2025-10-28/rustc-nightly-x86_64-unknown-linux-gnu.tar.xz to /checkout/obj/build/x86_64-unknown-linux-gnu/rustfmt
[TIMING:start] tool::LibcxxVersionTool { target: x86_64-unknown-linux-gnu }
[TIMING:end] tool::LibcxxVersionTool { target: x86_64-unknown-linux-gnu } -- 0.219
ERROR: no `clippy` rules matched [compiler/rustc_codegen_gcc]
HELP: run `x.py clippy --help --verbose` to show a list of available paths
NOTE: if you are adding a new Step to bootstrap itself, make sure you register it with `describe!`
Bootstrap failed while executing `--stage 2 clippy compiler/rustc_codegen_gcc`
Build completed unsuccessfully in 0:00:14
local time: Sat Nov 29 17:37:49 UTC 2025
network time: Sat, 29 Nov 2025 17:37:50 GMT
****************************************************************************
To find more information about this job, visit the following URL:
For more information how to resolve CI failures of this job, visit this link.
The job aarch64-gnu-llvm-20-2 failed! Check out the build log: (web) (plain enhanced) (plain)
Click to see the possible cause of the failure (guessed by this bot)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Snapshot Summary ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Snapshot: clippy_compiler_stage1
Source: src/bootstrap/src/core/builder/tests.rs:2760
────────────────────────────────────────────────────────────────────────────────
Expression: ctx.config("clippy").path("compiler").render_steps()
────────────────────────────────────────────────────────────────────────────────
-old snapshot
+new results
────────────┬───────────────────────────────────────────────────────────────────
0 0 │ [build] llvm <host>
1 │-[clippy] rustc 0 <host> -> rustc 1 <host>
1 │+[clippy] rustc 0 <host> -> rustc 1 <host>
2 │+[check] rustc 0 <host> -> rustc 1 <host>
3 │+[clippy] rustc 0 <host> -> rustc_codegen_gcc 1 <host>
────────────┴───────────────────────────────────────────────────────────────────
Stopped on the first failure. Run `cargo insta test` to run all snapshots.
thread 'core::builder::tests::snapshot::clippy_compiler_stage1' (11534) panicked at /cargo/registry/src/index.crates.io-1949cf8c6b5b557f/insta-1.43.1/src/runtime.rs:679:13:
snapshot assertion for 'clippy_compiler_stage1' failed in line 2760
stack backtrace:
0: __rustc::rust_begin_unwind
at /rustc/3b4dd9bf1410f8da6329baa36ce5e37673cbbd1f/library/std/src/panicking.rs:698:5
1: core::panicking::panic_fmt
at /rustc/3b4dd9bf1410f8da6329baa36ce5e37673cbbd1f/library/core/src/panicking.rs:80:14
2: <insta::runtime::SnapshotAssertionContext>::finalize
at /cargo/registry/src/index.crates.io-1949cf8c6b5b557f/insta-1.43.1/src/runtime.rs:679:13
3: insta::runtime::assert_snapshot
at /cargo/registry/src/index.crates.io-1949cf8c6b5b557f/insta-1.43.1/src/runtime.rs:848:13
4: bootstrap::core::builder::tests::snapshot::clippy_compiler_stage1
at ./src/core/builder/tests.rs:2760:9
5: bootstrap::core::builder::tests::snapshot::clippy_compiler_stage1::{closure#0}
at ./src/core/builder/tests.rs:2758:32
6: <bootstrap::core::builder::tests::snapshot::clippy_compiler_stage1::{closure#0} as core::ops::function::FnOnce<()>>::call_once
---
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Snapshot Summary ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Snapshot: clippy_compiler_stage2
Source: src/bootstrap/src/core/builder/tests.rs:2772
────────────────────────────────────────────────────────────────────────────────
Expression: ctx.config("clippy").path("compiler").stage(2).render_steps()
────────────────────────────────────────────────────────────────────────────────
-old snapshot
+new results
────────────┬───────────────────────────────────────────────────────────────────
1 1 │ [build] rustc 0 <host> -> rustc 1 <host>
2 2 │ [build] rustc 1 <host> -> std 1 <host>
3 3 │ [build] rustc 0 <host> -> clippy-driver 1 <host>
4 4 │ [build] rustc 0 <host> -> cargo-clippy 1 <host>
5 │-[clippy] rustc 1 <host> -> rustc 2 <host>
5 │+[clippy] rustc 1 <host> -> rustc 2 <host>
6 │+[check] rustc 1 <host> -> rustc 2 <host>
7 │+[clippy] rustc 1 <host> -> rustc_codegen_gcc 2 <host>
────────────┴───────────────────────────────────────────────────────────────────
Stopped on the first failure. Run `cargo insta test` to run all snapshots.
thread 'core::builder::tests::snapshot::clippy_compiler_stage2' (11545) panicked at /cargo/registry/src/index.crates.io-1949cf8c6b5b557f/insta-1.43.1/src/runtime.rs:679:13:
snapshot assertion for 'clippy_compiler_stage2' failed in line 2772
stack backtrace:
0: __rustc::rust_begin_unwind
at /rustc/3b4dd9bf1410f8da6329baa36ce5e37673cbbd1f/library/std/src/panicking.rs:698:5
1: core::panicking::panic_fmt
at /rustc/3b4dd9bf1410f8da6329baa36ce5e37673cbbd1f/library/core/src/panicking.rs:80:14
2: <insta::runtime::SnapshotAssertionContext>::finalize
at /cargo/registry/src/index.crates.io-1949cf8c6b5b557f/insta-1.43.1/src/runtime.rs:679:13
3: insta::runtime::assert_snapshot
at /cargo/registry/src/index.crates.io-1949cf8c6b5b557f/insta-1.43.1/src/runtime.rs:848:13
4: bootstrap::core::builder::tests::snapshot::clippy_compiler_stage2
at ./src/core/builder/tests.rs:2772:9
5: bootstrap::core::builder::tests::snapshot::clippy_compiler_stage2::{closure#0}
at ./src/core/builder/tests.rs:2770:32
6: <bootstrap::core::builder::tests::snapshot::clippy_compiler_stage2::{closure#0} as core::ops::function::FnOnce<()>>::call_once
The job aarch64-gnu-llvm-20-2 failed! Check out the build log: (web) (plain enhanced) (plain)
Click to see the possible cause of the failure (guessed by this bot)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Snapshot Summary ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Snapshot: clippy_compiler_stage1
Source: src/bootstrap/src/core/builder/tests.rs:2760
────────────────────────────────────────────────────────────────────────────────
Expression: ctx.config("clippy").path("compiler").render_steps()
────────────────────────────────────────────────────────────────────────────────
-old snapshot
+new results
────────────┬───────────────────────────────────────────────────────────────────
0 0 │ [build] llvm <host>
1 1 │ [clippy] rustc 0 <host> -> rustc 1 <host>
2 2 │ [check] rustc 0 <host> -> rustc 1 <host>
3 │-[clippy] rustc 1 <host> -> rustc 2 <host>
4 │-[check] rustc 1 <host> -> rustc 2 <host>
5 │-[clippy] rustc 1 <host> -> rustc_codegen_gcc 2 <host>
3 │+[clippy] rustc 0 <host> -> rustc_codegen_gcc 1 <host>
────────────┴───────────────────────────────────────────────────────────────────
Stopped on the first failure. Run `cargo insta test` to run all snapshots.
thread 'core::builder::tests::snapshot::clippy_compiler_stage1' (11564) panicked at /cargo/registry/src/index.crates.io-1949cf8c6b5b557f/insta-1.43.1/src/runtime.rs:679:13:
snapshot assertion for 'clippy_compiler_stage1' failed in line 2760
stack backtrace:
0: __rustc::rust_begin_unwind
at /rustc/3b4dd9bf1410f8da6329baa36ce5e37673cbbd1f/library/std/src/panicking.rs:698:5
1: core::panicking::panic_fmt
at /rustc/3b4dd9bf1410f8da6329baa36ce5e37673cbbd1f/library/core/src/panicking.rs:80:14
2: <insta::runtime::SnapshotAssertionContext>::finalize
at /cargo/registry/src/index.crates.io-1949cf8c6b5b557f/insta-1.43.1/src/runtime.rs:679:13
3: insta::runtime::assert_snapshot
at /cargo/registry/src/index.crates.io-1949cf8c6b5b557f/insta-1.43.1/src/runtime.rs:848:13
4: bootstrap::core::builder::tests::snapshot::clippy_compiler_stage1
at ./src/core/builder/tests.rs:2760:9
5: bootstrap::core::builder::tests::snapshot::clippy_compiler_stage1::{closure#0}
at ./src/core/builder/tests.rs:2758:32
6: <bootstrap::core::builder::tests::snapshot::clippy_compiler_stage1::{closure#0} as core::ops::function::FnOnce<()>>::call_once
---
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Snapshot Summary ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Snapshot: clippy_compiler_stage2
Source: src/bootstrap/src/core/builder/tests.rs:2776
────────────────────────────────────────────────────────────────────────────────
Expression: ctx.config("clippy").path("compiler").stage(2).render_steps()
────────────────────────────────────────────────────────────────────────────────
-old snapshot
+new results
────────────┬───────────────────────────────────────────────────────────────────
1 1 │ [build] rustc 0 <host> -> rustc 1 <host>
2 2 │ [build] rustc 1 <host> -> std 1 <host>
3 3 │ [build] rustc 0 <host> -> clippy-driver 1 <host>
4 4 │ [build] rustc 0 <host> -> cargo-clippy 1 <host>
5 │-[clippy] rustc 1 <host> -> rustc 2 <host>
5 │+[clippy] rustc 1 <host> -> rustc 2 <host>
6 │+[check] rustc 1 <host> -> rustc 2 <host>
7 │+[clippy] rustc 1 <host> -> rustc_codegen_gcc 2 <host>
────────────┴───────────────────────────────────────────────────────────────────
Stopped on the first failure. Run `cargo insta test` to run all snapshots.
thread 'core::builder::tests::snapshot::clippy_compiler_stage2' (11567) panicked at /cargo/registry/src/index.crates.io-1949cf8c6b5b557f/insta-1.43.1/src/runtime.rs:679:13:
snapshot assertion for 'clippy_compiler_stage2' failed in line 2776
stack backtrace:
0: __rustc::rust_begin_unwind
at /rustc/3b4dd9bf1410f8da6329baa36ce5e37673cbbd1f/library/std/src/panicking.rs:698:5
1: core::panicking::panic_fmt
at /rustc/3b4dd9bf1410f8da6329baa36ce5e37673cbbd1f/library/core/src/panicking.rs:80:14
2: <insta::runtime::SnapshotAssertionContext>::finalize
at /cargo/registry/src/index.crates.io-1949cf8c6b5b557f/insta-1.43.1/src/runtime.rs:679:13
3: insta::runtime::assert_snapshot
at /cargo/registry/src/index.crates.io-1949cf8c6b5b557f/insta-1.43.1/src/runtime.rs:848:13
4: bootstrap::core::builder::tests::snapshot::clippy_compiler_stage2
at ./src/core/builder/tests.rs:2776:9
5: bootstrap::core::builder::tests::snapshot::clippy_compiler_stage2::{closure#0}
at ./src/core/builder/tests.rs:2774:32
6: <bootstrap::core::builder::tests::snapshot::clippy_compiler_stage2::{closure#0} as core::ops::function::FnOnce<()>>::call_once
Fixed bootstrap tests and CI is happy. :)
I suppose it's fine if updating clippy triggers new lints in cg_gcc, no?
As long as it doesn't happen too often and isn't too annoying to fix, I would say that it is fine, yes. But it would be better to ask the people who do the Clippy syncs :)
Fair enough!
@flip1995 would it be ok if we deny clippy warnings in cg_gcc, potentially meaning that clippy syncs will involve fixing these new warnings as well?
So, I'm a bit confused by this 😅 We have been running Clippy on
cg_gccon CI since January 2025 (#135478). So this PR probably doesn't do exactly what you expect it to.
So, what's probably missing is running clippy without the default features, then. That is what I noticed here.
Yes that is fine. I've already been doing this
since January 2025
(apparently). I think I had to fix something twice in cg_gcc since then. This also really helps to detect bugs in Clippy during the sync! So feel free to adjust the configuration in this repo to be as close as possible with the one in the cg_gcc repo.
The only thing I can't promise is that the fixes done with the Clippy version in this repo won't conflict with what Clippy sees in the cg_gcc repo. But I don't think there will be a lot of conflicts in this direction, as Clippy in this repo is always the newest possible version.
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.
Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.
The job tidy failed! Check out the build log: (web) (plain enhanced) (plain)
Click to see the possible cause of the failure (guessed by this bot)
[TIMING:end] tool::ToolBuild { build_compiler: Compiler { stage: 0, host: x86_64-unknown-linux-gnu, forced_compiler: false }, target: x86_64-unknown-linux-gnu, tool: "tidy", path: "src/tools/tidy", mode: ToolBootstrap, source_type: InTree, extra_features: [], allow_features: "", cargo_args: [], artifact_kind: Binary } -- 13.732
[TIMING:end] tool::Tidy { compiler: Compiler { stage: 0, host: x86_64-unknown-linux-gnu, forced_compiler: false }, target: x86_64-unknown-linux-gnu } -- 0.000
fmt check
Diff in /checkout/src/bootstrap/src/core/build_steps/clippy.rs:380:
.with_prefix("rustc_codegen_gcc-check");
let args = lint_args(builder, &self.config, &[]);
- run_cargo(
- builder,
- cargo,
- args.clone(),
- &stamp,
- vec![],
- true,
- false,
- );
+ run_cargo(builder, cargo, args.clone(), &stamp, vec![], true, false);
// Same but we disable the features enabled by default.
let mut cargo = prepare_tool_cargo(
Diff in /checkout/src/bootstrap/src/core/build_steps/clippy.rs:403:
);
self.build_compiler.configure_cargo(&mut cargo);
cargo.arg("--no-default-features");
- run_cargo(
- builder,
- cargo,
- args,
- &stamp,
- vec![],
- true,
- false,
- );
+ run_cargo(builder, cargo, args, &stamp, vec![], true, false);
}
fn metadata(&self) -> Option<StepMetadata> {
fmt: checked 6585 files
Bootstrap failed while executing `test src/tools/tidy tidyselftest --extra-checks=py,cpp,js,spellcheck`
The job aarch64-gnu-llvm-20-2 failed! Check out the build log: (web) (plain enhanced) (plain)
Click to see the possible cause of the failure (guessed by this bot)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Snapshot Summary ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Snapshot: clippy_compiler_stage1
Source: src/bootstrap/src/core/builder/tests.rs:2760
────────────────────────────────────────────────────────────────────────────────
Expression: ctx.config("clippy").path("compiler").render_steps()
────────────────────────────────────────────────────────────────────────────────
-old snapshot
+new results
────────────┬───────────────────────────────────────────────────────────────────
0 0 │ [build] llvm <host>
1 │-[clippy] rustc 0 <host> -> rustc 1 <host>
1 │+[clippy] rustc 0 <host> -> rustc 1 <host>
2 │+[check] rustc 0 <host> -> rustc 1 <host>
3 │+[clippy] rustc 0 <host> -> rustc_codegen_gcc 1 <host>
────────────┴───────────────────────────────────────────────────────────────────
Stopped on the first failure. Run `cargo insta test` to run all snapshots.
thread 'core::builder::tests::snapshot::clippy_compiler_stage1' (11810) panicked at /cargo/registry/src/index.crates.io-1949cf8c6b5b557f/insta-1.43.1/src/runtime.rs:679:13:
snapshot assertion for 'clippy_compiler_stage1' failed in line 2760
stack backtrace:
0: __rustc::rust_begin_unwind
at /rustc/3b4dd9bf1410f8da6329baa36ce5e37673cbbd1f/library/std/src/panicking.rs:698:5
1: core::panicking::panic_fmt
at /rustc/3b4dd9bf1410f8da6329baa36ce5e37673cbbd1f/library/core/src/panicking.rs:80:14
2: <insta::runtime::SnapshotAssertionContext>::finalize
at /cargo/registry/src/index.crates.io-1949cf8c6b5b557f/insta-1.43.1/src/runtime.rs:679:13
3: insta::runtime::assert_snapshot
at /cargo/registry/src/index.crates.io-1949cf8c6b5b557f/insta-1.43.1/src/runtime.rs:848:13
4: bootstrap::core::builder::tests::snapshot::clippy_compiler_stage1
at ./src/core/builder/tests.rs:2760:9
5: bootstrap::core::builder::tests::snapshot::clippy_compiler_stage1::{closure#0}
at ./src/core/builder/tests.rs:2758:32
6: <bootstrap::core::builder::tests::snapshot::clippy_compiler_stage1::{closure#0} as core::ops::function::FnOnce<()>>::call_once
---
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Snapshot Summary ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Snapshot: clippy_compiler_stage2
Source: src/bootstrap/src/core/builder/tests.rs:2772
────────────────────────────────────────────────────────────────────────────────
Expression: ctx.config("clippy").path("compiler").stage(2).render_steps()
────────────────────────────────────────────────────────────────────────────────
-old snapshot
+new results
────────────┬───────────────────────────────────────────────────────────────────
1 1 │ [build] rustc 0 <host> -> rustc 1 <host>
2 2 │ [build] rustc 1 <host> -> std 1 <host>
3 3 │ [build] rustc 0 <host> -> clippy-driver 1 <host>
4 4 │ [build] rustc 0 <host> -> cargo-clippy 1 <host>
5 │-[clippy] rustc 1 <host> -> rustc 2 <host>
5 │+[clippy] rustc 1 <host> -> rustc 2 <host>
6 │+[check] rustc 1 <host> -> rustc 2 <host>
7 │+[clippy] rustc 1 <host> -> rustc_codegen_gcc 2 <host>
────────────┴───────────────────────────────────────────────────────────────────
Stopped on the first failure. Run `cargo insta test` to run all snapshots.
thread 'core::builder::tests::snapshot::clippy_compiler_stage2' (11818) panicked at /cargo/registry/src/index.crates.io-1949cf8c6b5b557f/insta-1.43.1/src/runtime.rs:679:13:
snapshot assertion for 'clippy_compiler_stage2' failed in line 2772
stack backtrace:
0: __rustc::rust_begin_unwind
at /rustc/3b4dd9bf1410f8da6329baa36ce5e37673cbbd1f/library/std/src/panicking.rs:698:5
1: core::panicking::panic_fmt
at /rustc/3b4dd9bf1410f8da6329baa36ce5e37673cbbd1f/library/core/src/panicking.rs:80:14
2: <insta::runtime::SnapshotAssertionContext>::finalize
at /cargo/registry/src/index.crates.io-1949cf8c6b5b557f/insta-1.43.1/src/runtime.rs:679:13
3: insta::runtime::assert_snapshot
at /cargo/registry/src/index.crates.io-1949cf8c6b5b557f/insta-1.43.1/src/runtime.rs:848:13
4: bootstrap::core::builder::tests::snapshot::clippy_compiler_stage2
at ./src/core/builder/tests.rs:2772:9
5: bootstrap::core::builder::tests::snapshot::clippy_compiler_stage2::{closure#0}
at ./src/core/builder/tests.rs:2770:32
6: <bootstrap::core::builder::tests::snapshot::clippy_compiler_stage2::{closure#0} as core::ops::function::FnOnce<()>>::call_once
The job pr-check-2 failed! Check out the build log: (web) (plain enhanced) (plain)
Click to see the possible cause of the failure (guessed by this bot)
Checking rustc_codegen_gcc v0.1.0 (/checkout/compiler/rustc_codegen_gcc)
error: unused variable: `location`
--> compiler/rustc_codegen_gcc/src/builder.rs:506:17
|
506 | if let Some(location) = bx.location {
| ^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_location`
|
= note: `-D unused-variables` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(unused_variables)]`
[RUSTC-TIMING] rustc_codegen_gcc test:false 2.463
CI failed so all good. Sending fix for cg_gcc now. :)
Some changes occurred in compiler/rustc_codegen_gcc
cc @antoyo, @GuillaumeGomez
The job pr-check-2 failed! Check out the build log: (web) (plain enhanced) (plain)
Click to see the possible cause of the failure (guessed by this bot)
Checking rustc_codegen_gcc v0.1.0 (/checkout/compiler/rustc_codegen_gcc)
error: unused variable: `bx`
--> compiler/rustc_codegen_gcc/src/builder.rs:503:5
|
503 | bx: &mut Builder<'a, 'gcc, 'tcx>,
| ^^ help: if this is intentional, prefix it with an underscore: `_bx`
|
= note: `-D unused-variables` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(unused_variables)]`
[RUSTC-TIMING] rustc_codegen_gcc test:false 2.649
Is there some way to make it more obvious in the error message that these errors come with --no-default-features so that people understand more easily where they come from?
Would that be helpful?
Is there some way to make it more obvious in the error message that these errors come with
--no-default-featuresso that people understand more easily where they come from? Would that be helpful?
Hum... Except adding a println! right before I make the call, I don't see how we can do. Sounds like something for a follow-up. :p
You can r=me with or without the print (I agree that a print should be enough).
Let's add a print then.
Added the print. Let's go then.
@bors r=kobzol rollup
:pushpin: Commit 06500aa2ddba47bc3511236dcdca640c83ee5252 has been approved by kobzol
It is now in the queue for this repository.
The job aarch64-gnu-llvm-20-2 failed! Check out the build log: (web) (plain enhanced) (plain)
Click to see the possible cause of the failure (guessed by this bot)
Compiling rustc_parse v0.0.0 (/checkout/compiler/rustc_parse)
[RUSTC-TIMING] rustc_session test:false 24.082
Compiling rustc_next_trait_solver v0.0.0 (/checkout/compiler/rustc_next_trait_solver)
Session terminated, killing shell...::group::Clock drift check
local time: Tue Dec 9 17:13:03 UTC 2025
##[error]The runner has received a shutdown signal. This can happen when the runner service is stopped, or a manually started runner is canceled.
network time: Tue, 09 Dec 2025 17:13:03 GMT
##[endgroup]
...killed.