Skip to content

Commit 75bf5ce

Browse files
github-actions[bot]matthiaskrgrfrank-kingm-ou-sedanielhenrymantilla
authored
Merge subtree update for toolchain nightly-2025-04-23 (#340)
This is an automated PR to merge library subtree updates from 2025-04-21 (rust-lang/rust@b8c54d6) to 2025-04-23 (rust-lang/rust@6bc57c6), inclusive. This is a clean merge, no conflicts were detected. **Do not remove or edit the following annotations:** git-subtree-dir: library git-subtree-split: 54a7b4f --------- Signed-off-by: xizheyin <[email protected]> Signed-off-by: Petros Angelatos <[email protected]> Signed-off-by: Huang Qi <[email protected]> Signed-off-by: Ayush Singh <[email protected]> Signed-off-by: Alice Ryhl <[email protected]> Co-authored-by: Matthias Krüger <[email protected]> Co-authored-by: Frank King <[email protected]> Co-authored-by: Mara Bos <[email protected]> Co-authored-by: Daniel Henry-Mantilla <[email protected]> Co-authored-by: Scott McMurray <[email protected]> Co-authored-by: joboet <[email protected]> Co-authored-by: Chris Denton <[email protected]> Co-authored-by: bors <[email protected]> Co-authored-by: mejrs <[email protected]> Co-authored-by: okaneco <[email protected]> Co-authored-by: Jacob Pratt <[email protected]> Co-authored-by: xizheyin <[email protected]> Co-authored-by: Benoît du Garreau <[email protected]> Co-authored-by: clubby789 <[email protected]> Co-authored-by: Takayuki Maeda <[email protected]> Co-authored-by: Daniel Bloom <[email protected]> Co-authored-by: Trevor Gross <[email protected]> Co-authored-by: Jake Wharton <[email protected]> Co-authored-by: bjorn3 <[email protected]> Co-authored-by: Ralf Jung <[email protected]> Co-authored-by: Guillaume Gomez <[email protected]> Co-authored-by: Kornel <[email protected]> Co-authored-by: Calder Coalson <[email protected]> Co-authored-by: Stuart Cook <[email protected]> Co-authored-by: Thalia Archibald <[email protected]> Co-authored-by: github-actions <[email protected]> Co-authored-by: izarma <[email protected]> Co-authored-by: Bennet Bleßmann <[email protected]> Co-authored-by: Celina G. Val <[email protected]> Co-authored-by: Jonathan Gruner <[email protected]> Co-authored-by: Stan Manilov <[email protected]> Co-authored-by: Gabriel Bjørnager Jensen <[email protected]> Co-authored-by: lincot <[email protected]> Co-authored-by: timesince <[email protected]> Co-authored-by: Boxy <[email protected]> Co-authored-by: oyvindln <[email protected]> Co-authored-by: Alice Ryhl <[email protected]> Co-authored-by: Folkert de Vries <[email protected]> Co-authored-by: Bastian Kersting <[email protected]> Co-authored-by: Petros Angelatos <[email protected]> Co-authored-by: Jesus Checa Hidalgo <[email protected]> Co-authored-by: Michael Howell <[email protected]> Co-authored-by: Ricardo Fernández Serrata <[email protected]> Co-authored-by: GenYuLi <[email protected]> Co-authored-by: Chris Denton <[email protected]> Co-authored-by: Amanieu d'Antras <[email protected]> Co-authored-by: Sky <[email protected]> Co-authored-by: Huang Qi <[email protected]> Co-authored-by: Ayush Singh <[email protected]> Co-authored-by: Jethro Beekman <[email protected]> Co-authored-by: 0x79de <[email protected]> Co-authored-by: binarycat <[email protected]> Co-authored-by: Glyn Normington <[email protected]> Co-authored-by: Tamir Duberstein <[email protected]> Co-authored-by: Josh Triplett <[email protected]> Co-authored-by: Bastian Kersting <[email protected]> Co-authored-by: Lyndon Brown <[email protected]> Co-authored-by: Kent Ross <[email protected]> Co-authored-by: Noa <[email protected]> Co-authored-by: Lieselotte <[email protected]> Co-authored-by: Patrick Mooney <[email protected]> Co-authored-by: Onè <[email protected]> Co-authored-by: 王宇逸 <[email protected]> Co-authored-by: gitbot <git@bot>
1 parent 5cf80a8 commit 75bf5ce

File tree

25 files changed

+57
-77
lines changed

25 files changed

+57
-77
lines changed

library/Cargo.lock

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

library/alloc/src/ffi/c_str.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -574,7 +574,7 @@ impl CString {
574574
#[stable(feature = "as_c_str", since = "1.20.0")]
575575
#[rustc_diagnostic_item = "cstring_as_c_str"]
576576
pub fn as_c_str(&self) -> &CStr {
577-
&*self
577+
unsafe { CStr::from_bytes_with_nul_unchecked(self.as_bytes_with_nul()) }
578578
}
579579

580580
/// Converts this `CString` into a boxed [`CStr`].
@@ -705,14 +705,14 @@ impl ops::Deref for CString {
705705

706706
#[inline]
707707
fn deref(&self) -> &CStr {
708-
unsafe { CStr::from_bytes_with_nul_unchecked(self.as_bytes_with_nul()) }
708+
self.as_c_str()
709709
}
710710
}
711711

712712
#[stable(feature = "rust1", since = "1.0.0")]
713713
impl fmt::Debug for CString {
714714
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
715-
fmt::Debug::fmt(&**self, f)
715+
fmt::Debug::fmt(self.as_c_str(), f)
716716
}
717717
}
718718

library/alloctests/tests/c_str2.rs

-6
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,6 @@ fn build_with_zero2() {
3333
assert!(CString::new(vec![0]).is_err());
3434
}
3535

36-
#[test]
37-
fn formatted() {
38-
let s = CString::new(&b"abc\x01\x02\n\xE2\x80\xA6\xFF"[..]).unwrap();
39-
assert_eq!(format!("{s:?}"), r#""abc\x01\x02\n\xe2\x80\xa6\xff""#);
40-
}
41-
4236
#[test]
4337
fn borrowed() {
4438
unsafe {

library/core/src/any.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -772,8 +772,8 @@ impl hash::Hash for TypeId {
772772
// (especially given the previous point about the lower 64 bits being
773773
// high quality on their own).
774774
// - It is correct to do so -- only hashing a subset of `self` is still
775-
// with an `Eq` implementation that considers the entire value, as
776-
// ours does.
775+
// compatible with an `Eq` implementation that considers the entire
776+
// value, as ours does.
777777
self.t.1.hash(state);
778778
}
779779
}

library/core/src/arch.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ pub macro asm("assembly template", $(operands,)* $(options($(option),*))?) {
3232
///
3333
/// [Rust By Example]: https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html
3434
/// [reference]: https://doc.rust-lang.org/nightly/reference/inline-assembly.html
35-
#[unstable(feature = "naked_functions", issue = "90957")]
35+
#[stable(feature = "naked_functions", since = "CURRENT_RUSTC_VERSION")]
3636
#[rustc_builtin_macro]
3737
pub macro naked_asm("assembly template", $(operands,)* $(options($(option),*))?) {
3838
/* compiler built-in */

library/core/src/bstr/mod.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ use crate::ops::{Deref, DerefMut, DerefPure};
3636
/// presented as hex escape sequences.
3737
///
3838
/// The `Display` implementation behaves as if the `ByteStr` were first lossily converted to a
39-
/// `str`, with invalid UTF-8 presented as the Unicode replacement character: �
40-
///
39+
/// `str`, with invalid UTF-8 presented as the Unicode replacement character (�).
4140
#[unstable(feature = "bstr", issue = "134915")]
4241
#[repr(transparent)]
4342
#[doc(alias = "BStr")]

library/core/src/ffi/c_str.rs

-1
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,6 @@ impl Error for FromBytesWithNulError {
157157
/// within the slice.
158158
///
159159
/// This error is created by the [`CStr::from_bytes_until_nul`] method.
160-
///
161160
#[derive(Clone, PartialEq, Eq, Debug)]
162161
#[stable(feature = "cstr_from_bytes_until_nul", since = "1.69.0")]
163162
pub struct FromBytesUntilNulError(());

library/core/src/intrinsics/simd.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ pub unsafe fn simd_shuffle<T, U, V>(x: T, y: T, idx: U) -> V;
304304
///
305305
/// `U` must be a vector of pointers to the element type of `T`, with the same length as `T`.
306306
///
307-
/// `V` must be a vector of signed integers with the same length as `T` (but any element size).
307+
/// `V` must be a vector of integers with the same length as `T` (but any element size).
308308
///
309309
/// For each pointer in `ptr`, if the corresponding value in `mask` is `!0`, read the pointer.
310310
/// Otherwise if the corresponding value in `mask` is `0`, return the corresponding value from
@@ -325,7 +325,7 @@ pub unsafe fn simd_gather<T, U, V>(val: T, ptr: U, mask: V) -> T;
325325
///
326326
/// `U` must be a vector of pointers to the element type of `T`, with the same length as `T`.
327327
///
328-
/// `V` must be a vector of signed integers with the same length as `T` (but any element size).
328+
/// `V` must be a vector of integers with the same length as `T` (but any element size).
329329
///
330330
/// For each pointer in `ptr`, if the corresponding value in `mask` is `!0`, write the
331331
/// corresponding value in `val` to the pointer.
@@ -349,7 +349,7 @@ pub unsafe fn simd_scatter<T, U, V>(val: T, ptr: U, mask: V);
349349
///
350350
/// `U` must be a pointer to the element type of `T`
351351
///
352-
/// `V` must be a vector of signed integers with the same length as `T` (but any element size).
352+
/// `V` must be a vector of integers with the same length as `T` (but any element size).
353353
///
354354
/// For each element, if the corresponding value in `mask` is `!0`, read the corresponding
355355
/// pointer offset from `ptr`.
@@ -372,7 +372,7 @@ pub unsafe fn simd_masked_load<V, U, T>(mask: V, ptr: U, val: T) -> T;
372372
///
373373
/// `U` must be a pointer to the element type of `T`
374374
///
375-
/// `V` must be a vector of signed integers with the same length as `T` (but any element size).
375+
/// `V` must be a vector of integers with the same length as `T` (but any element size).
376376
///
377377
/// For each element, if the corresponding value in `mask` is `!0`, write the corresponding
378378
/// value in `val` to the pointer offset from `ptr`.
@@ -556,7 +556,7 @@ pub unsafe fn simd_bitmask<T, U>(x: T) -> U;
556556
///
557557
/// `T` must be a vector.
558558
///
559-
/// `M` must be a signed integer vector with the same length as `T` (but any element size).
559+
/// `M` must be an integer vector with the same length as `T` (but any element size).
560560
///
561561
/// For each element, if the corresponding value in `mask` is `!0`, select the element from
562562
/// `if_true`. If the corresponding value in `mask` is `0`, select the element from

library/core/src/slice/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2814,7 +2814,7 @@ impl<T> [T] {
28142814
let half = size / 2;
28152815
let mid = base + half;
28162816

2817-
// SAFETY: the call is made safe by the following inconstants:
2817+
// SAFETY: the call is made safe by the following invariants:
28182818
// - `mid >= 0`: by definition
28192819
// - `mid < size`: `mid = size / 2 + size / 4 + size / 8 ...`
28202820
let cmp = f(unsafe { self.get_unchecked(mid) });

library/coretests/tests/ffi/cstr.rs

+6
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,9 @@ fn compares_as_u8s() {
1313
assert_eq!(Ord::cmp(a, b), Ord::cmp(a_bytes, b_bytes));
1414
assert_eq!(PartialOrd::partial_cmp(a, b), PartialOrd::partial_cmp(a_bytes, b_bytes));
1515
}
16+
17+
#[test]
18+
fn debug() {
19+
let s = c"abc\x01\x02\n\xE2\x80\xA6\xFF";
20+
assert_eq!(format!("{s:?}"), r#""abc\x01\x02\n\xe2\x80\xa6\xff""#);
21+
}

library/std/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ miniz_oxide = { version = "0.8.0", optional = true, default-features = false }
3636
addr2line = { version = "0.24.0", optional = true, default-features = false }
3737

3838
[target.'cfg(not(all(windows, target_env = "msvc")))'.dependencies]
39-
libc = { version = "0.2.171", default-features = false, features = [
39+
libc = { version = "0.2.172", default-features = false, features = [
4040
'rustc-dep-of-std',
4141
], public = true }
4242

library/std/src/path.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3265,7 +3265,7 @@ impl Hash for Path {
32653265
if !verbatim {
32663266
component_start += match tail {
32673267
[b'.'] => 1,
3268-
[b'.', sep @ _, ..] if is_sep_byte(*sep) => 1,
3268+
[b'.', sep, ..] if is_sep_byte(*sep) => 1,
32693269
_ => 0,
32703270
};
32713271
}

library/std/src/rt.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ macro_rules! rtprintpanic {
4646
macro_rules! rtabort {
4747
($($t:tt)*) => {
4848
{
49-
rtprintpanic!("fatal runtime error: {}\n", format_args!($($t)*));
49+
rtprintpanic!("fatal runtime error: {}, aborting\n", format_args!($($t)*));
5050
crate::sys::abort_internal();
5151
}
5252
}

library/std/src/sys/alloc/sgx.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@ use crate::sys::pal::waitqueue::SpinMutex;
1010
// The current allocator here is the `dlmalloc` crate which we've got included
1111
// in the rust-lang/rust repository as a submodule. The crate is a port of
1212
// dlmalloc.c from C to Rust.
13+
//
14+
// Specifying linkage/symbol name is solely to ensure a single instance between this crate and its unit tests
1315
#[cfg_attr(test, linkage = "available_externally")]
14-
#[unsafe(export_name = "_ZN16__rust_internals3std3sys3sgx5alloc8DLMALLOCE")]
16+
#[unsafe(export_name = "_ZN16__rust_internals3std3sys5alloc3sgx8DLMALLOCE")]
1517
static DLMALLOC: SpinMutex<dlmalloc::Dlmalloc<Sgx>> =
1618
SpinMutex::new(dlmalloc::Dlmalloc::new_with_allocator(Sgx {}));
1719

library/std/src/sys/args/hermit.rs

-35
This file was deleted.

library/std/src/sys/args/mod.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
#![forbid(unsafe_op_in_unsafe_fn)]
44

55
cfg_if::cfg_if! {
6-
if #[cfg(all(target_family = "unix", not(any(target_os = "espidf", target_os = "vita"))))] {
6+
if #[cfg(any(
7+
all(target_family = "unix", not(any(target_os = "espidf", target_os = "vita"))),
8+
target_os = "hermit",
9+
))] {
710
mod unix;
811
pub use unix::*;
912
} else if #[cfg(target_family = "windows")] {
1013
mod windows;
1114
pub use windows::*;
12-
} else if #[cfg(target_os = "hermit")] {
13-
mod hermit;
14-
pub use hermit::*;
1515
} else if #[cfg(all(target_vendor = "fortanix", target_env = "sgx"))] {
1616
mod sgx;
1717
pub use sgx::*;

library/std/src/sys/args/sgx.rs

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ use crate::sys::pal::abi::usercalls::raw::ByteBuffer;
88
use crate::sys_common::FromInner;
99
use crate::{fmt, slice};
1010

11+
// Specifying linkage/symbol name is solely to ensure a single instance between this crate and its unit tests
1112
#[cfg_attr(test, linkage = "available_externally")]
1213
#[unsafe(export_name = "_ZN16__rust_internals3std3sys3sgx4args4ARGSE")]
1314
static ARGS: AtomicUsize = AtomicUsize::new(0);

library/std/src/sys/args/unix.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
#![allow(dead_code)] // runtime init functions not used during testing
77

88
use crate::ffi::CStr;
9+
#[cfg(target_os = "hermit")]
10+
use crate::os::hermit::ffi::OsStringExt;
11+
#[cfg(not(target_os = "hermit"))]
912
use crate::os::unix::ffi::OsStringExt;
1013

1114
#[path = "common.rs"]
@@ -73,6 +76,7 @@ pub fn args() -> Args {
7376
target_os = "illumos",
7477
target_os = "emscripten",
7578
target_os = "haiku",
79+
target_os = "hermit",
7680
target_os = "l4re",
7781
target_os = "fuchsia",
7882
target_os = "redox",
@@ -100,7 +104,7 @@ mod imp {
100104

101105
unsafe fn really_init(argc: isize, argv: *const *const u8) {
102106
// These don't need to be ordered with each other or other stores,
103-
// because they only hold the unmodified system-provide argv/argc.
107+
// because they only hold the unmodified system-provided argv/argc.
104108
ARGC.store(argc, Ordering::Relaxed);
105109
ARGV.store(argv as *mut _, Ordering::Relaxed);
106110
}

library/std/src/sys/pal/sgx/abi/tls/mod.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,17 @@ const USIZE_BITS: usize = 64;
1111
const TLS_KEYS: usize = 128; // Same as POSIX minimum
1212
const TLS_KEYS_BITSET_SIZE: usize = (TLS_KEYS + (USIZE_BITS - 1)) / USIZE_BITS;
1313

14+
// Specifying linkage/symbol name is solely to ensure a single instance between this crate and its unit tests
1415
#[cfg_attr(test, linkage = "available_externally")]
15-
#[unsafe(export_name = "_ZN16__rust_internals3std3sys3sgx3abi3tls14TLS_KEY_IN_USEE")]
16+
#[unsafe(export_name = "_ZN16__rust_internals3std3sys3pal3sgx3abi3tls14TLS_KEY_IN_USEE")]
1617
static TLS_KEY_IN_USE: SyncBitset = SYNC_BITSET_INIT;
1718
macro_rules! dup {
1819
((* $($exp:tt)*) $($val:tt)*) => (dup!( ($($exp)*) $($val)* $($val)* ));
1920
(() $($val:tt)*) => ([$($val),*])
2021
}
22+
// Specifying linkage/symbol name is solely to ensure a single instance between this crate and its unit tests
2123
#[cfg_attr(test, linkage = "available_externally")]
22-
#[unsafe(export_name = "_ZN16__rust_internals3std3sys3sgx3abi3tls14TLS_DESTRUCTORE")]
24+
#[unsafe(export_name = "_ZN16__rust_internals3std3sys3pal3sgx3abi3tls14TLS_DESTRUCTORE")]
2325
static TLS_DESTRUCTOR: [AtomicUsize; TLS_KEYS] = dup!((* * * * * * *) (AtomicUsize::new(0)));
2426

2527
unsafe extern "C" {

library/std/src/sys/pal/sgx/os.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,13 @@ pub fn current_exe() -> io::Result<PathBuf> {
7373
unsupported()
7474
}
7575

76+
// Specifying linkage/symbol name is solely to ensure a single instance between this crate and its unit tests
7677
#[cfg_attr(test, linkage = "available_externally")]
77-
#[unsafe(export_name = "_ZN16__rust_internals3std3sys3sgx2os3ENVE")]
78+
#[unsafe(export_name = "_ZN16__rust_internals3std3sys3pal3sgx2os3ENVE")]
7879
static ENV: AtomicUsize = AtomicUsize::new(0);
80+
// Specifying linkage/symbol name is solely to ensure a single instance between this crate and its unit tests
7981
#[cfg_attr(test, linkage = "available_externally")]
80-
#[unsafe(export_name = "_ZN16__rust_internals3std3sys3sgx2os8ENV_INITE")]
82+
#[unsafe(export_name = "_ZN16__rust_internals3std3sys3pal3sgx2os8ENV_INITE")]
8183
static ENV_INIT: Once = Once::new();
8284
type EnvStore = Mutex<HashMap<OsString, OsString>>;
8385

library/std/src/sys/pal/sgx/thread.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,9 @@ mod task_queue {
4545
}
4646
}
4747

48+
// Specifying linkage/symbol name is solely to ensure a single instance between this crate and its unit tests
4849
#[cfg_attr(test, linkage = "available_externally")]
49-
#[unsafe(export_name = "_ZN16__rust_internals3std3sys3sgx6thread10TASK_QUEUEE")]
50+
#[unsafe(export_name = "_ZN16__rust_internals3std3sys3pal3sgx6thread10TASK_QUEUEE")]
5051
static TASK_QUEUE: Mutex<Vec<Task>> = Mutex::new(Vec::new());
5152

5253
pub(super) fn lock() -> MutexGuard<'static, Vec<Task>> {

library/std/src/thread/local.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,16 @@ use crate::fmt;
2222
///
2323
/// Initialization is dynamically performed on the first call to a setter (e.g.
2424
/// [`with`]) within a thread, and values that implement [`Drop`] get
25-
/// destructed when a thread exits. Some caveats apply, which are explained below.
25+
/// destructed when a thread exits. Some platform-specific caveats apply, which
26+
/// are explained below.
27+
/// Note that, should the destructor panics, the whole process will be [aborted].
2628
///
2729
/// A `LocalKey`'s initializer cannot recursively depend on itself. Using a
2830
/// `LocalKey` in this way may cause panics, aborts or infinite recursion on
2931
/// the first call to `with`.
3032
///
33+
/// [aborted]: crate::process::abort
34+
///
3135
/// # Single-thread Synchronization
3236
///
3337
/// Though there is no potential race with other threads, it is still possible to

library/std/src/time.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -205,8 +205,8 @@ pub struct Instant(time::Instant);
205205
/// println!("{}", elapsed.as_secs());
206206
/// }
207207
/// Err(e) => {
208-
/// // an error occurred!
209-
/// println!("Error: {e:?}");
208+
/// // the system clock went backwards!
209+
/// println!("Great Scott! {e:?}");
210210
/// }
211211
/// }
212212
/// }
@@ -245,6 +245,7 @@ pub struct Instant(time::Instant);
245245
/// > structure cannot represent the new point in time.
246246
///
247247
/// [`add`]: SystemTime::add
248+
/// [`UNIX_EPOCH`]: SystemTime::UNIX_EPOCH
248249
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
249250
#[stable(feature = "time2", since = "1.8.0")]
250251
pub struct SystemTime(time::SystemTime);

rust-toolchain.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
# standard library we currently track.
33

44
[toolchain]
5-
channel = "nightly-2025-04-21"
5+
channel = "nightly-2025-04-23"
66
components = ["llvm-tools-preview", "rustc-dev", "rust-src", "rustfmt"]

tool_config/kani-version.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
# incompatible with the verify-std repo.
33

44
[kani]
5-
commit = "228c5a5f078ff7b46d67724ed8362865266d709f"
5+
commit = "2879207097a875f22768aec1e972c9b87b01b1b6"

0 commit comments

Comments
 (0)