Skip to content

Commit

Permalink
Add #[deny(unsafe_op_in_unsafe_fn)] to thread_local!(const).
Browse files Browse the repository at this point in the history
This avoids 'unused unsafe' warnings when using this feature inside std.
  • Loading branch information
m-ou-se committed Apr 7, 2022
1 parent aeb01c3 commit 0664b8a
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions library/std/src/thread/local.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ macro_rules! __thread_local_inner {
// used to generate the `LocalKey` value for const-initialized thread locals
(@key $t:ty, const $init:expr) => {{
#[cfg_attr(not(windows), inline(always))] // see comments below
#[deny(unsafe_op_in_unsafe_fn)]
unsafe fn __getit(
_init: $crate::option::Option<&mut $crate::option::Option<$t>>,
) -> $crate::option::Option<&'static $t> {
Expand Down

0 comments on commit 0664b8a

Please sign in to comment.