-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Enable report_in_external_macro in unaligned_references #82587
Conversation
= note: fields of packed structs are not properly aligned, and creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) | ||
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) | ||
|
||
warning: borrow of packed field is unsafe and requires unsafe function or block (error E0133) |
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 you allow
this lint, just to make sure we focus on the one we really care about here?
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.
That makes sense. Updated to allow safe_packed_borrows
.
The change makes sense at first sight, but I don't feel comfortable approving this since I have no idea if there are any side-effects to using this flag. Cc @rust-lang/compiler -- does anyone know what |
8f16211
to
62b4b8d
Compare
Technically all lint changes need to be approved by the lang team. I'm going ahead and accept this however, since the lint is allow-by-default so if it is denied, the user must be expecting it to occur. This can theoretically be a breaking change in a bin crate that uses a macro that (uselessly) denies this right now. @bors r+ rollup=never (for bisection) |
📌 Commit 62b4b8d has been approved by |
Furthermore, when/if this becomes a hard error, it will certainly also be a hard error when the code originates in an external macro.
FWIW, I am hoping to change this soon with #82525. |
☀️ Test successful - checks-actions |
Fixes an issue where
unaligned_references
is not triggered in external macros, unlikesafe_packed_borrows
.Also, given that this lint is planned to eventually change to hard error (#82525), it would make sense for this lint to be triggered for external macros as well.
See taiki-e/pin-project-lite#55 (comment) and taiki-e/pin-project-lite#55 (comment) for more.
r? @RalfJung