-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Open
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)C-bugCategory: This is a bug.Category: This is a bug.D-invalid-suggestionDiagnostics: A structured suggestion resulting in incorrect code.Diagnostics: A structured suggestion resulting in incorrect code.L-unused_parensLint: unused_parensLint: unused_parensT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.This issue may need triage. Remove it if it has been sufficiently triaged.
Description
Summary
Clippy transforms structs in combination with modular_bitfield
and derive(Debug)
macros into invalid rust sytnax.
See minimal reproducible example: https://github.com/unyt-org/clippy-bug-example
Reproducer
Given the following struct definition:
#[bitfield]
#[derive(Debug)]
pub struct Flags {
val: u8,
}
cargo clippy --fix
generates the following code:
#[bitfield]
#[derive(Debug)]
pub struct Flags {
al: u,
}
Version
rustc 1.90.0-nightly (3014e79f9 2025-07-15)
binary: rustc
commit-hash: 3014e79f9c8d5510ea7b3a3b70d171d0948b1e96
commit-date: 2025-07-15
host: aarch64-apple-darwin
release: 1.90.0-nightly
LLVM version: 20.1.8
Additional Labels
No response
jonasstrehle
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)C-bugCategory: This is a bug.Category: This is a bug.D-invalid-suggestionDiagnostics: A structured suggestion resulting in incorrect code.Diagnostics: A structured suggestion resulting in incorrect code.L-unused_parensLint: unused_parensLint: unused_parensT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.This issue may need triage. Remove it if it has been sufficiently triaged.