Skip to content

Commit 3a087ad

Browse files
committed
Auto merge of #67670 - oli-obk:rollup-2dp08sd, r=oli-obk
Rollup of 15 pull requests Successful merges: - #65244 (add IntoFuture trait and support for await) - #67576 (reuse `capacity` variable in slice::repeat) - #67588 (Use NonNull in slice::Iter and slice::IterMut.) - #67594 (Update libc to 0.2.66) - #67602 (Use issue = "none" instead of "0" in intrinsics) - #67604 (Add Scalar::to_(u|i)16 methods) - #67617 (Remove `compiler_builtins_lib` documentation) - #67621 (Use the correct type for static qualifs) - #67629 (Remove redundant link texts) - #67632 (Convert collapsed to shortcut reference links) - #67633 (Update .mailmap) - #67635 (Document safety of Path casting) - #67654 (Add regression test for old NLL ICE) - #67659 (Stabilize the `matches!` macro) - #67664 (Fix some mailmap entries) Failed merges: r? @ghost
2 parents 74c4e6a + 65bbcf0 commit 3a087ad

File tree

46 files changed

+267
-174
lines changed

Some content is hidden

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

46 files changed

+267
-174
lines changed

.mailmap

+7-4
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,10 @@ Chris C Cerami <[email protected]> Chris C Cerami <chrisccer
5454
Chris Pressey <[email protected]>
5555
Chris Thorn <[email protected]> Chris Thorn <[email protected]>
5656
Chris Vittal <[email protected]> Christopher Vittal <[email protected]>
57-
58-
59-
57+
58+
59+
60+
6061
6162
Clinton Ryan <[email protected]>
6263
Corey Richardson <[email protected]> Elaine "See More" Nemo <[email protected]>
@@ -154,6 +155,7 @@ Lindsey Kuper <[email protected]> <[email protected]>
154155
Luke Metz <[email protected]>
155156
156157
158+
Manish Goregaokar <[email protected]>
157159
Marcell Pardavi <[email protected]>
158160
Margaret Meyerhofer <[email protected]> <mmeyerho@andrew>
159161
Mark Rousskov <[email protected]>
@@ -185,6 +187,7 @@ Neil Pankey <[email protected]> <[email protected]>
185187
Nick Platt <[email protected]>
186188
Nicole Mazzuca <[email protected]>
187189
190+
Nika Layzell <[email protected]>
188191
189192
190193
@@ -204,7 +207,6 @@ Paul Faria <[email protected]> Paul Faria <[email protected]>
204207
Peer Aramillo Irizar <[email protected]> parir <[email protected]>
205208
206209
Peter Liniker <[email protected]>
207-
Peter Zotov <[email protected]>
208210
Phil Dawes <[email protected]> Phil Dawes <[email protected]>
209211
Philipp Brüschweiler <[email protected]> <[email protected]>
210212
Philipp Brüschweiler <[email protected]> <[email protected]>
@@ -255,6 +257,7 @@ Ulrik Sverdrup <[email protected]> Ulrik Sverdrup <root@localhost>
255257
Vadim Petrochenkov <[email protected]>
256258
Vadim Petrochenkov <[email protected]> petrochenkov <[email protected]>
257259
Vitali Haravy <[email protected]> Vitali Haravy <[email protected]>
260+
whitequark <[email protected]>
258261
259262
Xuefeng Wu <[email protected]> Xuefeng Wu <[email protected]>
260263
Xuefeng Wu <[email protected]> XuefengWu <[email protected]>

CONTRIBUTING.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ labels to triage issues:
367367
to fix the issue.
368368

369369
* The dark blue **final-comment-period** label marks bugs that are using the
370-
RFC signoff functionality of [rfcbot][rfcbot] and are currently in the final
370+
RFC signoff functionality of [rfcbot] and are currently in the final
371371
comment period.
372372

373373
* Red, **I**-prefixed labels indicate the **importance** of the issue. The
@@ -385,7 +385,7 @@ labels to triage issues:
385385
label.
386386

387387
* The gray **proposed-final-comment-period** label marks bugs that are using
388-
the RFC signoff functionality of [rfcbot][rfcbot] and are currently awaiting
388+
the RFC signoff functionality of [rfcbot] and are currently awaiting
389389
signoff of all team members in order to enter the final comment period.
390390

391391
* Pink, **regression**-prefixed labels track regressions from stable to the

