Skip to content

Commit

Permalink
Rollup merge of rust-lang#127996 - ian-h-chamberlain:fix/horizon-warn…
Browse files Browse the repository at this point in the history
…ings-unsafe-in-unsafe, r=tgross35

Clean up warnings + `unsafe_op_in_unsafe_fn` when building std for armv6k-nintendo-3ds

See rust-lang#127747

ping `@AzureMarker` `@Meziu`

I could only find one instance needing an extra `unsafe` that was not also shared with many other `unix` targets (presumably these will get covered in larger sweeping changes, I didn't want to introduce churn that would potentially conflict with those). The one codepath I found is shared with `vita` however, so also pinging `@nikarh` `@pheki` `@zetanumbers` just to make sure they're aware of this change.

Also removed one unused import from `process_unsupported` which should simply fix the warning for any target that uses it.
  • Loading branch information
jieyouxu authored Jul 22, 2024
2 parents ae6187f + 0727e53 commit 323e962
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions std/src/os/horizon/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//! Definitions for Horizon OS
#![forbid(unsafe_op_in_unsafe_fn)]
#![stable(feature = "raw_ext", since = "1.1.0")]

pub mod fs;
Expand Down
1 change: 1 addition & 0 deletions std/src/os/horizon/raw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ pub type time_t = libc::time_t;
#[repr(C)]
#[derive(Clone)]
#[stable(feature = "raw_ext", since = "1.1.0")]
#[allow(dead_code)] // This exists for parity with other `raw` modules, but isn't actually used.
pub struct stat {
#[stable(feature = "raw_ext", since = "1.1.0")]
pub st_dev: dev_t,
Expand Down
2 changes: 1 addition & 1 deletion std/src/sys/pal/unix/alloc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ cfg_if::cfg_if! {
))] {
#[inline]
unsafe fn aligned_malloc(layout: &Layout) -> *mut u8 {
libc::memalign(layout.align(), layout.size()) as *mut u8
unsafe { libc::memalign(layout.align(), layout.size()) as *mut u8 }
}
} else {
#[inline]
Expand Down
1 change: 0 additions & 1 deletion std/src/sys/pal/unix/process/process_unsupported.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use crate::fmt;
use crate::io;
use crate::num::NonZero;
use crate::sys::pal::unix::unsupported::*;
Expand Down

0 comments on commit 323e962

Please sign in to comment.