I tried this code to compile in Edition 2021:
#[no_mangle] // fine
static TEST_OUTSIDE: usize = 0;
thread_local! {
#[no_mangle] // unsafe attribute used without unsafe wrap error
static TEST: usize = 0;
}
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
[package]
name = "no_mangle_test"
version = "0.1.0"
edition = "2021"
https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=a63572490a930b126b003b57c58c9df0
error: unsafe attribute used without unsafe
--> src/main.rs:6:7
|
6 | #[no_mangle]
| ^^^^^^^^^ usage of unsafe attribute
|
help: wrap the attribute in `unsafe(...)`
|
6 | #[unsafe(no_mangle)]
| +++++++ +
error: could not compile `no_mangle_test` (bin "no_mangle_test") due to 1 previous error
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