-
Notifications
You must be signed in to change notification settings - Fork 1.7k
no_mangle attribute requires unsafe in Rust 2024 #13631
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Conversation
eac1563
to
8052451
Compare
Should the lint documentation also show |
I'm trying to find the reasoning for this change but I'm not being able to find, could someone link a PR or changelog? |
There is an RFC on that: rust-lang/rfcs#3325 |
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'm not sure if we should change the messages. It feels a bit extraneous even if it's correct; they often have placeholders and the sort, they're not supposed to be code. The user would already know it's an unsafe attribute, it feels a bit like saying unsafe { *null() }
. In this case, there is no way to have the unsafe implied in an earlier scope, so it is a slightly different situation, but I think it still applies.
I suppose we wouldn't say "on an extern "Rust"
function". Something like "unsafe attribute no_mangle
set on ..." would be more consistent but that doesn't exactly feel right. Thoughts?
Ok, I'll let it as-is. If we have complaints later, we can always change it in the documentation. |
@Centri3 Anything you would like me to change? Did I misunderstand your comment? |
I did mean in the error messages, but with further thinking this is probably fine imo. @bors r+ |
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
Tests without unsafe must not run in edition 2024. Also, error messages have been modified to include the full attribute, so that a use of
#[unsafe(no_mangle)]
does not produce an error message containing#[no_mangle]
.changelog: [
no_mangle_attribute
]: handle#[unsafe(no_mangle)]
as well