Skip to content

Commit

Permalink
Auto merge of #111362 - mj10021:issue-74838-update, r=cuviper
Browse files Browse the repository at this point in the history
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?
  • Loading branch information
bors committed Jul 24, 2023
2 parents 5be6c19 + 53ada77 commit 7a93f48
Show file tree
Hide file tree
Showing 9 changed files with 3 additions and 22 deletions.
1 change: 0 additions & 1 deletion alloc/src/alloc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,6 @@ pub mod __alloc_error_handler {
static __rust_alloc_error_handler_should_panic: u8;
}

#[allow(unused_unsafe)]
if unsafe { __rust_alloc_error_handler_should_panic != 0 } {
panic!("memory allocation of {size} bytes failed")
} else {
Expand Down
2 changes: 1 addition & 1 deletion core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ pub mod arch;
// set up in such a way that directly pulling it here works such that the
// crate uses this crate as its core.
#[path = "../../portable-simd/crates/core_simd/src/mod.rs"]
#[allow(missing_debug_implementations, dead_code, unsafe_op_in_unsafe_fn, unused_unsafe)]
#[allow(missing_debug_implementations, dead_code, unsafe_op_in_unsafe_fn)]
#[allow(rustdoc::bare_urls)]
#[unstable(feature = "portable_simd", issue = "86656")]
mod core_simd;
Expand Down
1 change: 0 additions & 1 deletion std/src/alloc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,6 @@ fn default_alloc_error_hook(layout: Layout) {
static __rust_alloc_error_handler_should_panic: u8;
}

#[allow(unused_unsafe)]
if unsafe { __rust_alloc_error_handler_should_panic != 0 } {
panic!("memory allocation of {} bytes failed", layout.size());
} else {
Expand Down
2 changes: 1 addition & 1 deletion std/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,7 @@ pub mod time;
// Pull in `std_float` crate into std. The contents of
// `std_float` are in a different repository: rust-lang/portable-simd.
#[path = "../../portable-simd/crates/std_float/src/lib.rs"]
#[allow(missing_debug_implementations, dead_code, unsafe_op_in_unsafe_fn, unused_unsafe)]
#[allow(missing_debug_implementations, dead_code, unsafe_op_in_unsafe_fn)]
#[allow(rustdoc::bare_urls)]
#[unstable(feature = "portable_simd", issue = "86656")]
mod std_float;
Expand Down
4 changes: 0 additions & 4 deletions std/src/sys/common/thread_local/fast_local.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,6 @@ pub macro thread_local_inner {
static __KEY: $crate::thread::local_impl::Key<$t> =
$crate::thread::local_impl::Key::<$t>::new();

// 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(move || {
if let $crate::option::Option::Some(init) = init {
Expand Down
5 changes: 0 additions & 5 deletions std/src/sys/common/thread_local/os_local.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ pub macro thread_local_inner {
const fn __init() -> $t { INIT_EXPR }
static __KEY: $crate::thread::local_impl::Key<$t> =
$crate::thread::local_impl::Key::new();
#[allow(unused_unsafe)]
unsafe {
__KEY.get(move || {
if let $crate::option::Option::Some(init) = _init {
Expand Down Expand Up @@ -59,10 +58,6 @@ pub macro thread_local_inner {
static __KEY: $crate::thread::local_impl::Key<$t> =
$crate::thread::local_impl::Key::new();

// 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(move || {
if let $crate::option::Option::Some(init) = init {
Expand Down
4 changes: 0 additions & 4 deletions std/src/sys/common/thread_local/static_local.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,6 @@ pub macro thread_local_inner {
static __KEY: $crate::thread::local_impl::Key<$t> =
$crate::thread::local_impl::Key::new();

// 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(move || {
if let $crate::option::Option::Some(init) = init {
Expand Down
5 changes: 1 addition & 4 deletions std/src/sys/windows/compat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,7 @@ unsafe extern "C" fn init() {

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

Expand Down
1 change: 0 additions & 1 deletion std/src/sys_common/thread_info.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#![allow(dead_code)] // stack_guard isn't used right now on all platforms
#![allow(unused_unsafe)] // thread_local with `const {}` triggers this liny

use crate::cell::RefCell;
use crate::sys::thread::guard::Guard;
Expand Down

0 comments on commit 7a93f48

Please sign in to comment.