Skip to content

Commit c090506

Browse files
github-actions[bot]scottmcmgithub-actionstgross35jhpratt
authored
Merge subtree update for toolchain nightly-2025-08-18 (#467)
This is an automated PR to merge library subtree updates from 2025-08-07 (rust-lang/rust@7d82b83) to 2025-08-18 (rust-lang/rust@425a9c0) (inclusive) into main. `git merge` resulted in conflicts, which require manual resolution. Files were commited with merge conflict markers. **Do not remove or edit the following annotations:** git-subtree-dir: library git-subtree-split: 85cbfac --------- Signed-off-by: Ayush Singh <[email protected]> Signed-off-by: Jonathan Brouwer <[email protected]> Signed-off-by: Sacha Ayoun <[email protected]> Signed-off-by: Eval EXEC <[email protected]> Signed-off-by: Jens Reidel <[email protected]> Co-authored-by: Scott McMurray <[email protected]> Co-authored-by: github-actions <[email protected]> Co-authored-by: Trevor Gross <[email protected]> Co-authored-by: Jacob Pratt <[email protected]> Co-authored-by: quaternic <[email protected]> Co-authored-by: Madhav Madhusoodanan <[email protected]> Co-authored-by: Ralf Jung <[email protected]> Co-authored-by: Folkert de Vries <[email protected]> Co-authored-by: bors <[email protected]> Co-authored-by: Matthias Krüger <[email protected]> Co-authored-by: xonx <[email protected]> Co-authored-by: Yosh <[email protected]> Co-authored-by: usamoi <[email protected]> Co-authored-by: joboet <[email protected]> Co-authored-by: Stuart Cook <[email protected]> Co-authored-by: gewitternacht <[email protected]> Co-authored-by: Jakub Beránek <[email protected]> Co-authored-by: Connor Tsui <[email protected]> Co-authored-by: Aandreba <[email protected]> Co-authored-by: Lucas Werkmeister <[email protected]> Co-authored-by: WANG Rui <[email protected]> Co-authored-by: Orson Peters <[email protected]> Co-authored-by: Balt <[email protected]> Co-authored-by: Nurzhan Sakén <[email protected]> Co-authored-by: Tsukasa OI <[email protected]> Co-authored-by: Guillaume Gomez <[email protected]> Co-authored-by: Samuel Tardieu <[email protected]> Co-authored-by: Evgenii Zheltonozhskii <[email protected]> Co-authored-by: Nico Lehmann <[email protected]> Co-authored-by: stifskere <[email protected]> Co-authored-by: Christopher Hotchkiss <[email protected]> Co-authored-by: Folkert de Vries <[email protected]> Co-authored-by: Kivooeo <[email protected]> Co-authored-by: Ayush Singh <[email protected]> Co-authored-by: Jonathan Brouwer <[email protected]> Co-authored-by: Ross MacArthur <[email protected]> Co-authored-by: Paul Murphy <[email protected]> Co-authored-by: Michael Tautschnig <[email protected]> Co-authored-by: Chai T. Rex <[email protected]> Co-authored-by: okaneco <[email protected]> Co-authored-by: The 8472 <[email protected]> Co-authored-by: Josh Triplett <[email protected]> Co-authored-by: Eric Huss <[email protected]> Co-authored-by: Boxy <[email protected]> Co-authored-by: LorrensP-2158466 <[email protected]> Co-authored-by: Karl Meakin <[email protected]> Co-authored-by: Ivan Enderlin <[email protected]> Co-authored-by: Ulrich Stark <[email protected]> Co-authored-by: Shoyu Vanilla <[email protected]> Co-authored-by: Trevor Gross <[email protected]> Co-authored-by: Roger Curley <[email protected]> Co-authored-by: Spxg <[email protected]> Co-authored-by: Chris Denton <[email protected]> Co-authored-by: Ada Alakbarova <[email protected]> Co-authored-by: ltdk <[email protected]> Co-authored-by: Esteban Küber <[email protected]> Co-authored-by: SabrinaJewson <[email protected]> Co-authored-by: Ed Page <[email protected]> Co-authored-by: Ada Alakbarova <[email protected]> Co-authored-by: Mara Bos <[email protected]> Co-authored-by: Sacha Ayoun <[email protected]> Co-authored-by: Tim (Theemathas) Chirananthavat <[email protected]> Co-authored-by: Eval EXEC <[email protected]> Co-authored-by: sayantn <[email protected]> Co-authored-by: Nicholas Nethercote <[email protected]> Co-authored-by: Marcelo Domínguez <[email protected]> Co-authored-by: Jens Reidel <[email protected]> Co-authored-by: gitbot <git@bot>
1 parent f66ba41 commit c090506

File tree

326 files changed

+9124
-7684
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

326 files changed

+9124
-7684
lines changed

.github/workflows/flux.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99

1010
env:
1111
FIXPOINT_VERSION: "556104ba5508891c357b0bdf819ce706e93d9349"
12-
FLUX_VERSION: "ebafb8d0ca32d8c0fcd2a0cfef6b1b4bd4dc4a6f"
12+
FLUX_VERSION: "a17246965a8752e3d3d4e3559865311048bb61f7"
1313

1414
jobs:
1515
check-flux-on-core:

library/Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

library/alloc/src/boxed.rs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1672,7 +1672,7 @@ unsafe impl<#[may_dangle] T: ?Sized, A: Allocator> Drop for Box<T, A> {
16721672
#[cfg(not(no_global_oom_handling))]
16731673
#[stable(feature = "rust1", since = "1.0.0")]
16741674
impl<T: Default> Default for Box<T> {
1675-
/// Creates a `Box<T>`, with the `Default` value for T.
1675+
/// Creates a `Box<T>`, with the `Default` value for `T`.
16761676
#[inline]
16771677
fn default() -> Self {
16781678
let mut x: Box<mem::MaybeUninit<T>> = Box::new_uninit();
@@ -1695,6 +1695,7 @@ impl<T: Default> Default for Box<T> {
16951695
#[cfg(not(no_global_oom_handling))]
16961696
#[stable(feature = "rust1", since = "1.0.0")]
16971697
impl<T> Default for Box<[T]> {
1698+
/// Creates an empty `[T]` inside a `Box`.
16981699
#[inline]
16991700
fn default() -> Self {
17001701
let ptr: Unique<[T]> = Unique::<[T; 0]>::dangling();
@@ -1716,6 +1717,19 @@ impl Default for Box<str> {
17161717
}
17171718
}
17181719

1720+
#[cfg(not(no_global_oom_handling))]
1721+
#[stable(feature = "pin_default_impls", since = "CURRENT_RUSTC_VERSION")]
1722+
impl<T> Default for Pin<Box<T>>
1723+
where
1724+
T: ?Sized,
1725+
Box<T>: Default,
1726+
{
1727+
#[inline]
1728+
fn default() -> Self {
1729+
Box::into_pin(Box::<T>::default())
1730+
}
1731+
}
1732+
17191733
#[cfg(not(no_global_oom_handling))]
17201734
#[stable(feature = "rust1", since = "1.0.0")]
17211735
impl<T: Clone, A: Allocator + Clone> Clone for Box<T, A> {

library/alloc/src/collections/btree/map.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,8 @@ pub(super) const MIN_LEN: usize = node::MIN_LEN_AFTER_SPLIT;
135135
/// ]);
136136
/// ```
137137
///
138+
/// ## `Entry` API
139+
///
138140
/// `BTreeMap` implements an [`Entry API`], which allows for complex
139141
/// methods of getting, setting, updating and removing keys and their values:
140142
///

library/alloc/src/ffi/c_str.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1099,7 +1099,7 @@ impl From<&CStr> for CString {
10991099
}
11001100
}
11011101

1102-
#[stable(feature = "c_string_eq_c_str", since = "CURRENT_RUSTC_VERSION")]
1102+
#[stable(feature = "c_string_eq_c_str", since = "1.90.0")]
11031103
impl PartialEq<CStr> for CString {
11041104
#[inline]
11051105
fn eq(&self, other: &CStr) -> bool {
@@ -1112,7 +1112,7 @@ impl PartialEq<CStr> for CString {
11121112
}
11131113
}
11141114

1115-
#[stable(feature = "c_string_eq_c_str", since = "CURRENT_RUSTC_VERSION")]
1115+
#[stable(feature = "c_string_eq_c_str", since = "1.90.0")]
11161116
impl PartialEq<&CStr> for CString {
11171117
#[inline]
11181118
fn eq(&self, other: &&CStr) -> bool {
@@ -1126,7 +1126,7 @@ impl PartialEq<&CStr> for CString {
11261126
}
11271127

11281128
#[cfg(not(no_global_oom_handling))]
1129-
#[stable(feature = "c_string_eq_c_str", since = "CURRENT_RUSTC_VERSION")]
1129+
#[stable(feature = "c_string_eq_c_str", since = "1.90.0")]
11301130
impl PartialEq<Cow<'_, CStr>> for CString {
11311131
#[inline]
11321132
fn eq(&self, other: &Cow<'_, CStr>) -> bool {
@@ -1221,7 +1221,7 @@ impl CStr {
12211221
}
12221222
}
12231223

1224-
#[stable(feature = "c_string_eq_c_str", since = "CURRENT_RUSTC_VERSION")]
1224+
#[stable(feature = "c_string_eq_c_str", since = "1.90.0")]
12251225
impl PartialEq<CString> for CStr {
12261226
#[inline]
12271227
fn eq(&self, other: &CString) -> bool {
@@ -1235,7 +1235,7 @@ impl PartialEq<CString> for CStr {
12351235
}
12361236

12371237
#[cfg(not(no_global_oom_handling))]
1238-
#[stable(feature = "c_string_eq_c_str", since = "CURRENT_RUSTC_VERSION")]
1238+
#[stable(feature = "c_string_eq_c_str", since = "1.90.0")]
12391239
impl PartialEq<Cow<'_, Self>> for CStr {
12401240
#[inline]
12411241
fn eq(&self, other: &Cow<'_, Self>) -> bool {
@@ -1249,7 +1249,7 @@ impl PartialEq<Cow<'_, Self>> for CStr {
12491249
}
12501250

12511251
#[cfg(not(no_global_oom_handling))]
1252-
#[stable(feature = "c_string_eq_c_str", since = "CURRENT_RUSTC_VERSION")]
1252+
#[stable(feature = "c_string_eq_c_str", since = "1.90.0")]
12531253
impl PartialEq<CStr> for Cow<'_, CStr> {
12541254
#[inline]
12551255
fn eq(&self, other: &CStr) -> bool {
@@ -1263,7 +1263,7 @@ impl PartialEq<CStr> for Cow<'_, CStr> {
12631263
}
12641264

12651265
#[cfg(not(no_global_oom_handling))]
1266-
#[stable(feature = "c_string_eq_c_str", since = "CURRENT_RUSTC_VERSION")]
1266+
#[stable(feature = "c_string_eq_c_str", since = "1.90.0")]
12671267
impl PartialEq<&CStr> for Cow<'_, CStr> {
12681268
#[inline]
12691269
fn eq(&self, other: &&CStr) -> bool {
@@ -1277,7 +1277,7 @@ impl PartialEq<&CStr> for Cow<'_, CStr> {
12771277
}
12781278

12791279
#[cfg(not(no_global_oom_handling))]
1280-
#[stable(feature = "c_string_eq_c_str", since = "CURRENT_RUSTC_VERSION")]
1280+
#[stable(feature = "c_string_eq_c_str", since = "1.90.0")]
12811281
impl PartialEq<CString> for Cow<'_, CStr> {
12821282
#[inline]
12831283
fn eq(&self, other: &CString) -> bool {

library/alloc/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@
103103
#![feature(async_iterator)]
104104
#![feature(bstr)]
105105
#![feature(bstr_internals)]
106+
#![feature(cast_maybe_uninit)]
106107
#![feature(char_internals)]
107108
#![feature(char_max_len)]
108109
#![feature(clone_to_uninit)]

library/alloc/src/rc.rs

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2357,7 +2357,7 @@ impl<T: Default> Default for Rc<T> {
23572357
/// assert_eq!(*x, 0);
23582358
/// ```
23592359
#[inline]
2360-
fn default() -> Rc<T> {
2360+
fn default() -> Self {
23612361
unsafe {
23622362
Self::from_inner(
23632363
Box::leak(Box::write(
@@ -2373,7 +2373,7 @@ impl<T: Default> Default for Rc<T> {
23732373
#[cfg(not(no_global_oom_handling))]
23742374
#[stable(feature = "more_rc_default_impls", since = "1.80.0")]
23752375
impl Default for Rc<str> {
2376-
/// Creates an empty str inside an Rc
2376+
/// Creates an empty `str` inside an `Rc`.
23772377
///
23782378
/// This may or may not share an allocation with other Rcs on the same thread.
23792379
#[inline]
@@ -2387,7 +2387,7 @@ impl Default for Rc<str> {
23872387
#[cfg(not(no_global_oom_handling))]
23882388
#[stable(feature = "more_rc_default_impls", since = "1.80.0")]
23892389
impl<T> Default for Rc<[T]> {
2390-
/// Creates an empty `[T]` inside an Rc
2390+
/// Creates an empty `[T]` inside an `Rc`.
23912391
///
23922392
/// This may or may not share an allocation with other Rcs on the same thread.
23932393
#[inline]
@@ -2397,6 +2397,19 @@ impl<T> Default for Rc<[T]> {
23972397
}
23982398
}
23992399

2400+
#[cfg(not(no_global_oom_handling))]
2401+
#[stable(feature = "pin_default_impls", since = "CURRENT_RUSTC_VERSION")]
2402+
impl<T> Default for Pin<Rc<T>>
2403+
where
2404+
T: ?Sized,
2405+
Rc<T>: Default,
2406+
{
2407+
#[inline]
2408+
fn default() -> Self {
2409+
unsafe { Pin::new_unchecked(Rc::<T>::default()) }
2410+
}
2411+
}
2412+
24002413
#[stable(feature = "rust1", since = "1.0.0")]
24012414
trait RcEqIdent<T: ?Sized + PartialEq, A: Allocator> {
24022415
fn eq(&self, other: &Rc<T, A>) -> bool;

library/alloc/src/sync.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3654,6 +3654,19 @@ impl<T> Default for Arc<[T]> {
36543654
}
36553655
}
36563656

3657+
#[cfg(not(no_global_oom_handling))]
3658+
#[stable(feature = "pin_default_impls", since = "CURRENT_RUSTC_VERSION")]
3659+
impl<T> Default for Pin<Arc<T>>
3660+
where
3661+
T: ?Sized,
3662+
Arc<T>: Default,
3663+
{
3664+
#[inline]
3665+
fn default() -> Self {
3666+
unsafe { Pin::new_unchecked(Arc::<T>::default()) }
3667+
}
3668+
}
3669+
36573670
#[stable(feature = "rust1", since = "1.0.0")]
36583671
impl<T: ?Sized + Hash, A: Allocator> Hash for Arc<T, A> {
36593672
fn hash<H: Hasher>(&self, state: &mut H) {

library/alloc/src/vec/mod.rs

Lines changed: 62 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,27 @@
4949
//! v[1] = v[1] + 5;
5050
//! ```
5151
//!
52+
//! # Memory layout
53+
//!
54+
//! When the type is non-zero-sized and the capacity is nonzero, [`Vec`] uses the [`Global`]
55+
//! allocator for its allocation. It is valid to convert both ways between such a [`Vec`] and a raw
56+
//! pointer allocated with the [`Global`] allocator, provided that the [`Layout`] used with the
57+
//! allocator is correct for a sequence of `capacity` elements of the type, and the first `len`
58+
//! values pointed to by the raw pointer are valid. More precisely, a `ptr: *mut T` that has been
59+
//! allocated with the [`Global`] allocator with [`Layout::array::<T>(capacity)`][Layout::array] may
60+
//! be converted into a vec using
61+
//! [`Vec::<T>::from_raw_parts(ptr, len, capacity)`](Vec::from_raw_parts). Conversely, the memory
62+
//! backing a `value: *mut T` obtained from [`Vec::<T>::as_mut_ptr`] may be deallocated using the
63+
//! [`Global`] allocator with the same layout.
64+
//!
65+
//! For zero-sized types (ZSTs), or when the capacity is zero, the `Vec` pointer must be non-null
66+
//! and sufficiently aligned. The recommended way to build a `Vec` of ZSTs if [`vec!`] cannot be
67+
//! used is to use [`ptr::NonNull::dangling`].
68+
//!
5269
//! [`push`]: Vec::push
70+
//! [`ptr::NonNull::dangling`]: NonNull::dangling
71+
//! [`Layout`]: crate::alloc::Layout
72+
//! [Layout::array]: crate::alloc::Layout::array
5373
5474
#![stable(feature = "rust1", since = "1.0.0")]
5575

@@ -523,18 +543,23 @@ impl<T> Vec<T> {
523543
/// This is highly unsafe, due to the number of invariants that aren't
524544
/// checked:
525545
///
526-
/// * `ptr` must have been allocated using the global allocator, such as via
527-
/// the [`alloc::alloc`] function.
528-
/// * `T` needs to have the same alignment as what `ptr` was allocated with.
546+
/// * If `T` is not a zero-sized type and the capacity is nonzero, `ptr` must have
547+
/// been allocated using the global allocator, such as via the [`alloc::alloc`]
548+
/// function. If `T` is a zero-sized type or the capacity is zero, `ptr` need
549+
/// only be non-null and aligned.
550+
/// * `T` needs to have the same alignment as what `ptr` was allocated with,
551+
/// if the pointer is required to be allocated.
529552
/// (`T` having a less strict alignment is not sufficient, the alignment really
530553
/// needs to be equal to satisfy the [`dealloc`] requirement that memory must be
531554
/// allocated and deallocated with the same layout.)
532-
/// * The size of `T` times the `capacity` (ie. the allocated size in bytes) needs
533-
/// to be the same size as the pointer was allocated with. (Because similar to
534-
/// alignment, [`dealloc`] must be called with the same layout `size`.)
555+
/// * The size of `T` times the `capacity` (ie. the allocated size in bytes), if
556+
/// nonzero, needs to be the same size as the pointer was allocated with.
557+
/// (Because similar to alignment, [`dealloc`] must be called with the same
558+
/// layout `size`.)
535559
/// * `length` needs to be less than or equal to `capacity`.
536560
/// * The first `length` values must be properly initialized values of type `T`.
537-
/// * `capacity` needs to be the capacity that the pointer was allocated with.
561+
/// * `capacity` needs to be the capacity that the pointer was allocated with,
562+
/// if the pointer is required to be allocated.
538563
/// * The allocated size in bytes must be no larger than `isize::MAX`.
539564
/// See the safety documentation of [`pointer::offset`].
540565
///
@@ -770,12 +795,16 @@ impl<T> Vec<T> {
770795
/// order as the arguments to [`from_raw_parts`].
771796
///
772797
/// After calling this function, the caller is responsible for the
773-
/// memory previously managed by the `Vec`. The only way to do
774-
/// this is to convert the raw pointer, length, and capacity back
775-
/// into a `Vec` with the [`from_raw_parts`] function, allowing
776-
/// the destructor to perform the cleanup.
798+
/// memory previously managed by the `Vec`. Most often, one does
799+
/// this by converting the raw pointer, length, and capacity back
800+
/// into a `Vec` with the [`from_raw_parts`] function; more generally,
801+
/// if `T` is non-zero-sized and the capacity is nonzero, one may use
802+
/// any method that calls [`dealloc`] with a layout of
803+
/// `Layout::array::<T>(capacity)`; if `T` is zero-sized or the
804+
/// capacity is zero, nothing needs to be done.
777805
///
778806
/// [`from_raw_parts`]: Vec::from_raw_parts
807+
/// [`dealloc`]: crate::alloc::GlobalAlloc::dealloc
779808
///
780809
/// # Examples
781810
///
@@ -1755,6 +1784,12 @@ impl<T, A: Allocator> Vec<T, A> {
17551784
/// may still invalidate this pointer.
17561785
/// See the second example below for how this guarantee can be used.
17571786
///
1787+
/// The method also guarantees that, as long as `T` is not zero-sized and the capacity is
1788+
/// nonzero, the pointer may be passed into [`dealloc`] with a layout of
1789+
/// `Layout::array::<T>(capacity)` in order to deallocate the backing memory. If this is done,
1790+
/// be careful not to run the destructor of the `Vec`, as dropping it will result in
1791+
/// double-frees. Wrapping the `Vec` in a [`ManuallyDrop`] is the typical way to achieve this.
1792+
///
17581793
/// # Examples
17591794
///
17601795
/// ```
@@ -1787,9 +1822,24 @@ impl<T, A: Allocator> Vec<T, A> {
17871822
/// }
17881823
/// ```
17891824
///
1825+
/// Deallocating a vector using [`Box`] (which uses [`dealloc`] internally):
1826+
///
1827+
/// ```
1828+
/// use std::mem::{ManuallyDrop, MaybeUninit};
1829+
///
1830+
/// let mut v = ManuallyDrop::new(vec![0, 1, 2]);
1831+
/// let ptr = v.as_mut_ptr();
1832+
/// let capacity = v.capacity();
1833+
/// let slice_ptr: *mut [MaybeUninit<i32>] =
1834+
/// std::ptr::slice_from_raw_parts_mut(ptr.cast(), capacity);
1835+
/// drop(unsafe { Box::from_raw(slice_ptr) });
1836+
/// ```
1837+
///
17901838
/// [`as_mut_ptr`]: Vec::as_mut_ptr
17911839
/// [`as_ptr`]: Vec::as_ptr
17921840
/// [`as_non_null`]: Vec::as_non_null
1841+
/// [`dealloc`]: crate::alloc::GlobalAlloc::dealloc
1842+
/// [`ManuallyDrop`]: core::mem::ManuallyDrop
17931843
#[stable(feature = "vec_as_ptr", since = "1.37.0")]
17941844
#[rustc_const_stable(feature = "const_vec_string_slice", since = "1.87.0")]
17951845
#[rustc_never_returns_null_ptr]
@@ -3126,7 +3176,7 @@ impl<T, A: Allocator> Vec<T, A> {
31263176
// - but the allocation extends out to `self.buf.capacity()` elements, possibly
31273177
// uninitialized
31283178
let spare_ptr = unsafe { ptr.add(self.len) };
3129-
let spare_ptr = spare_ptr.cast::<MaybeUninit<T>>();
3179+
let spare_ptr = spare_ptr.cast_uninit();
31303180
let spare_len = self.buf.capacity() - self.len;
31313181

31323182
// SAFETY:

0 commit comments

Comments
 (0)