-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Closed
Labels
A-attributesArea: Attributes (`#[…]`, `#![…]`)Area: Attributes (`#[…]`, `#![…]`)A-edition-2024Area: The 2024 editionArea: The 2024 editionA-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)C-bugCategory: This is a bug.Category: This is a bug.P-highHigh priorityHigh priorityT-editionRelevant to the edition team.Relevant to the edition team.T-libsRelevant to the library team, which will review and decide on the PR/issue.Relevant to the library team, which will review and decide on the PR/issue.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.Performance or correctness regression from one stable version to another.
Description
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"
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
Metadata
Metadata
Assignees
Labels
A-attributesArea: Attributes (`#[…]`, `#![…]`)Area: Attributes (`#[…]`, `#![…]`)A-edition-2024Area: The 2024 editionArea: The 2024 editionA-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)C-bugCategory: This is a bug.Category: This is a bug.P-highHigh priorityHigh priorityT-editionRelevant to the edition team.Relevant to the edition team.T-libsRelevant to the library team, which will review and decide on the PR/issue.Relevant to the library team, which will review and decide on the PR/issue.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.Performance or correctness regression from one stable version to another.