Skip to content

Commit 3f97f2c

Browse files
committed
Auto merge of rust-lang#118661 - fee1-dead-contrib:restore-const-partialEq, r=compiler-errors
Restore `const PartialEq` And thus fixes a number of tests. There is a bug that still needs to be fixed, so WIP for now. r? `@compiler-errors`
2 parents fbf4b9a + 5e35bce commit 3f97f2c

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

core/src/cmp.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@ use self::Ordering::*;
224224
append_const_msg
225225
)]
226226
#[rustc_diagnostic_item = "PartialEq"]
227+
#[cfg_attr(not(bootstrap), const_trait)]
227228
pub trait PartialEq<Rhs: ?Sized = Self> {
228229
/// This method tests for `self` and `other` values to be equal, and is used
229230
/// by `==`.
@@ -1414,12 +1415,23 @@ mod impls {
14141415
macro_rules! partial_eq_impl {
14151416
($($t:ty)*) => ($(
14161417
#[stable(feature = "rust1", since = "1.0.0")]
1418+
#[cfg(bootstrap)]
14171419
impl PartialEq for $t {
14181420
#[inline]
14191421
fn eq(&self, other: &$t) -> bool { (*self) == (*other) }
14201422
#[inline]
14211423
fn ne(&self, other: &$t) -> bool { (*self) != (*other) }
14221424
}
1425+
1426+
#[stable(feature = "rust1", since = "1.0.0")]
1427+
#[rustc_const_unstable(feature = "const_cmp", issue = "92391")]
1428+
#[cfg(not(bootstrap))]
1429+
impl const PartialEq for $t {
1430+
#[inline]
1431+
fn eq(&self, other: &$t) -> bool { (*self) == (*other) }
1432+
#[inline]
1433+
fn ne(&self, other: &$t) -> bool { (*self) != (*other) }
1434+
}
14231435
)*)
14241436
}
14251437

0 commit comments

Comments
 (0)