Add #[deny(unsafe_op_in_unsafe_fn)] to thread_local!(const).

This avoids 'unused unsafe' warnings when using this feature inside std.
This commit is contained in:
Mara Bos 2022-04-06 22:22:43 +02:00
parent 83e8b9e4dd
commit 5b2591299a

View File

@ -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> {