Skip to content

Commit 1821920

Browse files
committed
Auto merge of #111362 - mj10021:issue-74838-update, r=cuviper
delete [allow(unused_unsafe)] from issue #74838 While looking into issue #111288 I noticed the following `#[allow(...)]` with a `FIXME` asking for it to be removed. Deleting the `#[allow(...)]` does not seem to break anything, it seems like the lint has been updated for unsafe blocks in macros?
2 parents 31395ec + db4a153 commit 1821920

File tree

9 files changed

+3
-22
lines changed

9 files changed

+3
-22
lines changed

library/alloc/src/alloc.rs

-1
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,6 @@ pub mod __alloc_error_handler {
392392
static __rust_alloc_error_handler_should_panic: u8;
393393
}
394394

395-
#[allow(unused_unsafe)]
396395
if unsafe { __rust_alloc_error_handler_should_panic != 0 } {
397396
panic!("memory allocation of {size} bytes failed")
398397
} else {

library/core/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ pub mod arch;
418418
// set up in such a way that directly pulling it here works such that the
419419
// crate uses this crate as its core.
420420
#[path = "../../portable-simd/crates/core_simd/src/mod.rs"]
421-
#[allow(missing_debug_implementations, dead_code, unsafe_op_in_unsafe_fn, unused_unsafe)]
421+
#[allow(missing_debug_implementations, dead_code, unsafe_op_in_unsafe_fn)]
422422
#[allow(rustdoc::bare_urls)]
423423
#[unstable(feature = "portable_simd", issue = "86656")]
424424
mod core_simd;

library/std/src/alloc.rs

-1
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,6 @@ fn default_alloc_error_hook(layout: Layout) {
336336
static __rust_alloc_error_handler_should_panic: u8;
337337
}
338338

339-
#[allow(unused_unsafe)]
340339
if unsafe { __rust_alloc_error_handler_should_panic != 0 } {
341340
panic!("memory allocation of {} bytes failed", layout.size());
342341
} else {

library/std/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,7 @@ pub mod time;
542542
// Pull in `std_float` crate into std. The contents of
543543
// `std_float` are in a different repository: rust-lang/portable-simd.
544544
#[path = "../../portable-simd/crates/std_float/src/lib.rs"]
545-
#[allow(missing_debug_implementations, dead_code, unsafe_op_in_unsafe_fn, unused_unsafe)]
545+
#[allow(missing_debug_implementations, dead_code, unsafe_op_in_unsafe_fn)]
546546
#[allow(rustdoc::bare_urls)]
547547
#[unstable(feature = "portable_simd", issue = "86656")]
548548
mod std_float;

library/std/src/sys/common/thread_local/fast_local.rs

-4
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,6 @@ pub macro thread_local_inner {
8787
static __KEY: $crate::thread::local_impl::Key<$t> =
8888
$crate::thread::local_impl::Key::<$t>::new();
8989

90-
// FIXME: remove the #[allow(...)] marker when macros don't
91-
// raise warning for missing/extraneous unsafe blocks anymore.
92-
// See https://github.com/rust-lang/rust/issues/74838.
93-
#[allow(unused_unsafe)]
9490
unsafe {
9591
__KEY.get(move || {
9692
if let $crate::option::Option::Some(init) = init {

library/std/src/sys/common/thread_local/os_local.rs

-5
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ pub macro thread_local_inner {
2424
const fn __init() -> $t { INIT_EXPR }
2525
static __KEY: $crate::thread::local_impl::Key<$t> =
2626
$crate::thread::local_impl::Key::new();
27-
#[allow(unused_unsafe)]
2827
unsafe {
2928
__KEY.get(move || {
3029
if let $crate::option::Option::Some(init) = _init {
@@ -59,10 +58,6 @@ pub macro thread_local_inner {
5958
static __KEY: $crate::thread::local_impl::Key<$t> =
6059
$crate::thread::local_impl::Key::new();
6160

62-
// FIXME: remove the #[allow(...)] marker when macros don't
63-
// raise warning for missing/extraneous unsafe blocks anymore.
64-
// See https://github.com/rust-lang/rust/issues/74838.
65-
#[allow(unused_unsafe)]
6661
unsafe {
6762
__KEY.get(move || {
6863
if let $crate::option::Option::Some(init) = init {

library/std/src/sys/common/thread_local/static_local.rs

-4
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,6 @@ pub macro thread_local_inner {
4343
static __KEY: $crate::thread::local_impl::Key<$t> =
4444
$crate::thread::local_impl::Key::new();
4545

46-
// FIXME: remove the #[allow(...)] marker when macros don't
47-
// raise warning for missing/extraneous unsafe blocks anymore.
48-
// See https://github.com/rust-lang/rust/issues/74838.
49-
#[allow(unused_unsafe)]
5046
unsafe {
5147
__KEY.get(move || {
5248
if let $crate::option::Option::Some(init) = init {

library/std/src/sys/windows/compat.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,7 @@ unsafe extern "C" fn init() {
6969

7070
/// Helper macro for creating CStrs from literals and symbol names.
7171
macro_rules! ansi_str {
72-
(sym $ident:ident) => {{
73-
#[allow(unused_unsafe)]
74-
crate::sys::compat::const_cstr_from_bytes(concat!(stringify!($ident), "\0").as_bytes())
75-
}};
72+
(sym $ident:ident) => {{ crate::sys::compat::const_cstr_from_bytes(concat!(stringify!($ident), "\0").as_bytes()) }};
7673
($lit:literal) => {{ crate::sys::compat::const_cstr_from_bytes(concat!($lit, "\0").as_bytes()) }};
7774
}
7875

library/std/src/sys_common/thread_info.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#![allow(dead_code)] // stack_guard isn't used right now on all platforms
2-
#![allow(unused_unsafe)] // thread_local with `const {}` triggers this liny
32

43
use crate::cell::RefCell;
54
use crate::sys::thread::guard::Guard;

0 commit comments

Comments
 (0)