Cargo.lock

+2-2
Original file line numberDiff line numberDiff line change
@@ -1773,9 +1773,9 @@ checksum = "b294d6fa9ee409a054354afc4352b0b9ef7ca222c69b8812cbea9e7d2bf3783f"
17731773

17741774
[[package]]
17751775
name = "libc"
1776-
version = "0.2.64"
1776+
version = "0.2.66"
17771777
source = "registry+https://github.com/rust-lang/crates.io-index"
1778-
checksum = "74dfca3d9957906e8d1e6a0b641dc9a59848e793f1da2165889fd4f62d10d79c"
1778+
checksum = "d515b1f41455adea1313a4a2ac8a8a477634fbae63cc6100e3aebb207ce61558"
17791779
dependencies = [
17801780
"rustc-std-workspace-core",
17811781
]

RELEASES.md

+14-14
Original file line numberDiff line numberDiff line change
@@ -4951,10 +4951,10 @@ Stabilized APIs
49514951
---------------
49524952

49534953
* [`std::panic`]
4954-
* [`std::panic::catch_unwind`][] (renamed from `recover`)
4955-
* [`std::panic::resume_unwind`][] (renamed from `propagate`)
4956-
* [`std::panic::AssertUnwindSafe`][] (renamed from `AssertRecoverSafe`)
4957-
* [`std::panic::UnwindSafe`][] (renamed from `RecoverSafe`)
4954+
* [`std::panic::catch_unwind`] (renamed from `recover`)
4955+
* [`std::panic::resume_unwind`] (renamed from `propagate`)
4956+
* [`std::panic::AssertUnwindSafe`] (renamed from `AssertRecoverSafe`)
4957+
* [`std::panic::UnwindSafe`] (renamed from `RecoverSafe`)
49584958
* [`str::is_char_boundary`]
49594959
* [`<*const T>::as_ref`]
49604960
* [`<*mut T>::as_ref`]
@@ -5234,18 +5234,18 @@ Libraries
52345234
---------
52355235

52365236
* Stabilized APIs:
5237-
* [`str::encode_utf16`][] (renamed from `utf16_units`)
5238-
* [`str::EncodeUtf16`][] (renamed from `Utf16Units`)
5237+
* [`str::encode_utf16`] (renamed from `utf16_units`)
5238+
* [`str::EncodeUtf16`] (renamed from `Utf16Units`)
52395239
* [`Ref::map`]
52405240
* [`RefMut::map`]
52415241
* [`ptr::drop_in_place`]
52425242
* [`time::Instant`]
52435243
* [`time::SystemTime`]
52445244
* [`Instant::now`]
5245-
* [`Instant::duration_since`][] (renamed from `duration_from_earlier`)
5245+
* [`Instant::duration_since`] (renamed from `duration_from_earlier`)
52465246
* [`Instant::elapsed`]
52475247
* [`SystemTime::now`]
5248-
* [`SystemTime::duration_since`][] (renamed from `duration_from_earlier`)
5248+
* [`SystemTime::duration_since`] (renamed from `duration_from_earlier`)
52495249
* [`SystemTime::elapsed`]
52505250
* Various `Add`/`Sub` impls for `Time` and `SystemTime`
52515251
* [`SystemTimeError`]
@@ -5432,8 +5432,8 @@ Libraries
54325432

54335433
* Stabilized APIs
54345434
* `Path`
5435-
* [`Path::strip_prefix`][] (renamed from relative_from)
5436-
* [`path::StripPrefixError`][] (new error type returned from strip_prefix)
5435+
* [`Path::strip_prefix`] (renamed from relative_from)
5436+
* [`path::StripPrefixError`] (new error type returned from strip_prefix)
54375437
* `Ipv4Addr`
54385438
* [`Ipv4Addr::is_loopback`]
54395439
* [`Ipv4Addr::is_private`]
@@ -5646,7 +5646,7 @@ Libraries
56465646

