-
Notifications
You must be signed in to change notification settings - Fork 13.8k
Open
Labels
A-const-genericsArea: const generics (parameters and arguments)Area: const generics (parameters and arguments)A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)A-thread-localsArea: Thread local storage (TLS)Area: Thread local storage (TLS)C-bugCategory: This is a bug.Category: This is a bug.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.
Description
I tried this (admittedly cursed) code:
thread_local! {
pub static FOO: [(); {
#[unsafe(no_mangle)]
fn dont_duplicate_me() {}
0
}] = [];
}
I expected to see this happen: It compiles, just like the non-thread_local!
version would
Instead, this happened:
error: symbol `dont_duplicate_me` is already defined
--> src/lib.rs:4:9
|
4 | fn dont_duplicate_me() {}
| ^^^^^^^^^^^^^^^^^^^^^^
Meta
rustc --version
:
1.92.0-nightly (2025-09-26 54a8a1db604e4caff93e)
@rustbot label T-libs A-macros A-thread-locals A-const-generics
Metadata
Metadata
Assignees
Labels
A-const-genericsArea: const generics (parameters and arguments)Area: const generics (parameters and arguments)A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)A-thread-localsArea: Thread local storage (TLS)Area: Thread local storage (TLS)C-bugCategory: This is a bug.Category: This is a bug.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.