Skip to content

Commit 517e11e

Browse files
github-actions[bot]folkertdevmatthiaskrgrfee1-deadbors
authored
Merge subtree update for toolchain nightly-2025-08-06 (#447)
This is an automated PR to merge library subtree updates from 2025-08-01 (rust-lang/rust@adcb3d3) to 2025-08-06 (rust-lang/rust@ec7c026) (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: 7112d06 --------- Signed-off-by: Ayush Singh <[email protected]> Co-authored-by: Folkert de Vries <[email protected]> Co-authored-by: Matthias Krüger <[email protected]> Co-authored-by: Deadbeef <[email protected]> Co-authored-by: bors <[email protected]> Co-authored-by: René Kijewski <[email protected]> Co-authored-by: Nik Revenco <[email protected]> Co-authored-by: The Miri Cronjob Bot <[email protected]> Co-authored-by: Tim (Theemathas) Chirananthavat <[email protected]> Co-authored-by: Jakub Beránek <[email protected]> Co-authored-by: Chris Denton <[email protected]> Co-authored-by: Samuel Tardieu <[email protected]> Co-authored-by: Travis Cross <[email protected]> Co-authored-by: Amanieu d'Antras <[email protected]> Co-authored-by: Oli Scherer <[email protected]> Co-authored-by: David Mládek <[email protected]> Co-authored-by: SunkenPotato <[email protected]> Co-authored-by: Ralf Jung <[email protected]> Co-authored-by: Cameron Steffen <[email protected]> Co-authored-by: Martin Ombura Jr <[email protected]> Co-authored-by: Madhav Madhusoodanan <[email protected]> Co-authored-by: sayantn <[email protected]> Co-authored-by: León Orell Valerian Liehr <[email protected]> Co-authored-by: Trevor Gross <[email protected]> Co-authored-by: WANG Rui <[email protected]> Co-authored-by: Folkert de Vries <[email protected]> Co-authored-by: Luigi Sartor Piucco <[email protected]> Co-authored-by: Julien THILLARD <[email protected]> Co-authored-by: The rustc-josh-sync Cronjob Bot <[email protected]> Co-authored-by: Marijn Schouten <[email protected]> Co-authored-by: usamoi <[email protected]> Co-authored-by: Rémy Rakic <[email protected]> Co-authored-by: Alisa Sireneva <[email protected]> Co-authored-by: Josh Triplett <[email protected]> Co-authored-by: Nurzhan Sakén <[email protected]> Co-authored-by: ltdk <[email protected]> Co-authored-by: bjorn3 <[email protected]> Co-authored-by: Guillaume Gomez <[email protected]> Co-authored-by: Evgenii Zheltonozhskii <[email protected]> Co-authored-by: roblabla <[email protected]> Co-authored-by: 许杰友 Jieyou Xu (Joe) <[email protected]> Co-authored-by: Ayush Singh <[email protected]> Co-authored-by: Kornel <[email protected]> Co-authored-by: Jonas Platte <[email protected]> Co-authored-by: Alex Crichton <[email protected]> Co-authored-by: Zachary S <[email protected]> Co-authored-by: Jeremy Smart <[email protected]> Co-authored-by: Ivan Tadeu Ferreira Antunes Filho <[email protected]> Co-authored-by: okaneco <[email protected]> Co-authored-by: Trevor Gross <[email protected]> Co-authored-by: Jacob Pratt <[email protected]> Co-authored-by: Scott McMurray <[email protected]> Co-authored-by: xonx <[email protected]> Co-authored-by: Yosh <[email protected]> Co-authored-by: joboet <[email protected]> Co-authored-by: Stuart Cook <[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: Orson Peters <[email protected]> Co-authored-by: Balt <[email protected]> Co-authored-by: Tsukasa OI <[email protected]> Co-authored-by: Nico Lehmann <[email protected]> Co-authored-by: stifskere <[email protected]> Co-authored-by: Kivooeo <[email protected]> Co-authored-by: gitbot <git@bot> Co-authored-by: Michael Tautschnig <[email protected]> Co-authored-by: Felipe R. Monteiro <[email protected]>
1 parent 8e9f2b7 commit 517e11e

File tree

39 files changed

+581
-154
lines changed

39 files changed

+581
-154
lines changed

library/Cargo.lock

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

library/alloc/src/string.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -265,12 +265,12 @@ use crate::vec::{self, Vec};
265265
/// You can look at these with the [`as_ptr`], [`len`], and [`capacity`]
266266
/// methods:
267267
///
268+
// FIXME Update this when vec_into_raw_parts is stabilized
268269
/// ```
269270
/// use std::mem;
270271
///
271272
/// let story = String::from("Once upon a time...");
272273
///
273-
// FIXME Update this when vec_into_raw_parts is stabilized
274274
/// // Prevent automatically dropping the String's data
275275
/// let mut story = mem::ManuallyDrop::new(story);
276276
///
@@ -970,13 +970,13 @@ impl String {
970970
///
971971
/// # Examples
972972
///
973+
// FIXME Update this when vec_into_raw_parts is stabilized
973974
/// ```
974975
/// use std::mem;
975976
///
976977
/// unsafe {
977978
/// let s = String::from("hello");
978979
///
979-
// FIXME Update this when vec_into_raw_parts is stabilized
980980
/// // Prevent automatically dropping the String's data
981981
/// let mut s = mem::ManuallyDrop::new(s);
982982
///

library/alloc/src/vec/mod.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -566,13 +566,13 @@ impl<T> Vec<T> {
566566
///
567567
/// # Examples
568568
///
569+
// FIXME Update this when vec_into_raw_parts is stabilized
569570
/// ```
570571
/// use std::ptr;
571572
/// use std::mem;
572573
///
573574
/// let v = vec![1, 2, 3];
574575
///
575-
// FIXME Update this when vec_into_raw_parts is stabilized
576576
/// // Prevent running `v`'s destructor so we are in complete control
577577
/// // of the allocation.
578578
/// let mut v = mem::ManuallyDrop::new(v);
@@ -674,6 +674,7 @@ impl<T> Vec<T> {
674674
///
675675
/// # Examples
676676
///
677+
// FIXME Update this when vec_into_raw_parts is stabilized
677678
/// ```
678679
/// #![feature(box_vec_non_null)]
679680
///
@@ -682,7 +683,6 @@ impl<T> Vec<T> {
682683
///
683684
/// let v = vec![1, 2, 3];
684685
///
685-
// FIXME Update this when vec_into_raw_parts is stabilized
686686
/// // Prevent running `v`'s destructor so we are in complete control
687687
/// // of the allocation.
688688
/// let mut v = mem::ManuallyDrop::new(v);
@@ -994,6 +994,7 @@ impl<T, A: Allocator> Vec<T, A> {
994994
///
995995
/// # Examples
996996
///
997+
// FIXME Update this when vec_into_raw_parts is stabilized
997998
/// ```
998999
/// #![feature(allocator_api)]
9991000
///
@@ -1007,7 +1008,6 @@ impl<T, A: Allocator> Vec<T, A> {
10071008
/// v.push(2);
10081009
/// v.push(3);
10091010
///
1010-
// FIXME Update this when vec_into_raw_parts is stabilized
10111011
/// // Prevent running `v`'s destructor so we are in complete control
10121012
/// // of the allocation.
10131013
/// let mut v = mem::ManuallyDrop::new(v);
@@ -1114,6 +1114,7 @@ impl<T, A: Allocator> Vec<T, A> {
11141114
///
11151115
/// # Examples
11161116
///
1117+
// FIXME Update this when vec_into_raw_parts is stabilized
11171118
/// ```
11181119
/// #![feature(allocator_api, box_vec_non_null)]
11191120
///
@@ -1127,7 +1128,6 @@ impl<T, A: Allocator> Vec<T, A> {
11271128
/// v.push(2);
11281129
/// v.push(3);
11291130
///
1130-
// FIXME Update this when vec_into_raw_parts is stabilized
11311131
/// // Prevent running `v`'s destructor so we are in complete control
11321132
/// // of the allocation.
11331133
/// let mut v = mem::ManuallyDrop::new(v);
@@ -3872,8 +3872,8 @@ impl<T, A: Allocator> Vec<T, A> {
38723872
/// while i < vec.len() - end_items {
38733873
/// if some_predicate(&mut vec[i]) {
38743874
/// let val = vec.remove(i);
3875-
/// # extracted.push(val);
38763875
/// // your code here
3876+
/// # extracted.push(val);
38773877
/// } else {
38783878
/// i += 1;
38793879
/// }

library/core/src/array/equality.rs

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,16 @@ where
2222
{
2323
#[inline]
2424
fn eq(&self, other: &[U]) -> bool {
25-
let b: Result<&[U; N], _> = other.try_into();
26-
match b {
27-
Ok(b) => *self == *b,
28-
Err(_) => false,
25+
match other.as_array::<N>() {
26+
Some(b) => *self == *b,
27+
None => false,
2928
}
3029
}
3130
#[inline]
3231
fn ne(&self, other: &[U]) -> bool {
33-
let b: Result<&[U; N], _> = other.try_into();
34-
match b {
35-
Ok(b) => *self != *b,
36-
Err(_) => true,
32+
match other.as_array::<N>() {
33+
Some(b) => *self != *b,
34+
None => true,
3735
}
3836
}
3937
}
@@ -45,18 +43,16 @@ where
4543
{
4644
#[inline]
4745
fn eq(&self, other: &[U; N]) -> bool {
48-
let b: Result<&[T; N], _> = self.try_into();
49-
match b {
50-
Ok(b) => *b == *other,
51-
Err(_) => false,
46+
match self.as_array::<N>() {
47+
Some(b) => *b == *other,
48+
None => false,
5249
}
5350
}
5451
#[inline]
5552
fn ne(&self, other: &[U; N]) -> bool {
56-
let b: Result<&[T; N], _> = self.try_into();
57-
match b {
58-
Ok(b) => *b != *other,
59-
Err(_) => true,
53+
match self.as_array::<N>() {
54+
Some(b) => *b != *other,
55+
None => true,
6056
}
6157
}
6258
}

library/core/src/cell.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2068,9 +2068,9 @@ impl<T: ?Sized + fmt::Display> fmt::Display for RefMut<'_, T> {
20682068
/// implies exclusive access to its `T`:
20692069
///
20702070
/// ```rust
2071-
/// #![forbid(unsafe_code)] // with exclusive accesses,
2072-
/// // `UnsafeCell` is a transparent no-op wrapper,
2073-
/// // so no need for `unsafe` here.
2071+
/// #![forbid(unsafe_code)]
2072+
/// // with exclusive accesses, `UnsafeCell` is a transparent no-op wrapper, so no need for
2073+
/// // `unsafe` here.
20742074
/// use std::cell::UnsafeCell;
20752075
///
20762076
/// let mut x: UnsafeCell<i32> = 42.into();

library/core/src/cell/lazy.rs

Lines changed: 59 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,22 @@ enum State<T, F> {
1515
///
1616
/// [`std::sync::LazyLock`]: ../../std/sync/struct.LazyLock.html
1717
///
18+
/// # Poisoning
19+
///
20+
/// If the initialization closure passed to [`LazyCell::new`] panics, the cell will be poisoned.
21+
/// Once the cell is poisoned, any threads that attempt to access this cell (via a dereference
22+
/// or via an explicit call to [`force()`]) will panic.
23+
///
24+
/// This concept is similar to that of poisoning in the [`std::sync::poison`] module. A key
25+
/// difference, however, is that poisoning in `LazyCell` is _unrecoverable_. All future accesses of
26+
/// the cell from other threads will panic, whereas a type in [`std::sync::poison`] like
27+
/// [`std::sync::poison::Mutex`] allows recovery via [`PoisonError::into_inner()`].
28+
///
29+
/// [`force()`]: LazyCell::force
30+
/// [`std::sync::poison`]: ../../std/sync/poison/index.html
31+
/// [`std::sync::poison::Mutex`]: ../../std/sync/poison/struct.Mutex.html
32+
/// [`PoisonError::into_inner()`]: ../../std/sync/poison/struct.PoisonError.html#method.into_inner
33+
///
1834
/// # Examples
1935
///
2036
/// ```
@@ -64,6 +80,10 @@ impl<T, F: FnOnce() -> T> LazyCell<T, F> {
6480
///
6581
/// Returns `Ok(value)` if `Lazy` is initialized and `Err(f)` otherwise.
6682
///
83+
/// # Panics
84+
///
85+
/// Panics if the cell is poisoned.
86+
///
6787
/// # Examples
6888
///
6989
/// ```
@@ -93,6 +113,15 @@ impl<T, F: FnOnce() -> T> LazyCell<T, F> {
93113
///
94114
/// This is equivalent to the `Deref` impl, but is explicit.
95115
///
116+
/// # Panics
117+
///
118+
/// If the initialization closure panics (the one that is passed to the [`new()`] method), the
119+
/// panic is propagated to the caller, and the cell becomes poisoned. This will cause all future
120+
/// accesses of the cell (via [`force()`] or a dereference) to panic.
121+
///
122+
/// [`new()`]: LazyCell::new
123+
/// [`force()`]: LazyCell::force
124+
///
96125
/// # Examples
97126
///
98127
/// ```
@@ -123,6 +152,15 @@ impl<T, F: FnOnce() -> T> LazyCell<T, F> {
123152
/// Forces the evaluation of this lazy value and returns a mutable reference to
124153
/// the result.
125154
///
155+
/// # Panics
156+
///
157+
/// If the initialization closure panics (the one that is passed to the [`new()`] method), the
158+
/// panic is propagated to the caller, and the cell becomes poisoned. This will cause all future
159+
/// accesses of the cell (via [`force()`] or a dereference) to panic.
160+
///
161+
/// [`new()`]: LazyCell::new
162+
/// [`force()`]: LazyCell::force
163+
///
126164
/// # Examples
127165
///
128166
/// ```
@@ -219,7 +257,8 @@ impl<T, F: FnOnce() -> T> LazyCell<T, F> {
219257
}
220258

221259
impl<T, F> LazyCell<T, F> {
222-
/// Returns a mutable reference to the value if initialized, or `None` if not.
260+
/// Returns a mutable reference to the value if initialized. Otherwise (if uninitialized or
261+
/// poisoned), returns `None`.
223262
///
224263
/// # Examples
225264
///
@@ -245,7 +284,8 @@ impl<T, F> LazyCell<T, F> {
245284
}
246285
}
247286

248-
/// Returns a reference to the value if initialized, or `None` if not.
287+
/// Returns a reference to the value if initialized. Otherwise (if uninitialized or poisoned),
288+
/// returns `None`.
249289
///
250290
/// # Examples
251291
///
@@ -278,6 +318,15 @@ impl<T, F> LazyCell<T, F> {
278318
#[stable(feature = "lazy_cell", since = "1.80.0")]
279319
impl<T, F: FnOnce() -> T> Deref for LazyCell<T, F> {
280320
type Target = T;
321+
322+
/// # Panics
323+
///
324+
/// If the initialization closure panics (the one that is passed to the [`new()`] method), the
325+
/// panic is propagated to the caller, and the cell becomes poisoned. This will cause all future
326+
/// accesses of the cell (via [`force()`] or a dereference) to panic.
327+
///
328+
/// [`new()`]: LazyCell::new
329+
/// [`force()`]: LazyCell::force
281330
#[inline]
282331
fn deref(&self) -> &T {
283332
LazyCell::force(self)
@@ -286,6 +335,14 @@ impl<T, F: FnOnce() -> T> Deref for LazyCell<T, F> {
286335

287336
#[stable(feature = "lazy_deref_mut", since = "1.89.0")]
288337
impl<T, F: FnOnce() -> T> DerefMut for LazyCell<T, F> {
338+
/// # Panics
339+
///
340+
/// If the initialization closure panics (the one that is passed to the [`new()`] method), the
341+
/// panic is propagated to the caller, and the cell becomes poisoned. This will cause all future
342+
/// accesses of the cell (via [`force()`] or a dereference) to panic.
343+
///
344+
/// [`new()`]: LazyCell::new
345+
/// [`force()`]: LazyCell::force
289346
#[inline]
290347
fn deref_mut(&mut self) -> &mut T {
291348
LazyCell::force_mut(self)

library/core/src/hint.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -649,8 +649,6 @@ pub const fn must_use<T>(value: T) -> T {
649649
/// }
650650
/// }
651651
/// ```
652-
///
653-
///
654652
#[unstable(feature = "likely_unlikely", issue = "136873")]
655653
#[inline(always)]
656654
pub const fn likely(b: bool) -> bool {

library/core/src/iter/mod.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,10 +233,12 @@
233233
//!
234234
//! ```
235235
//! let mut values = vec![41];
236-
//! for x in &mut values { // same as `values.iter_mut()`
236+
//! for x in &mut values {
237+
//! // ^ same as `values.iter_mut()`
237238
//! *x += 1;
238239
//! }
239-
//! for x in &values { // same as `values.iter()`
240+
//! for x in &values {
241+
//! // ^ same as `values.iter()`
240242
//! assert_eq!(*x, 42);
241243
//! }
242244
//! assert_eq!(values.len(), 1);

library/core/src/iter/traits/iterator.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -811,7 +811,7 @@ pub trait Iterator {
811811
/// might be preferable to keep a functional style with longer iterators:
812812
///
813813
/// ```
814-
/// (0..5).flat_map(|x| x * 100 .. x * 110)
814+
/// (0..5).flat_map(|x| (x * 100)..(x * 110))
815815
/// .enumerate()
816816
/// .filter(|&(i, x)| (i + x) % 3 == 0)
817817
/// .for_each(|(i, x)| println!("{i}:{x}"));

0 commit comments

Comments
 (0)