Skip to content

Commit 966b3b9

Browse files
author
The Miri Cronjob Bot
committed
Merge from rustc
2 parents 150e700 + 9d16539 commit 966b3b9

File tree

52 files changed

+534
-548
lines changed

Some content is hidden

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

52 files changed

+534
-548
lines changed

compiler-builtins/compiler-builtins/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ links = "compiler-rt"
1919
bench = false
2020
doctest = false
2121
test = false
22+
# make sure this crate isn't included in public standard library docs
23+
doc = false
2224

2325
[dependencies]
2426
core = { path = "../../core", optional = true }

core/src/cmp.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ use crate::ops::ControlFlow;
248248
)]
249249
#[rustc_diagnostic_item = "PartialEq"]
250250
#[const_trait]
251-
#[rustc_const_unstable(feature = "const_trait_impl", issue = "67792")]
251+
#[rustc_const_unstable(feature = "const_cmp", issue = "143800")]
252252
pub trait PartialEq<Rhs: PointeeSized = Self>: PointeeSized {
253253
/// Tests for `self` and `other` values to be equal, and is used by `==`.
254254
#[must_use]
@@ -1809,7 +1809,7 @@ mod impls {
18091809
macro_rules! partial_eq_impl {
18101810
($($t:ty)*) => ($(
18111811
#[stable(feature = "rust1", since = "1.0.0")]
1812-
#[rustc_const_unstable(feature = "const_cmp", issue = "92391")]
1812+
#[rustc_const_unstable(feature = "const_cmp", issue = "143800")]
18131813
impl const PartialEq for $t {
18141814
#[inline]
18151815
fn eq(&self, other: &Self) -> bool { *self == *other }
@@ -2017,7 +2017,7 @@ mod impls {
20172017
// & pointers
20182018

20192019
#[stable(feature = "rust1", since = "1.0.0")]
2020-
#[rustc_const_unstable(feature = "const_cmp", issue = "92391")]
2020+
#[rustc_const_unstable(feature = "const_cmp", issue = "143800")]
20212021
impl<A: PointeeSized, B: PointeeSized> const PartialEq<&B> for &A
20222022
where
20232023
A: ~const PartialEq<B>,
@@ -2089,7 +2089,7 @@ mod impls {
20892089
// &mut pointers
20902090

20912091
#[stable(feature = "rust1", since = "1.0.0")]
2092-
#[rustc_const_unstable(feature = "const_cmp", issue = "92391")]
2092+
#[rustc_const_unstable(feature = "const_cmp", issue = "143800")]
20932093
impl<A: PointeeSized, B: PointeeSized> const PartialEq<&mut B> for &mut A
20942094
where
20952095
A: ~const PartialEq<B>,
@@ -2159,7 +2159,7 @@ mod impls {
21592159
impl<A: PointeeSized> Eq for &mut A where A: Eq {}
21602160

21612161
#[stable(feature = "rust1", since = "1.0.0")]
2162-
#[rustc_const_unstable(feature = "const_cmp", issue = "92391")]
2162+
#[rustc_const_unstable(feature = "const_cmp", issue = "143800")]
21632163
impl<A: PointeeSized, B: PointeeSized> const PartialEq<&mut B> for &A
21642164
where
21652165
A: ~const PartialEq<B>,
@@ -2175,7 +2175,7 @@ mod impls {
21752175
}
21762176

21772177
#[stable(feature = "rust1", since = "1.0.0")]
2178-
#[rustc_const_unstable(feature = "const_cmp", issue = "92391")]
2178+
#[rustc_const_unstable(feature = "const_cmp", issue = "143800")]
21792179
impl<A: PointeeSized, B: PointeeSized> const PartialEq<&B> for &mut A
21802180
where
21812181
A: ~const PartialEq<B>,

core/src/convert/mod.rs

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -445,6 +445,8 @@ pub trait AsMut<T: PointeeSized>: PointeeSized {
445445
#[rustc_diagnostic_item = "Into"]
446446
#[stable(feature = "rust1", since = "1.0.0")]
447447
#[doc(search_unbox)]
448+
#[rustc_const_unstable(feature = "const_from", issue = "143773")]
449+
#[const_trait]
448450
pub trait Into<T>: Sized {
449451
/// Converts this type into the (usually inferred) input type.
450452
#[must_use]
@@ -580,6 +582,8 @@ pub trait Into<T>: Sized {
580582
note = "to coerce a `{T}` into a `{Self}`, use `&*` as a prefix",
581583
))]
582584
#[doc(search_unbox)]
585+
#[rustc_const_unstable(feature = "const_from", issue = "143773")]
586+
#[const_trait]
583587
pub trait From<T>: Sized {
584588
/// Converts to this type from the input type.
585589
#[rustc_diagnostic_item = "from_fn"]
@@ -607,6 +611,8 @@ pub trait From<T>: Sized {
607611
/// [`Into`], see there for details.
608612
#[rustc_diagnostic_item = "TryInto"]
609613
#[stable(feature = "try_from", since = "1.34.0")]
614+
#[rustc_const_unstable(feature = "const_from", issue = "143773")]
615+
#[const_trait]
610616
pub trait TryInto<T>: Sized {
611617
/// The type returned in the event of a conversion error.
612618
#[stable(feature = "try_from", since = "1.34.0")]
@@ -685,6 +691,8 @@ pub trait TryInto<T>: Sized {
685691
/// [`try_from`]: TryFrom::try_from
686692
#[rustc_diagnostic_item = "TryFrom"]
687693
#[stable(feature = "try_from", since = "1.34.0")]
694+
#[rustc_const_unstable(feature = "const_from", issue = "143773")]
695+
#[const_trait]
688696
pub trait TryFrom<T>: Sized {
689697
/// The type returned in the event of a conversion error.
690698
#[stable(feature = "try_from", since = "1.34.0")]
@@ -754,9 +762,10 @@ where
754762

755763
// From implies Into
756764
#[stable(feature = "rust1", since = "1.0.0")]
757-
impl<T, U> Into<U> for T
765+
#[rustc_const_unstable(feature = "const_from", issue = "143773")]
766+
impl<T, U> const Into<U> for T
758767
where
759-
U: From<T>,
768+
U: ~const From<T>,
760769
{
761770
/// Calls `U::from(self)`.
762771
///
@@ -771,7 +780,8 @@ where
771780

772781
// From (and thus Into) is reflexive
773782
#[stable(feature = "rust1", since = "1.0.0")]
774-
impl<T> From<T> for T {
783+
#[rustc_const_unstable(feature = "const_from", issue = "143773")]
784+
impl<T> const From<T> for T {
775785
/// Returns the argument unchanged.
776786
#[inline(always)]
777787
fn from(t: T) -> T {
@@ -787,17 +797,19 @@ impl<T> From<T> for T {
787797
#[stable(feature = "convert_infallible", since = "1.34.0")]
788798
#[rustc_reservation_impl = "permitting this impl would forbid us from adding \
789799
`impl<T> From<!> for T` later; see rust-lang/rust#64715 for details"]
790-
impl<T> From<!> for T {
800+
#[rustc_const_unstable(feature = "const_from", issue = "143773")]
801+
impl<T> const From<!> for T {
791802
fn from(t: !) -> T {
792803
t
793804
}
794805
}
795806

796807
// TryFrom implies TryInto
797808
#[stable(feature = "try_from", since = "1.34.0")]
798-
impl<T, U> TryInto<U> for T
809+
#[rustc_const_unstable(feature = "const_from", issue = "143773")]
810+
impl<T, U> const TryInto<U> for T
799811
where
800-
U: TryFrom<T>,
812+
U: ~const TryFrom<T>,
801813
{
802814
type Error = U::Error;
803815

@@ -810,9 +822,10 @@ where
810822
// Infallible conversions are semantically equivalent to fallible conversions
811823
// with an uninhabited error type.
812824
#[stable(feature = "try_from", since = "1.34.0")]
813-
impl<T, U> TryFrom<U> for T
825+
#[rustc_const_unstable(feature = "const_from", issue = "143773")]
826+
impl<T, U> const TryFrom<U> for T
814827
where
815-
U: Into<T>,
828+
U: ~const Into<T>,
816829
{
817830
type Error = Infallible;
818831

core/src/macros/mod.rs

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -230,32 +230,16 @@ pub macro assert_matches {
230230
/// ```
231231
/// #![feature(cfg_select)]
232232
///
233-
/// let _some_string = cfg_select! {{
233+
/// let _some_string = cfg_select! {
234234
/// unix => { "With great power comes great electricity bills" }
235235
/// _ => { "Behind every successful diet is an unwatched pizza" }
236-
/// }};
236+
/// };
237237
/// ```
238238
#[unstable(feature = "cfg_select", issue = "115585")]
239239
#[rustc_diagnostic_item = "cfg_select"]
240-
#[rustc_macro_transparency = "semitransparent"]
241-
pub macro cfg_select {
242-
({ $($tt:tt)* }) => {{
243-
$crate::cfg_select! { $($tt)* }
244-
}},
245-
(_ => { $($output:tt)* }) => {
246-
$($output)*
247-
},
248-
(
249-
$cfg:meta => $output:tt
250-
$($( $rest:tt )+)?
251-
) => {
252-
#[cfg($cfg)]
253-
$crate::cfg_select! { _ => $output }
254-
$(
255-
#[cfg(not($cfg))]
256-
$crate::cfg_select! { $($rest)+ }
257-
)?
258-
},
240+
#[rustc_builtin_macro]
241+
pub macro cfg_select($($tt:tt)*) {
242+
/* compiler built-in */
259243
}
260244

261245
/// Asserts that a boolean expression is `true` at runtime.

core/src/mem/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ pub const fn forget<T>(t: T) {
151151
///
152152
/// While Rust does not permit unsized locals since its removal in [#111942] it is
153153
/// still possible to call functions with unsized values from a function argument
154-
/// or in-place construction.
154+
/// or place expression.
155155
///
156156
/// ```rust
157157
/// #![feature(unsized_fn_params, forget_unsized)]

core/src/num/error.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,11 @@ impl From<!> for TryFromIntError {
4545

4646
/// An error which can be returned when parsing an integer.
4747
///
48-
/// This error is used as the error type for the `from_str_radix()` functions
49-
/// on the primitive integer types, such as [`i8::from_str_radix`].
48+
/// For example, this error is returned by the `from_str_radix()` functions
49+
/// on the primitive integer types (such as [`i8::from_str_radix`])
50+
/// and is used as the error type in their [`FromStr`] implementations.
51+
///
52+
/// [`FromStr`]: crate::str::FromStr
5053
///
5154
/// # Potential causes
5255
///

core/src/ops/arith.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
/// ```
6666
#[lang = "add"]
6767
#[stable(feature = "rust1", since = "1.0.0")]
68-
#[rustc_const_unstable(feature = "const_ops", issue = "90080")]
68+
#[rustc_const_unstable(feature = "const_ops", issue = "143802")]
6969
#[rustc_on_unimplemented(
7070
on(all(Self = "{integer}", Rhs = "{float}"), message = "cannot add a float to an integer",),
7171
on(all(Self = "{float}", Rhs = "{integer}"), message = "cannot add an integer to a float",),
@@ -96,7 +96,7 @@ pub trait Add<Rhs = Self> {
9696
macro_rules! add_impl {
9797
($($t:ty)*) => ($(
9898
#[stable(feature = "rust1", since = "1.0.0")]
99-
#[rustc_const_unstable(feature = "const_ops", issue = "90080")]
99+
#[rustc_const_unstable(feature = "const_ops", issue = "143802")]
100100
impl const Add for $t {
101101
type Output = $t;
102102

@@ -179,7 +179,7 @@ add_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f16 f32 f64 f128
179179
/// ```
180180
#[lang = "sub"]
181181
#[stable(feature = "rust1", since = "1.0.0")]
182-
#[rustc_const_unstable(feature = "const_ops", issue = "90080")]
182+
#[rustc_const_unstable(feature = "const_ops", issue = "143802")]
183183
#[rustc_on_unimplemented(
184184
message = "cannot subtract `{Rhs}` from `{Self}`",
185185
label = "no implementation for `{Self} - {Rhs}`",
@@ -208,7 +208,7 @@ pub trait Sub<Rhs = Self> {
208208
macro_rules! sub_impl {
209209
($($t:ty)*) => ($(
210210
#[stable(feature = "rust1", since = "1.0.0")]
211-
#[rustc_const_unstable(feature = "const_ops", issue = "90080")]
211+
#[rustc_const_unstable(feature = "const_ops", issue = "143802")]
212212
impl const Sub for $t {
213213
type Output = $t;
214214

@@ -313,7 +313,7 @@ sub_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f16 f32 f64 f128
313313
/// ```
314314
#[lang = "mul"]
315315
#[stable(feature = "rust1", since = "1.0.0")]
316-
#[rustc_const_unstable(feature = "const_ops", issue = "90080")]
316+
#[rustc_const_unstable(feature = "const_ops", issue = "143802")]
317317
#[diagnostic::on_unimplemented(
318318
message = "cannot multiply `{Self}` by `{Rhs}`",
319319
label = "no implementation for `{Self} * {Rhs}`"
@@ -341,7 +341,7 @@ pub trait Mul<Rhs = Self> {
341341
macro_rules! mul_impl {
342342
($($t:ty)*) => ($(
343343
#[stable(feature = "rust1", since = "1.0.0")]
344-
#[rustc_const_unstable(feature = "const_ops", issue = "90080")]
344+
#[rustc_const_unstable(feature = "const_ops", issue = "143802")]
345345
impl const Mul for $t {
346346
type Output = $t;
347347

@@ -450,7 +450,7 @@ mul_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f16 f32 f64 f128
450450
/// ```
451451
#[lang = "div"]
452452
#[stable(feature = "rust1", since = "1.0.0")]
453-
#[rustc_const_unstable(feature = "const_ops", issue = "90080")]
453+
#[rustc_const_unstable(feature = "const_ops", issue = "143802")]
454454
#[diagnostic::on_unimplemented(
455455
message = "cannot divide `{Self}` by `{Rhs}`",
456456
label = "no implementation for `{Self} / {Rhs}`"
@@ -484,7 +484,7 @@ macro_rules! div_impl_integer {
484484
///
485485
#[doc = $panic]
486486
#[stable(feature = "rust1", since = "1.0.0")]
487-
#[rustc_const_unstable(feature = "const_ops", issue = "90080")]
487+
#[rustc_const_unstable(feature = "const_ops", issue = "143802")]
488488
impl const Div for $t {
489489
type Output = $t;
490490

@@ -505,7 +505,7 @@ div_impl_integer! {
505505
macro_rules! div_impl_float {
506506
($($t:ty)*) => ($(
507507
#[stable(feature = "rust1", since = "1.0.0")]
508-
#[rustc_const_unstable(feature = "const_ops", issue = "90080")]
508+
#[rustc_const_unstable(feature = "const_ops", issue = "143802")]
509509
impl const Div for $t {
510510
type Output = $t;
511511

@@ -556,7 +556,7 @@ div_impl_float! { f16 f32 f64 f128 }
556556
/// ```
557557
#[lang = "rem"]
558558
#[stable(feature = "rust1", since = "1.0.0")]
559-
#[rustc_const_unstable(feature = "const_ops", issue = "90080")]
559+
#[rustc_const_unstable(feature = "const_ops", issue = "143802")]
560560
#[diagnostic::on_unimplemented(
561561
message = "cannot calculate the remainder of `{Self}` divided by `{Rhs}`",
562562
label = "no implementation for `{Self} % {Rhs}`"
@@ -590,7 +590,7 @@ macro_rules! rem_impl_integer {
590590
///
591591
#[doc = $panic]
592592
#[stable(feature = "rust1", since = "1.0.0")]
593-
#[rustc_const_unstable(feature = "const_ops", issue = "90080")]
593+
#[rustc_const_unstable(feature = "const_ops", issue = "143802")]
594594
impl const Rem for $t {
595595
type Output = $t;
596596

@@ -626,7 +626,7 @@ macro_rules! rem_impl_float {
626626
/// assert_eq!(x % y, remainder);
627627
/// ```
628628
#[stable(feature = "rust1", since = "1.0.0")]
629-
#[rustc_const_unstable(feature = "const_ops", issue = "90080")]
629+
#[rustc_const_unstable(feature = "const_ops", issue = "143802")]
630630
impl const Rem for $t {
631631
type Output = $t;
632632

core/src/slice/mod.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3700,7 +3700,8 @@ impl<T> [T] {
37003700
/// assert_eq!(a, ['a', 'c', 'd', 'e', 'b', 'f']);
37013701
/// ```
37023702
#[stable(feature = "slice_rotate", since = "1.26.0")]
3703-
pub fn rotate_left(&mut self, mid: usize) {
3703+
#[rustc_const_unstable(feature = "const_slice_rotate", issue = "143812")]
3704+
pub const fn rotate_left(&mut self, mid: usize) {
37043705
assert!(mid <= self.len());
37053706
let k = self.len() - mid;
37063707
let p = self.as_mut_ptr();
@@ -3745,7 +3746,8 @@ impl<T> [T] {
37453746
/// assert_eq!(a, ['a', 'e', 'b', 'c', 'd', 'f']);
37463747
/// ```
37473748
#[stable(feature = "slice_rotate", since = "1.26.0")]
3748-
pub fn rotate_right(&mut self, k: usize) {
3749+
#[rustc_const_unstable(feature = "const_slice_rotate", issue = "143812")]
3750+
pub const fn rotate_right(&mut self, k: usize) {
37493751
assert!(k <= self.len());
37503752
let mid = self.len() - k;
37513753
let p = self.as_mut_ptr();

0 commit comments

Comments
 (0)