Skip to content

Commit 2156fdf

Browse files
committed
Merge ref 'a09fbe2c8372' from rust-lang/rust
Pull recent changes from https://github.com/rust-lang/rust via Josh. Upstream ref: a09fbe2 Filtered ref: e8da14f32630072c76aeb944454175f4d8266918 This merge was created using https://github.com/rust-lang/josh-sync.
2 parents fd92a87 + 8a31576 commit 2156fdf

Some content is hidden

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

63 files changed

+1944
-542
lines changed

Cargo.lock

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

core/src/borrow.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -154,9 +154,8 @@
154154
/// [`String`]: ../../std/string/struct.String.html
155155
#[stable(feature = "rust1", since = "1.0.0")]
156156
#[rustc_diagnostic_item = "Borrow"]
157-
#[const_trait]
158157
#[rustc_const_unstable(feature = "const_convert", issue = "143773")]
159-
pub trait Borrow<Borrowed: ?Sized> {
158+
pub const trait Borrow<Borrowed: ?Sized> {
160159
/// Immutably borrows from an owned value.
161160
///
162161
/// # Examples
@@ -187,9 +186,8 @@ pub trait Borrow<Borrowed: ?Sized> {
187186
/// for more information on borrowing as another type.
188187
#[stable(feature = "rust1", since = "1.0.0")]
189188
#[rustc_diagnostic_item = "BorrowMut"]
190-
#[const_trait]
191189
#[rustc_const_unstable(feature = "const_convert", issue = "143773")]
192-
pub trait BorrowMut<Borrowed: ?Sized>: Borrow<Borrowed> {
190+
pub const trait BorrowMut<Borrowed: ?Sized>: Borrow<Borrowed> {
193191
/// Mutably borrows from an owned value.
194192
///
195193
/// # Examples

core/src/clone.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,7 @@ mod uninit;
191191
#[rustc_diagnostic_item = "Clone"]
192192
#[rustc_trivial_field_reads]
193193
#[rustc_const_unstable(feature = "const_clone", issue = "142757")]
194-
#[const_trait]
195-
pub trait Clone: Sized {
194+
pub const trait Clone: Sized {
196195
/// Returns a duplicate of the value.
197196
///
198197
/// Note that what "duplicate" means varies by type:

core/src/cmp.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,9 +247,8 @@ use crate::ops::ControlFlow;
247247
append_const_msg
248248
)]
249249
#[rustc_diagnostic_item = "PartialEq"]
250-
#[const_trait]
251250
#[rustc_const_unstable(feature = "const_cmp", issue = "143800")]
252-
pub trait PartialEq<Rhs: PointeeSized = Self>: PointeeSized {
251+
pub const trait PartialEq<Rhs: PointeeSized = Self>: PointeeSized {
253252
/// Tests for `self` and `other` values to be equal, and is used by `==`.
254253
#[must_use]
255254
#[stable(feature = "rust1", since = "1.0.0")]

core/src/cmp/bytewise.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use crate::num::NonZero;
1717
/// - Neither `Self` nor `Rhs` have provenance, so integer comparisons are correct.
1818
/// - `<Self as PartialEq<Rhs>>::{eq,ne}` are equivalent to comparing the bytes.
1919
#[rustc_specialization_trait]
20-
#[const_trait]
20+
#[const_trait] // FIXME(const_trait_impl): Migrate to `const unsafe trait` once #146122 is fixed.
2121
pub(crate) unsafe trait BytewiseEq<Rhs = Self>:
2222
[const] PartialEq<Rhs> + Sized
2323
{

core/src/convert/mod.rs

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -216,9 +216,8 @@ pub const fn identity<T>(x: T) -> T {
216216
/// ```
217217
#[stable(feature = "rust1", since = "1.0.0")]
218218
#[rustc_diagnostic_item = "AsRef"]
219-
#[const_trait]
220219
#[rustc_const_unstable(feature = "const_convert", issue = "143773")]
221-
pub trait AsRef<T: PointeeSized>: PointeeSized {
220+
pub const trait AsRef<T: PointeeSized>: PointeeSized {
222221
/// Converts this type into a shared reference of the (usually inferred) input type.
223222
#[stable(feature = "rust1", since = "1.0.0")]
224223
fn as_ref(&self) -> &T;
@@ -369,9 +368,8 @@ pub trait AsRef<T: PointeeSized>: PointeeSized {
369368
/// `&mut Vec<u8>`, for example, is the better choice (callers need to pass the correct type then).
370369
#[stable(feature = "rust1", since = "1.0.0")]
371370
#[rustc_diagnostic_item = "AsMut"]
372-
#[const_trait]
373371
#[rustc_const_unstable(feature = "const_convert", issue = "143773")]
374-
pub trait AsMut<T: PointeeSized>: PointeeSized {
372+
pub const trait AsMut<T: PointeeSized>: PointeeSized {
375373
/// Converts this type into a mutable reference of the (usually inferred) input type.
376374
#[stable(feature = "rust1", since = "1.0.0")]
377375
fn as_mut(&mut self) -> &mut T;
@@ -450,8 +448,7 @@ pub trait AsMut<T: PointeeSized>: PointeeSized {
450448
#[stable(feature = "rust1", since = "1.0.0")]
451449
#[doc(search_unbox)]
452450
#[rustc_const_unstable(feature = "const_convert", issue = "143773")]
453-
#[const_trait]
454-
pub trait Into<T>: Sized {
451+
pub const trait Into<T>: Sized {
455452
/// Converts this type into the (usually inferred) input type.
456453
#[must_use]
457454
#[stable(feature = "rust1", since = "1.0.0")]
@@ -587,8 +584,7 @@ pub trait Into<T>: Sized {
587584
))]
588585
#[doc(search_unbox)]
589586
#[rustc_const_unstable(feature = "const_convert", issue = "143773")]
590-
#[const_trait]
591-
pub trait From<T>: Sized {
587+
pub const trait From<T>: Sized {
592588
/// Converts to this type from the input type.
593589
#[rustc_diagnostic_item = "from_fn"]
594590
#[must_use]
@@ -616,8 +612,7 @@ pub trait From<T>: Sized {
616612
#[rustc_diagnostic_item = "TryInto"]
617613
#[stable(feature = "try_from", since = "1.34.0")]
618614
#[rustc_const_unstable(feature = "const_convert", issue = "143773")]
619-
#[const_trait]
620-
pub trait TryInto<T>: Sized {
615+
pub const trait TryInto<T>: Sized {
621616
/// The type returned in the event of a conversion error.
622617
#[stable(feature = "try_from", since = "1.34.0")]
623618
type Error;
@@ -696,8 +691,7 @@ pub trait TryInto<T>: Sized {
696691
#[rustc_diagnostic_item = "TryFrom"]
697692
#[stable(feature = "try_from", since = "1.34.0")]
698693
#[rustc_const_unstable(feature = "const_convert", issue = "143773")]
699-
#[const_trait]
700-
pub trait TryFrom<T>: Sized {
694+
pub const trait TryFrom<T>: Sized {
701695
/// The type returned in the event of a conversion error.
702696
#[stable(feature = "try_from", since = "1.34.0")]
703697
type Error;

core/src/default.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,8 @@ use crate::ascii::Char as AsciiChar;
103103
/// ```
104104
#[rustc_diagnostic_item = "Default"]
105105
#[stable(feature = "rust1", since = "1.0.0")]
106-
#[const_trait]
107106
#[rustc_const_unstable(feature = "const_default", issue = "143894")]
108-
pub trait Default: Sized {
107+
pub const trait Default: Sized {
109108
/// Returns the "default value" for a type.
110109
///
111110
/// Default values are often some kind of initial value, identity value, or anything else that

0 commit comments

Comments
 (0)