-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix allow_attributes when expanded from some macros #13599
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Checking lintcheck, seems that this is only affecting to regular macros, and local macros at that point. Could you add an item to the test that checks that this works?
2fa4dc3
to
4a81320
Compare
4a81320
to
59ecf4d
Compare
I've created a macro that recreates what bytemuck was doing and added it to the tests. On the bright side, given how much effort it takes to create a macro that generates tokens where the spans start with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks! ❤️
@bors r+ |
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
fixes #13349
The issue here was that the start pattern being matched on the original source code was not specific enough. When using derive macros or in the issue case a
#[repr(C)]
the#
would match the start pattern meaning that the expanded macro appeared to be unchanged and clippy would lint it.The change I made was to make the matching more specific by matching
#[ident
at the start. We still need the second string to match just the ident on its own because of things like#[cfg_attr(panic = "unwind", allow(unused))]
.I also noticed some typos with start and end, these code paths weren't being reached so this doesn't fix anything.
changelog: FP: [
allow_attributes
]: don't trigger when expanded from some macros