-
Notifications
You must be signed in to change notification settings - Fork 13.4k
#[no_mangle] in thread_local! requires unsafe wrapping in edition 2021 #142182
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
Comments
this seems to be a similar class of bug as to what we fixed via #138717 because the spans get their edition based on the crate the macro is defined in, and for a more recent rustc, std is Edition 2024 |
I don't think |
...that is an interesting question, yeah. |
@elftausend I'm slightly confused about which edition that snippet used to compile for you (IIUC your report). Does it compile with |
It not compiling with older edition but new Rust release is the bug. The playground only has the newest stable Rust, but you can compare 1.87 vs 1.86 on godbolt. |
thanks @hanna-kruppe. Yes, as probably expected this started in #138162 when the standard library moved to Edition 2024 |
As for why this is happening, this is mostly an unfortunate result of needing to use My expectation would be that the name of the attribute should be the span that it checks for the edition. I think that could be implemented by calling |
Uh oh!
There was an error while loading. Please reload this page.
I tried this code to compile in Edition 2021:
However, compilation fails because the attribute must be wrapped in
unsafe(...)
.This breaks existing libraries like litequad, even though it wasn't upgraded to edition 2024.
Meta
https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=a63572490a930b126b003b57c58c9df0
The text was updated successfully, but these errors were encountered: