about summary refs log tree commit diff
path: root/library/std/src/thread
diff options
context:
space:
mode:
authorAlexis Bourget <alexis.bourget@gmail.com>2020-07-29 21:58:09 +0200
committerAlexis Bourget <alexis.bourget@gmail.com>2020-07-29 21:58:09 +0200
commit82ccdab96cd8c146d9958c1050a2d2669dd367e8 (patch)
treedf6ce4ac3cd6c354da7b346200dfd6946c8e276d /library/std/src/thread
parent2c28244cf0fc9868f55070e55b8f332d196eaf3f (diff)
downloadrust-82ccdab96cd8c146d9958c1050a2d2669dd367e8.tar.gz
rust-82ccdab96cd8c146d9958c1050a2d2669dd367e8.zip
Disallow missing unsafe blocks in unsafe fn in panicking.rs
This adds SAFETY comments where necessary, explaining the preconditions
and how they are respected.
Diffstat (limited to 'library/std/src/thread')
-rw-r--r--library/std/src/thread/local.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/library/std/src/thread/local.rs b/library/std/src/thread/local.rs
index ecd6fbc6b93..66508f06b28 100644
--- a/library/std/src/thread/local.rs
+++ b/library/std/src/thread/local.rs
@@ -172,7 +172,11 @@ macro_rules! __thread_local_inner {
                 static __KEY: $crate::thread::__OsLocalKeyInner<$t> =
                     $crate::thread::__OsLocalKeyInner::new();
 
-                __KEY.get(__init)
+                // 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 { __KEY.get(__init) }
             }
 
             unsafe {