summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--library/std/src/thread/local.rs14
1 files changed, 12 insertions, 2 deletions
diff --git a/library/std/src/thread/local.rs b/library/std/src/thread/local.rs
index 1d2f6e97680..cfc49b697e4 100644
--- a/library/std/src/thread/local.rs
+++ b/library/std/src/thread/local.rs
@@ -189,7 +189,11 @@ macro_rules! __thread_local_inner {
#[cfg(all(target_family = "wasm", not(target_feature = "atomics")))]
{
static mut VAL: $t = INIT_EXPR;
- Some(&VAL)
+ // FIXME: remove the #[allow(...)] marker when macros don't
+ // raise warning for missing/extraneous unsafe blocks anymore.
+ // See https://github.com/rust-lang/rust/issues/74838.
+ #[allow(unused_unsafe)]
+ unsafe { Some(&VAL) }
}
// If the platform has support for `#[thread_local]`, use it.
@@ -205,7 +209,13 @@ macro_rules! __thread_local_inner {
// just get going.
if !$crate::mem::needs_drop::<$t>() {
unsafe {
- return Some(&VAL)
+ // FIXME: remove the #[allow(...)] marker when macros don't
+ // raise warning for missing/extraneous unsafe blocks anymore.
+ // See https://github.com/rust-lang/rust/issues/74838.
+ #[allow(unused_unsafe)]
+ unsafe {
+ return Some(&VAL);
+ }
}
}