-
Notifications
You must be signed in to change notification settings - Fork 14.1k
Don't suggest wrapping attr in unsafe if it may come from proc macro #149781
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
base: main
Are you sure you want to change the base?
Conversation
|
Some changes occurred in compiler/rustc_attr_parsing |
|
r? jdonszelmann |
| Some(unsafe_since) => path_span.edition() >= unsafe_since, | ||
| }; | ||
|
|
||
| let may_from_proc_macro = if diag_span.from_expansion() |
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.
can_be_used_for_suggestions() might be more appropriate.
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.
I tried this but it will deny suggestion for macro-rules macros, see test https://github.com/mu001999-contrib/rust/blob/7d1090ba9a06c297f7977b5d8e76681511f3e952/tests/ui/rust-2024/unsafe-attributes/unsafe-attributes-fix.rs
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.
I think such suggestions should still be emitted, how do you think about it?
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.
some smol nits, looks good otherwise!
|
Reminder, once the PR becomes ready for a review, use |
|
☔ The latest upstream changes (presumably #149798) made this pull request unmergeable. Please resolve the merge conflicts. |
|
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. |
|
@rustbot ready |
Don't emit the suggestion if the span may come from proc macro. Check this with the snippet because we cannot check if the span is from macro-rules or proc-macro (maybe this can happen in the future?).
Fixes #149756