56475647
* Stabilized APIs:
56485648
[`Read::read_exact`],
5649-
[`ErrorKind::UnexpectedEof`][] (renamed from `UnexpectedEOF`),
5649+
[`ErrorKind::UnexpectedEof`] (renamed from `UnexpectedEOF`),
56505650
[`fs::DirBuilder`], [`fs::DirBuilder::new`],
56515651
[`fs::DirBuilder::recursive`], [`fs::DirBuilder::create`],
56525652
[`os::unix::fs::DirBuilderExt`],
@@ -5659,11 +5659,11 @@ Libraries
56595659
[`collections::hash_set::HashSet::drain`],
56605660
[`collections::binary_heap::Drain`],
56615661
[`collections::binary_heap::BinaryHeap::drain`],
5662-
[`Vec::extend_from_slice`][] (renamed from `push_all`),
5662+
[`Vec::extend_from_slice`] (renamed from `push_all`),
56635663
[`Mutex::get_mut`], [`Mutex::into_inner`], [`RwLock::get_mut`],
56645664
[`RwLock::into_inner`],
5665-
[`Iterator::min_by_key`][] (renamed from `min_by`),
5666-
[`Iterator::max_by_key`][] (renamed from `max_by`).
5665+
[`Iterator::min_by_key`] (renamed from `min_by`),
5666+
[`Iterator::max_by_key`] (renamed from `max_by`).
56675667
* The [core library][1.6co] is stable, as are most of its APIs.
56685668
* [The `assert_eq!` macro supports arguments that don't implement
56695669
`Sized`][1.6ae], such as arrays. In this way it behaves more like

src/doc/unstable-book/src/language-features/lang-items.md

