Skip to content

Commit 111339d

Browse files
github-actions[bot]ChrisDentonborsjoboetazhogin
authored
Merge subtree update for toolchain nightly-2025-05-28 (#370)
This is an automated PR to merge library subtree updates from 2025-05-22 (rust-lang/rust@bf64d66) to 2025-05-28 (rust-lang/rust@45f256d) (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: 725b0db --------- Signed-off-by: Sean Cross <[email protected]> Signed-off-by: Vladimir Krivopalov <[email protected]> Signed-off-by: xizheyin <[email protected]> Signed-off-by: Paul Mabileau <[email protected]> Signed-off-by: Ayush Singh <[email protected]> Co-authored-by: Chris Denton <[email protected]> Co-authored-by: bors <[email protected]> Co-authored-by: joboet <[email protected]> Co-authored-by: Andrew Zhogin <[email protected]> Co-authored-by: DaniPopes <[email protected]> Co-authored-by: Lieselotte <[email protected]> Co-authored-by: Sean Cross <[email protected]> Co-authored-by: The Miri Cronjob Bot <[email protected]> Co-authored-by: Ralf Jung <[email protected]> Co-authored-by: Trevor Gross <[email protected]> Co-authored-by: Jon Bauman <[email protected]> Co-authored-by: binarycat <[email protected]> Co-authored-by: Matthias Krüger <[email protected]> Co-authored-by: Mara Bos <[email protected]> Co-authored-by: Mathis B <[email protected]> Co-authored-by: Natrix <[email protected]> Co-authored-by: Zachary S <[email protected]> Co-authored-by: Thalia Archibald <[email protected]> Co-authored-by: Amanieu d'Antras <[email protected]> Co-authored-by: sayantn <[email protected]> Co-authored-by: Artur Roos <[email protected]> Co-authored-by: Eyal Kalderon <[email protected]> Co-authored-by: Guillaume Gomez <[email protected]> Co-authored-by: Lynnesbian <[email protected]> Co-authored-by: Christopher Berner <[email protected]> Co-authored-by: Stuart Cook <[email protected]> Co-authored-by: Paolo Barbolini <[email protected]> Co-authored-by: github-actions <[email protected]> Co-authored-by: The 8472 <[email protected]> Co-authored-by: Nick Kocharhook <[email protected]> Co-authored-by: Trevor Gross <[email protected]> Co-authored-by: Vladimir Krivopalov <[email protected]> Co-authored-by: Vilim Lendvaj <[email protected]> Co-authored-by: David Tolnay <[email protected]> Co-authored-by: Marijn Schouten <[email protected]> Co-authored-by: Jacob Pratt <[email protected]> Co-authored-by: 王宇逸 <[email protected]> Co-authored-by: ivmarkov <[email protected]> Co-authored-by: Martin Kröning <[email protected]> Co-authored-by: Daniel Paoliello <[email protected]> Co-authored-by: Luca Versari <[email protected]> Co-authored-by: xizheyin <[email protected]> Co-authored-by: Ben Kimock <[email protected]> Co-authored-by: Urgau <[email protected]> Co-authored-by: Dietrich Daroch <[email protected]> Co-authored-by: León Orell Valerian Liehr <[email protected]> Co-authored-by: Pietro Albini <[email protected]> Co-authored-by: Julian Knodt <[email protected]> Co-authored-by: Michael Goulet <[email protected]> Co-authored-by: Michał Łowicki <[email protected]> Co-authored-by: Samuel Tardieu <[email protected]> Co-authored-by: B I Mohammed Abbas <[email protected]> Co-authored-by: Federico Terzi <[email protected]> Co-authored-by: Eric Huss <[email protected]> Co-authored-by: sam skeoch <[email protected]> Co-authored-by: Benoît du Garreau <[email protected]> Co-authored-by: est31 <[email protected]> Co-authored-by: GrantBirki <[email protected]> Co-authored-by: Paul Mabileau <[email protected]> Co-authored-by: Jack O'Connor <[email protected]> Co-authored-by: mejrs <[email protected]> Co-authored-by: Fluid <[email protected]> Co-authored-by: Speedy_Lex <[email protected]> Co-authored-by: Mario Pastorelli <[email protected]> Co-authored-by: Daniel McNab <[email protected]> Co-authored-by: Josh Triplett <[email protected]> Co-authored-by: Folkert de Vries <[email protected]> Co-authored-by: waffle <[email protected]> Co-authored-by: Dannyyy93 <[email protected]> Co-authored-by: Ayush Singh <[email protected]> Co-authored-by: Tamir Duberstein <[email protected]> Co-authored-by: gitbot <git@bot> Co-authored-by: Michael Tautschnig <[email protected]>
1 parent dacc2d5 commit 111339d

File tree

64 files changed

+879
-621
lines changed

Some content is hidden

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

64 files changed

+879
-621
lines changed

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1398,10 +1398,12 @@ impl<K, V, A: Allocator + Clone> BTreeMap<K, V, A> {
13981398
}
13991399

14001400
/// Creates an iterator that visits all elements (key-value pairs) in
1401-
/// ascending key order and uses a closure to determine if an element should
1402-
/// be removed. If the closure returns `true`, the element is removed from
1403-
/// the map and yielded. If the closure returns `false`, or panics, the
1404-
/// element remains in the map and will not be yielded.
1401+
/// ascending key order and uses a closure to determine if an element
1402+
/// should be removed.
1403+
///
1404+
/// If the closure returns `true`, the element is removed from the map and
1405+
/// yielded. If the closure returns `false`, or panics, the element remains
1406+
/// in the map and will not be yielded.
14051407
///
14061408
/// The iterator also lets you mutate the value of each element in the
14071409
/// closure, regardless of whether you choose to keep or remove it.

library/alloc/src/collections/linked_list.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1124,20 +1124,20 @@ impl<T, A: Allocator> LinkedList<T, A> {
11241124

11251125
/// Creates an iterator which uses a closure to determine if an element should be removed.
11261126
///
1127-
/// If the closure returns true, then the element is removed and yielded.
1128-
/// If the closure returns false, the element will remain in the list and will not be yielded
1129-
/// by the iterator.
1127+
/// If the closure returns `true`, the element is removed from the list and
1128+
/// yielded. If the closure returns `false`, or panics, the element remains
1129+
/// in the list and will not be yielded.
11301130
///
11311131
/// If the returned `ExtractIf` is not exhausted, e.g. because it is dropped without iterating
11321132
/// or the iteration short-circuits, then the remaining elements will be retained.
11331133
/// Use `extract_if().for_each(drop)` if you do not need the returned iterator.
11341134
///
1135-
/// Note that `extract_if` lets you mutate every element in the filter closure, regardless of
1136-
/// whether you choose to keep or remove it.
1135+
/// The iterator also lets you mutate the value of each element in the
1136+
/// closure, regardless of whether you choose to keep or remove it.
11371137
///
11381138
/// # Examples
11391139
///
1140-
/// Splitting a list into evens and odds, reusing the original list:
1140+
/// Splitting a list into even and odd values, reusing the original list:
11411141
///
11421142
/// ```
11431143
/// use std::collections::LinkedList;

library/alloc/src/collections/vec_deque/mod.rs

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1315,6 +1315,8 @@ impl<T, A: Allocator> VecDeque<T, A> {
13151315
///
13161316
/// If [`make_contiguous`] was previously called, all elements of the
13171317
/// deque will be in the first slice and the second slice will be empty.
1318+
/// Otherwise, the exact split point depends on implementation details
1319+
/// and is not guaranteed.
13181320
///
13191321
/// [`make_contiguous`]: VecDeque::make_contiguous
13201322
///
@@ -1329,12 +1331,18 @@ impl<T, A: Allocator> VecDeque<T, A> {
13291331
/// deque.push_back(1);
13301332
/// deque.push_back(2);
13311333
///
1332-
/// assert_eq!(deque.as_slices(), (&[0, 1, 2][..], &[][..]));
1334+
/// let expected = [0, 1, 2];
1335+
/// let (front, back) = deque.as_slices();
1336+
/// assert_eq!(&expected[..front.len()], front);
1337+
/// assert_eq!(&expected[front.len()..], back);
13331338
///
13341339
/// deque.push_front(10);
13351340
/// deque.push_front(9);
13361341
///
1337-
/// assert_eq!(deque.as_slices(), (&[9, 10][..], &[0, 1, 2][..]));
1342+
/// let expected = [9, 10, 0, 1, 2];
1343+
/// let (front, back) = deque.as_slices();
1344+
/// assert_eq!(&expected[..front.len()], front);
1345+
/// assert_eq!(&expected[front.len()..], back);
13381346
/// ```
13391347
#[inline]
13401348
#[stable(feature = "deque_extras_15", since = "1.5.0")]
@@ -1350,6 +1358,8 @@ impl<T, A: Allocator> VecDeque<T, A> {
13501358
///
13511359
/// If [`make_contiguous`] was previously called, all elements of the
13521360
/// deque will be in the first slice and the second slice will be empty.
1361+
/// Otherwise, the exact split point depends on implementation details
1362+
/// and is not guaranteed.
13531363
///
13541364
/// [`make_contiguous`]: VecDeque::make_contiguous
13551365
///
@@ -1366,9 +1376,22 @@ impl<T, A: Allocator> VecDeque<T, A> {
13661376
/// deque.push_front(10);
13671377
/// deque.push_front(9);
13681378
///
1369-
/// deque.as_mut_slices().0[0] = 42;
1370-
/// deque.as_mut_slices().1[0] = 24;
1371-
/// assert_eq!(deque.as_slices(), (&[42, 10][..], &[24, 1][..]));
1379+
/// // Since the split point is not guaranteed, we may need to update
1380+
/// // either slice.
1381+
/// let mut update_nth = |index: usize, val: u32| {
1382+
/// let (front, back) = deque.as_mut_slices();
1383+
/// if index > front.len() - 1 {
1384+
/// back[index - front.len()] = val;
1385+
/// } else {
1386+
/// front[index] = val;
1387+
/// }
1388+
/// };
1389+
///
1390+
/// update_nth(0, 42);
1391+
/// update_nth(2, 24);
1392+
///
1393+
/// let v: Vec<_> = deque.into();
1394+
/// assert_eq!(v, [42, 10, 24, 1]);
13721395
/// ```
13731396
#[inline]
13741397
#[stable(feature = "deque_extras_15", since = "1.5.0")]

library/alloc/src/slice.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ use crate::boxed::Box;
6969
use crate::vec::Vec;
7070

7171
impl<T> [T] {
72-
/// Sorts the slice, preserving initial order of equal elements.
72+
/// Sorts the slice in ascending order, preserving initial order of equal elements.
7373
///
7474
/// This sort is stable (i.e., does not reorder equal elements) and *O*(*n* \* log(*n*))
7575
/// worst-case.
@@ -137,7 +137,8 @@ impl<T> [T] {
137137
stable_sort(self, T::lt);
138138
}
139139

140-
/// Sorts the slice with a comparison function, preserving initial order of equal elements.
140+
/// Sorts the slice in ascending order with a comparison function, preserving initial order of
141+
/// equal elements.
141142
///
142143
/// This sort is stable (i.e., does not reorder equal elements) and *O*(*n* \* log(*n*))
143144
/// worst-case.
@@ -197,7 +198,8 @@ impl<T> [T] {
197198
stable_sort(self, |a, b| compare(a, b) == Less);
198199
}
199200

200-
/// Sorts the slice with a key extraction function, preserving initial order of equal elements.
201+
/// Sorts the slice in ascending order with a key extraction function, preserving initial order
202+
/// of equal elements.
201203
///
202204
/// This sort is stable (i.e., does not reorder equal elements) and *O*(*m* \* *n* \* log(*n*))
203205
/// worst-case, where the key function is *O*(*m*).
@@ -252,7 +254,8 @@ impl<T> [T] {
252254
stable_sort(self, |a, b| f(a).lt(&f(b)));
253255
}
254256

255-
/// Sorts the slice with a key extraction function, preserving initial order of equal elements.
257+
/// Sorts the slice in ascending order with a key extraction function, preserving initial order
258+
/// of equal elements.
256259
///
257260
/// This sort is stable (i.e., does not reorder equal elements) and *O*(*m* \* *n* + *n* \*
258261
/// log(*n*)) worst-case, where the key function is *O*(*m*).

library/alloc/src/str.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,7 @@ impl str {
320320
/// ```
321321
#[cfg(not(no_global_oom_handling))]
322322
#[rustc_allow_incoherent_impl]
323+
#[doc(alias = "replace_first")]
323324
#[must_use = "this returns the replaced string as a new allocation, \
324325
without modifying the original"]
325326
#[stable(feature = "str_replacen", since = "1.16.0")]

library/alloc/src/vec/mod.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3648,11 +3648,11 @@ impl<T, A: Allocator> Vec<T, A> {
36483648
Splice { drain: self.drain(range), replace_with: replace_with.into_iter() }
36493649
}
36503650

3651-
/// Creates an iterator which uses a closure to determine if element in the range should be removed.
3651+
/// Creates an iterator which uses a closure to determine if an element in the range should be removed.
36523652
///
3653-
/// If the closure returns true, then the element is removed and yielded.
3654-
/// If the closure returns false, the element will remain in the vector and will not be yielded
3655-
/// by the iterator.
3653+
/// If the closure returns `true`, the element is removed from the vector
3654+
/// and yielded. If the closure returns `false`, or panics, the element
3655+
/// remains in the vector and will not be yielded.
36563656
///
36573657
/// Only elements that fall in the provided range are considered for extraction, but any elements
36583658
/// after the range will still have to be moved if any element has been extracted.
@@ -3692,16 +3692,16 @@ impl<T, A: Allocator> Vec<T, A> {
36923692
/// But `extract_if` is easier to use. `extract_if` is also more efficient,
36933693
/// because it can backshift the elements of the array in bulk.
36943694
///
3695-
/// Note that `extract_if` also lets you mutate the elements passed to the filter closure,
3696-
/// regardless of whether you choose to keep or remove them.
3695+
/// The iterator also lets you mutate the value of each element in the
3696+
/// closure, regardless of whether you choose to keep or remove it.
36973697
///
36983698
/// # Panics
36993699
///
37003700
/// If `range` is out of bounds.
37013701
///
37023702
/// # Examples
37033703
///
3704-
/// Splitting an array into evens and odds, reusing the original allocation:
3704+
/// Splitting a vector into even and odd values, reusing the original vector:
37053705
///
37063706
/// ```
37073707
/// let mut numbers = vec![1, 2, 3, 4, 5, 6, 8, 9, 11, 13, 14, 15];

library/core/src/array/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -588,7 +588,7 @@ impl<T, const N: usize> [T; N] {
588588
/// Returns a mutable slice containing the entire array. Equivalent to
589589
/// `&mut s[..]`.
590590
#[stable(feature = "array_as_slice", since = "1.57.0")]
591-
#[rustc_const_unstable(feature = "const_array_as_mut_slice", issue = "133333")]
591+
#[rustc_const_stable(feature = "const_array_as_mut_slice", since = "CURRENT_RUSTC_VERSION")]
592592
pub const fn as_mut_slice(&mut self) -> &mut [T] {
593593
self
594594
}

library/core/src/convert/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,7 @@ pub trait Into<T>: Sized {
575575
#[rustc_diagnostic_item = "From"]
576576
#[stable(feature = "rust1", since = "1.0.0")]
577577
#[rustc_on_unimplemented(on(
578-
all(_Self = "&str", T = "alloc::string::String"),
578+
all(Self = "&str", T = "alloc::string::String"),
579579
note = "to coerce a `{T}` into a `{Self}`, use `&*` as a prefix",
580580
))]
581581
#[doc(search_unbox)]

library/core/src/ffi/c_str.rs

Lines changed: 7 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -559,13 +559,8 @@ impl CStr {
559559
/// # Examples
560560
///
561561
/// ```
562-
/// use std::ffi::CStr;
563-
///
564-
/// let cstr = CStr::from_bytes_with_nul(b"foo\0").unwrap();
565-
/// assert_eq!(cstr.count_bytes(), 3);
566-
///
567-
/// let cstr = CStr::from_bytes_with_nul(b"\0").unwrap();
568-
/// assert_eq!(cstr.count_bytes(), 0);
562+
/// assert_eq!(c"foo".count_bytes(), 3);
563+
/// assert_eq!(c"".count_bytes(), 0);
569564
/// ```
570565
#[inline]
571566
#[must_use]
@@ -581,19 +576,8 @@ impl CStr {
581576
/// # Examples
582577
///
583578
/// ```
584-
/// use std::ffi::CStr;
585-
/// # use std::ffi::FromBytesWithNulError;
586-
///
587-
/// # fn main() { test().unwrap(); }
588-
/// # fn test() -> Result<(), FromBytesWithNulError> {
589-
/// let cstr = CStr::from_bytes_with_nul(b"foo\0")?;
590-
/// assert!(!cstr.is_empty());
591-
///
592-
/// let empty_cstr = CStr::from_bytes_with_nul(b"\0")?;
593-
/// assert!(empty_cstr.is_empty());
579+
/// assert!(!c"foo".is_empty());
594580
/// assert!(c"".is_empty());
595-
/// # Ok(())
596-
/// # }
597581
/// ```
598582
#[inline]
599583
#[stable(feature = "cstr_is_empty", since = "1.71.0")]
@@ -617,10 +601,7 @@ impl CStr {
617601
/// # Examples
618602
///
619603
/// ```
620-
/// use std::ffi::CStr;
621-
///
622-
/// let cstr = CStr::from_bytes_with_nul(b"foo\0").expect("CStr::from_bytes_with_nul failed");
623-
/// assert_eq!(cstr.to_bytes(), b"foo");
604+
/// assert_eq!(c"foo".to_bytes(), b"foo");
624605
/// ```
625606
#[inline]
626607
#[must_use = "this returns the result of the operation, \
@@ -646,10 +627,7 @@ impl CStr {
646627
/// # Examples
647628
///
648629
/// ```
649-
/// use std::ffi::CStr;
650-
///
651-
/// let cstr = CStr::from_bytes_with_nul(b"foo\0").expect("CStr::from_bytes_with_nul failed");
652-
/// assert_eq!(cstr.to_bytes_with_nul(), b"foo\0");
630+
/// assert_eq!(c"foo".to_bytes_with_nul(), b"foo\0");
653631
/// ```
654632
#[inline]
655633
#[must_use = "this returns the result of the operation, \
@@ -671,10 +649,8 @@ impl CStr {
671649
///
672650
/// ```
673651
/// #![feature(cstr_bytes)]
674-
/// use std::ffi::CStr;
675652
///
676-
/// let cstr = CStr::from_bytes_with_nul(b"foo\0").expect("CStr::from_bytes_with_nul failed");
677-
/// assert!(cstr.bytes().eq(*b"foo"));
653+
/// assert!(c"foo".bytes().eq(*b"foo"));
678654
/// ```
679655
#[inline]
680656
#[unstable(feature = "cstr_bytes", issue = "112115")]
@@ -693,10 +669,7 @@ impl CStr {
693669
/// # Examples
694670
///
695671
/// ```
696-
/// use std::ffi::CStr;
697-
///
698-
/// let cstr = CStr::from_bytes_with_nul(b"foo\0").expect("CStr::from_bytes_with_nul failed");
699-
/// assert_eq!(cstr.to_str(), Ok("foo"));
672+
/// assert_eq!(c"foo".to_str(), Ok("foo"));
700673
/// ```
701674
#[stable(feature = "cstr_to_str", since = "1.4.0")]
702675
#[rustc_const_stable(feature = "const_cstr_methods", since = "1.72.0")]

library/core/src/ffi/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ pub mod c_str;
2828
issue = "44930",
2929
reason = "the `c_variadic` feature has not been properly tested on all supported platforms"
3030
)]
31-
pub use self::va_list::{VaList, VaListImpl};
31+
pub use self::va_list::{VaArgSafe, VaList, VaListImpl};
3232

3333
#[unstable(
3434
feature = "c_variadic",

library/core/src/ffi/primitives.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ type_alias! { "c_float.md", c_float = f32; }
3535
type_alias! { "c_double.md", c_double = f64; }
3636

3737
mod c_char_definition {
38-
crate::cfg_match! {
38+
crate::cfg_select! {
3939
// These are the targets on which c_char is unsigned. Usually the
4040
// signedness is the same for all target_os values on a given architecture
4141
// but there are some exceptions (see isSignedCharDefault() in clang).
@@ -133,7 +133,7 @@ mod c_char_definition {
133133
}
134134

135135
mod c_long_definition {
136-
crate::cfg_match! {
136+
crate::cfg_select! {
137137
any(
138138
all(target_pointer_width = "64", not(windows)),
139139
// wasm32 Linux ABI uses 64-bit long
@@ -172,7 +172,7 @@ pub type c_ptrdiff_t = isize;
172172
pub type c_ssize_t = isize;
173173

174174
mod c_int_definition {
175-
crate::cfg_match! {
175+
crate::cfg_select! {
176176
any(target_arch = "avr", target_arch = "msp430") => {
177177
pub(super) type c_int = i16;
178178
pub(super) type c_uint = u16;

0 commit comments

Comments
 (0)