-
Notifications
You must be signed in to change notification settings - Fork 13.8k
Open
Labels
A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.A-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.S-has-mcveStatus: A Minimal Complete and Verifiable Example has been found for this issueStatus: A Minimal Complete and Verifiable Example has been found for this issueT-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.
Description
I tried this code:
#[deny(byte_slice_in_packed_struct_with_derive)]
#[repr(packed)]
#[derive(Hash)]
struct FlexZeroSlice {
width: u8,
data: [u8],
}
I expected to see this happen: The code does not compile, as the lint is triggered on the struct.
Instead, this happened: The code compiles with a warning, as the lint uses the crate-root NodeId for reporting.
(This lint specifically uses ast::CRATE_NODE_ID
rather than ecx.current_expansion.lint_node_id
, but the value of lint_node_id
during builtin derive expansion is always ast::CRATE_NODE_ID
)
Found while implementing a lint for #121053.
I had a brief go at fixing this but it looks like AST nodes are all still using dummy IDs at the point of builtin derive expansion and I'm unfamiliar with the AST renumbering
Metadata
Metadata
Assignees
Labels
A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.A-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.S-has-mcveStatus: A Minimal Complete and Verifiable Example has been found for this issueStatus: A Minimal Complete and Verifiable Example has been found for this issueT-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.