+1-5
Original file line numberDiff line numberDiff line change
@@ -188,11 +188,7 @@ pub extern fn rust_begin_panic(info: &PanicInfo) -> ! {
188188

189189
In many cases, you may need to manually link to the `compiler_builtins` crate
190190
when building a `no_std` binary. You may observe this via linker error messages
191-
such as "```undefined reference to `__rust_probestack'```". Using this crate
192-
also requires enabling the library feature `compiler_builtins_lib`. You can read
193-
more about this [here][compiler-builtins-lib].
194-
195-
[compiler-builtins-lib]: ../library-features/compiler-builtins-lib.md
191+
such as "```undefined reference to `__rust_probestack'```".
196192

197193
## More about the language items
198194

src/doc/unstable-book/src/library-features/compiler-builtins-lib.md

-35
This file was deleted.

src/liballoc/collections/binary_heap.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1094,7 +1094,7 @@ impl<T> FusedIterator for Iter<'_, T> {}
10941094

10951095
/// An owning iterator over the elements of a `BinaryHeap`.
10961096
///
1097-
/// This `struct` is created by the [`into_iter`] method on [`BinaryHeap`][`BinaryHeap`]
1097+
/// This `struct` is created by the [`into_iter`] method on [`BinaryHeap`]
10981098
/// (provided by the `IntoIterator` trait). See its documentation for more.
10991099
///
11001100
/// [`into_iter`]: struct.BinaryHeap.html#method.into_iter

src/liballoc/collections/btree/map.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ pub struct IterMut<'a, K: 'a, V: 'a> {
283283

284284
/// An owning iterator over the entries of a `BTreeMap`.
285285
///
286-
/// This `struct` is created by the [`into_iter`] method on [`BTreeMap`][`BTreeMap`]
286+
/// This `struct` is created by the [`into_iter`] method on [`BTreeMap`]
287287
/// (provided by the `IntoIterator` trait). See its documentation for more.
288288
///
289289
/// [`into_iter`]: struct.BTreeMap.html#method.into_iter

src/liballoc/collections/btree/set.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ impl<T: fmt::Debug> fmt::Debug for Iter<'_, T> {
8383

8484
/// An owning iterator over the items of a `BTreeSet`.
8585
///
86-
/// This `struct` is created by the [`into_iter`] method on [`BTreeSet`][`BTreeSet`]
86+
/// This `struct` is created by the [`into_iter`] method on [`BTreeSet`]
8787
/// (provided by the `IntoIterator` trait). See its documentation for more.
8888
///
8989
/// [`BTreeSet`]: struct.BTreeSet.html

src/liballoc/collections/linked_list.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ impl<T: fmt::Debug> fmt::Debug for IterMut<'_, T> {
105105

106106
/// An owning iterator over the elements of a `LinkedList`.
107107
///
108-
/// This `struct` is created by the [`into_iter`] method on [`LinkedList`][`LinkedList`]
108+
/// This `struct` is created by the [`into_iter`] method on [`LinkedList`]
109109
/// (provided by the `IntoIterator` trait). See its documentation for more.
110110
///
111111
/// [`into_iter`]: struct.LinkedList.html#method.into_iter

src/liballoc/collections/vec_deque.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2474,7 +2474,7 @@ impl<T> FusedIterator for IterMut<'_, T> {}
24742474

24752475
/// An owning iterator over the elements of a `VecDeque`.
24762476
///
2477-
/// This `struct` is created by the [`into_iter`] method on [`VecDeque`][`VecDeque`]
2477+
/// This `struct` is created by the [`into_iter`] method on [`VecDeque`]
24782478
/// (provided by the `IntoIterator` trait). See its documentation for more.
24792479
///
24802480
/// [`into_iter`]: struct.VecDeque.html#method.into_iter

src/liballoc/fmt.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@
330330
//!
331331
//! Additionally, the return value of this function is [`fmt::Result`] which is a
332332
//! type alias of [`Result`]`<(), `[`std::fmt::Error`]`>`. Formatting implementations
333-
//! should ensure that they propagate errors from the [`Formatter`][`Formatter`] (e.g., when
333+
//! should ensure that they propagate errors from the [`Formatter`] (e.g., when
334334
//! calling [`write!`]). However, they should never return errors spuriously. That
335335
//! is, a formatting implementation must and may only return an error if the
336336
//! passed-in [`Formatter`] returns an error. This is because, contrary to what

src/liballoc/slice.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,8 @@ impl<T> [T] {
450450
// and `rem` is the remaining part of `n`.
451451

452452
// Using `Vec` to access `set_len()`.
453-
let mut buf = Vec::with_capacity(self.len().checked_mul(n).expect("capacity overflow"));
453+
let capacity = self.len().checked_mul(n).expect("capacity overflow");
454+
let mut buf = Vec::with_capacity(capacity);
454455

455456
// `2^expn` repetition is done by doubling `buf` `expn`-times.
456457
buf.extend(self);
@@ -476,7 +477,7 @@ impl<T> [T] {
476477

477478
// `rem` (`= n - 2^expn`) repetition is done by copying
478479
// first `rem` repetitions from `buf` itself.
479-
let rem_len = self.len() * n - buf.len(); // `self.len() * rem`
480+
let rem_len = capacity - buf.len(); // `self.len() * rem`
480481
if rem_len > 0 {
481482
// `buf.extend(buf[0 .. rem_len])`:
482483
unsafe {
@@ -487,8 +488,7 @@ impl<T> [T] {
487488
rem_len,
488489
);
489490
// `buf.len() + rem_len` equals to `buf.capacity()` (`= self.len() * n`).
490-
let buf_cap = buf.capacity();
491-
buf.set_len(buf_cap);
491+
buf.set_len(capacity);
492492
}
493493
}
494494
buf

src/liballoc/vec.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ use crate::raw_vec::RawVec;
242242
/// ensures no unnecessary allocations or deallocations occur. Emptying a `Vec`
243243
/// and then filling it back up to the same [`len`] should incur no calls to
244244
/// the allocator. If you wish to free up unused memory, use
245-
/// [`shrink_to_fit`][`shrink_to_fit`].
245+
/// [`shrink_to_fit`].
246246
///
247247
/// [`push`] and [`insert`] will never (re)allocate if the reported capacity is
248248
/// sufficient. [`push`] and [`insert`] *will* (re)allocate if
@@ -2461,7 +2461,7 @@ where
24612461

24622462
/// An iterator that moves out of a vector.
24632463
///
2464-
/// This `struct` is created by the `into_iter` method on [`Vec`][`Vec`] (provided
2464+
/// This `struct` is created by the `into_iter` method on [`Vec`] (provided
24652465
/// by the [`IntoIterator`] trait).
24662466
///
24672467
/// [`Vec`]: struct.Vec.html

src/libcore/future/future.rs

+25
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,21 @@ pub trait Future {
9999
fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output>;
100100
}
101101

102+
/// Conversion into a `Future`.
103+
#[unstable(feature = "into_future", issue = "67644")]
104+
pub trait IntoFuture {
105+
/// The output that the future will produce on completion.
106+
#[unstable(feature = "into_future", issue = "67644")]
107+
type Output;
108+
/// Which kind of future are we turning this into?
109+
#[unstable(feature = "into_future", issue = "67644")]
110+
type Future: Future<Output = Self::Output>;
111+
112+
/// Creates a future from a value.
113+
#[unstable(feature = "into_future", issue = "67644")]
114+
fn into_future(self) -> Self::Future;
115+
}
116+
102117
#[stable(feature = "futures_api", since = "1.36.0")]
103118
impl<F: ?Sized + Future + Unpin> Future for &mut F {
104119
type Output = F::Output;
@@ -119,3 +134,13 @@ where
119134
Pin::get_mut(self).as_mut().poll(cx)
120135
}
121136
}
137+
138+
#[unstable(feature = "into_future", issue = "67644")]
139+
impl<F: Future> IntoFuture for F {
140+
type Output = F::Output;
141+
type Future = F;
142+
143+
fn into_future(self) -> Self::Future {
144+
self
145+
}
146+
}

src/libcore/future/mod.rs

+3
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,6 @@
55
mod future;
66
#[stable(feature = "futures_api", since = "1.36.0")]
77
pub use self::future::Future;
8+
9+
#[unstable(feature = "into_future", issue = "67644")]
10+
pub use self::future::IntoFuture;

src/libcore/intrinsics.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -697,7 +697,7 @@ extern "rust-intrinsic" {
697697

698698
#[rustc_const_stable(feature = "const_min_align_of", since = "1.40.0")]
699699
pub fn min_align_of<T>() -> usize;
700-
#[rustc_const_unstable(feature = "const_pref_align_of", issue = "0")]
700+
#[rustc_const_unstable(feature = "const_pref_align_of", issue = "none")]
701701
pub fn pref_align_of<T>() -> usize;
702702

703703
/// The size of the referenced value in bytes.
@@ -708,13 +708,13 @@ extern "rust-intrinsic" {
708708
pub fn min_align_of_val<T: ?Sized>(_: &T) -> usize;
709709

710710
/// Gets a static string slice containing the name of a type.
711-
#[rustc_const_unstable(feature = "const_type_name", issue = "0")]
711+
#[rustc_const_unstable(feature = "const_type_name", issue = "none")]
712712
pub fn type_name<T: ?Sized>() -> &'static str;
713713

714714
/// Gets an identifier which is globally unique to the specified type. This
715715
/// function will return the same value for a type regardless of whichever
716716
/// crate it is invoked in.
717-
#[rustc_const_unstable(feature = "const_type_id", issue = "0")]
717+
#[rustc_const_unstable(feature = "const_type_id", issue = "none")]
718718
pub fn type_id<T: ?Sized + 'static>() -> u64;
719719

720720
/// A guard for unsafe functions that cannot ever be executed if `T` is uninhabited:
@@ -1222,7 +1222,7 @@ extern "rust-intrinsic" {
12221222
/// let num_leading = unsafe { ctlz_nonzero(x) };
12231223
/// assert_eq!(num_leading, 3);
12241224
/// ```
1225-
#[rustc_const_unstable(feature = "constctlz", issue = "0")]
1225+
#[rustc_const_unstable(feature = "constctlz", issue = "none")]
12261226
pub fn ctlz_nonzero<T>(x: T) -> T;
12271227

12281228
/// Returns the number of trailing unset bits (zeroes) in an integer type `T`.
@@ -1267,7 +1267,7 @@ extern "rust-intrinsic" {
12671267
/// let num_trailing = unsafe { cttz_nonzero(x) };
12681268
/// assert_eq!(num_trailing, 3);
12691269
/// ```
1270-
#[rustc_const_unstable(feature = "const_cttz", issue = "0")]
1270+
#[rustc_const_unstable(feature = "const_cttz", issue = "none")]
12711271
pub fn cttz_nonzero<T>(x: T) -> T;
12721272

12731273
/// Reverses the bytes in an integer type `T`.
@@ -1396,7 +1396,7 @@ extern "rust-intrinsic" {
13961396
pub fn nontemporal_store<T>(ptr: *mut T, val: T);
13971397

13981398
/// See documentation of `<*const T>::offset_from` for details.
1399-
#[rustc_const_unstable(feature = "const_ptr_offset_from", issue = "0")]
1399+
#[rustc_const_unstable(feature = "const_ptr_offset_from", issue = "none")]
14001400
pub fn ptr_offset_from<T>(ptr: *const T, base: *const T) -> isize;
14011401

14021402
/// Internal hook used by Miri to implement unwinding.

0 commit comments

Comments
 (0)