about summary refs log tree commit diff
path: root/library/std/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2025-08-30 01:06:25 +0000
committerbors <bors@rust-lang.org>2025-08-30 01:06:25 +0000
commite004014d1bf4c29928a0f0f9f7d0964d43606cbd (patch)
tree8759742b5dfec3d72f7ddf5c17c4b672de424719 /library/std/src
parentfe55364329579d361b1ab565728bc033a7dba07e (diff)
parent319d5547da1e67a38be20013ce6c09372e877a64 (diff)
downloadrust-e004014d1bf4c29928a0f0f9f7d0964d43606cbd.tar.gz
rust-e004014d1bf4c29928a0f0f9f7d0964d43606cbd.zip
Auto merge of #146023 - tgross35:rollup-gbec538, r=tgross35
Rollup of 9 pull requests

Successful merges:

 - rust-lang/rust#145242 (std: use a TAIT to define `SplitPaths` on UNIX)
 - rust-lang/rust#145467 (Stabilize `strict_provenance_atomic_ptr` feature)
 - rust-lang/rust#145756 (str: Stabilize `round_char_boundary` feature)
 - rust-lang/rust#145967 (compiler: Include span of too huge enum with `-Cdebuginfo=2`)
 - rust-lang/rust#145990 (`AutoDeref::final_ty` is already resolved)
 - rust-lang/rust#145991 (std: haiku: fix `B_FIND_PATH_IMAGE_PATH`)
 - rust-lang/rust#146000 (Improve librustdoc error when a file creation/modification failed)
 - rust-lang/rust#146017 (Mark pipe2 supported in Android)
 - rust-lang/rust#146022 (compiler-builtins subtree update)

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'library/std/src')
-rw-r--r--library/std/src/lib.rs2
-rw-r--r--library/std/src/sys/pal/unix/os.rs38
-rw-r--r--library/std/src/sys/pal/unix/pipe.rs1
3 files changed, 9 insertions, 32 deletions
diff --git a/library/std/src/lib.rs b/library/std/src/lib.rs
index 30a1b108817..3771699c59f 100644
--- a/library/std/src/lib.rs
+++ b/library/std/src/lib.rs
@@ -263,7 +263,6 @@
     all(target_vendor = "fortanix", target_env = "sgx"),
     feature(slice_index_methods, coerce_unsized, sgx_platform)
 )]
-#![cfg_attr(any(windows, target_os = "uefi"), feature(round_char_boundary))]
 #![cfg_attr(target_family = "wasm", feature(stdarch_wasm_atomic_wait))]
 #![cfg_attr(target_arch = "wasm64", feature(simd_wasm64))]
 //
@@ -371,7 +370,6 @@
 #![feature(slice_range)]
 #![feature(std_internals)]
 #![feature(str_internals)]
-#![feature(strict_provenance_atomic_ptr)]
 #![feature(sync_unsafe_cell)]
 #![feature(temporary_niche_types)]
 #![feature(ub_checks)]
diff --git a/library/std/src/sys/pal/unix/os.rs b/library/std/src/sys/pal/unix/os.rs
index 81275afa707..aec089f7e5c 100644
--- a/library/std/src/sys/pal/unix/os.rs
+++ b/library/std/src/sys/pal/unix/os.rs
@@ -16,10 +16,7 @@ use crate::{fmt, io, iter, mem, ptr, slice, str};
 
 const TMPBUF_SZ: usize = 128;
 
-const PATH_SEPARATOR: u8 = cfg_select! {
-    target_os = "redox" => b';',
-    _ => b':',
-};
+const PATH_SEPARATOR: u8 = if cfg!(target_os = "redox") { b';' } else { b':' };
 
 unsafe extern "C" {
     #[cfg(not(any(target_os = "dragonfly", target_os = "vxworks", target_os = "rtems")))]
@@ -189,33 +186,14 @@ pub fn chdir(p: &path::Path) -> io::Result<()> {
     if result == 0 { Ok(()) } else { Err(io::Error::last_os_error()) }
 }
 
-pub struct SplitPaths<'a> {
-    iter: iter::Map<slice::Split<'a, u8, fn(&u8) -> bool>, fn(&'a [u8]) -> PathBuf>,
-}
+pub type SplitPaths<'a> = impl Iterator<Item = PathBuf>;
 
+#[define_opaque(SplitPaths)]
 pub fn split_paths(unparsed: &OsStr) -> SplitPaths<'_> {
-    fn bytes_to_path(b: &[u8]) -> PathBuf {
-        PathBuf::from(<OsStr as OsStrExt>::from_bytes(b))
-    }
-    fn is_separator(b: &u8) -> bool {
-        *b == PATH_SEPARATOR
-    }
-    let unparsed = unparsed.as_bytes();
-    SplitPaths {
-        iter: unparsed
-            .split(is_separator as fn(&u8) -> bool)
-            .map(bytes_to_path as fn(&[u8]) -> PathBuf),
-    }
-}
-
-impl<'a> Iterator for SplitPaths<'a> {
-    type Item = PathBuf;
-    fn next(&mut self) -> Option<PathBuf> {
-        self.iter.next()
-    }
-    fn size_hint(&self) -> (usize, Option<usize>) {
-        self.iter.size_hint()
-    }
+    unparsed
+        .as_bytes()
+        .split(|&b| b == PATH_SEPARATOR)
+        .map(|part| PathBuf::from(OsStr::from_bytes(part)))
 }
 
 #[derive(Debug)]
@@ -469,7 +447,7 @@ pub fn current_exe() -> io::Result<PathBuf> {
     unsafe {
         let result = libc::find_path(
             crate::ptr::null_mut(),
-            libc::path_base_directory::B_FIND_PATH_IMAGE_PATH,
+            libc::B_FIND_PATH_IMAGE_PATH,
             crate::ptr::null_mut(),
             name.as_mut_ptr(),
             name.len(),
diff --git a/library/std/src/sys/pal/unix/pipe.rs b/library/std/src/sys/pal/unix/pipe.rs
index 6b0cd14da4f..4798acf9dad 100644
--- a/library/std/src/sys/pal/unix/pipe.rs
+++ b/library/std/src/sys/pal/unix/pipe.rs
@@ -20,6 +20,7 @@ pub fn anon_pipe() -> io::Result<(AnonPipe, AnonPipe)> {
     // and musl 0.9.3, and some other targets also have it.
     cfg_select! {
         any(
+            target_os = "android",
             target_os = "dragonfly",
             target_os = "freebsd",
             target_os = "hurd",