-
Notifications
You must be signed in to change notification settings - Fork 13.8k
Open
Labels
A-attributesArea: Attributes (`#[…]`, `#![…]`)Area: Attributes (`#[…]`, `#![…]`)A-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-mediumMedium priorityMedium priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler 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:
thread_local! {
#[unsafe(no_mangle)]
static FOO: () = const { () };
}
I expected to see this happen:
error: const items should never be `#[no_mangle]`
(The macro expands to a const
item that has the #[unsafe(no_mangle)]
applied to it.)
Instead, this happened:
It compiled successfully. The attribute is ignored
Meta
rustc --version --verbose
:
rustc 1.91.0-nightly (02c7b1a7a 2025-09-13)
binary: rustc
commit-hash: 02c7b1a7ac1d739663878030510508372e46f254
commit-date: 2025-09-13
host: x86_64-unknown-linux-gnu
release: 1.91.0-nightly
LLVM version: 21.1.1
@rustbot label A-attributes A-macros T-compiler
Edit: see #146557 (comment) for root cause
Metadata
Metadata
Assignees
Labels
A-attributesArea: Attributes (`#[…]`, `#![…]`)Area: Attributes (`#[…]`, `#![…]`)A-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-mediumMedium priorityMedium priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler 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.