Skip to content

New tracking issues for const_ops and const_cmp #143803

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions library/core/src/cmp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ use crate::ops::ControlFlow;
)]
#[rustc_diagnostic_item = "PartialEq"]
#[const_trait]
#[rustc_const_unstable(feature = "const_trait_impl", issue = "67792")]
#[rustc_const_unstable(feature = "const_cmp", issue = "143800")]
pub trait PartialEq<Rhs: PointeeSized = Self>: PointeeSized {
/// Tests for `self` and `other` values to be equal, and is used by `==`.
#[must_use]
Expand Down Expand Up @@ -1809,7 +1809,7 @@ mod impls {
macro_rules! partial_eq_impl {
($($t:ty)*) => ($(
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_const_unstable(feature = "const_cmp", issue = "92391")]
#[rustc_const_unstable(feature = "const_cmp", issue = "143800")]
impl const PartialEq for $t {
#[inline]
fn eq(&self, other: &Self) -> bool { *self == *other }
Expand Down Expand Up @@ -2017,7 +2017,7 @@ mod impls {
// & pointers

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

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

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

#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_const_unstable(feature = "const_cmp", issue = "92391")]
#[rustc_const_unstable(feature = "const_cmp", issue = "143800")]
impl<A: PointeeSized, B: PointeeSized> const PartialEq<&B> for &mut A
where
A: ~const PartialEq<B>,
Expand Down
24 changes: 12 additions & 12 deletions library/core/src/ops/arith.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
/// ```
#[lang = "add"]
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_const_unstable(feature = "const_ops", issue = "90080")]
#[rustc_const_unstable(feature = "const_ops", issue = "143802")]
#[rustc_on_unimplemented(
on(all(Self = "{integer}", Rhs = "{float}"), message = "cannot add a float to an integer",),
on(all(Self = "{float}", Rhs = "{integer}"), message = "cannot add an integer to a float",),
Expand Down Expand Up @@ -96,7 +96,7 @@ pub trait Add<Rhs = Self> {
macro_rules! add_impl {
($($t:ty)*) => ($(
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_const_unstable(feature = "const_ops", issue = "90080")]
#[rustc_const_unstable(feature = "const_ops", issue = "143802")]
impl const Add for $t {
type Output = $t;

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

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

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

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

Expand Down Expand Up @@ -556,7 +556,7 @@ div_impl_float! { f16 f32 f64 f128 }
/// ```
#[lang = "rem"]
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_const_unstable(feature = "const_ops", issue = "90080")]
#[rustc_const_unstable(feature = "const_ops", issue = "143802")]
#[diagnostic::on_unimplemented(
message = "cannot calculate the remainder of `{Self}` divided by `{Rhs}`",
label = "no implementation for `{Self} % {Rhs}`"
Expand Down Expand Up @@ -590,7 +590,7 @@ macro_rules! rem_impl_integer {
///
#[doc = $panic]
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_const_unstable(feature = "const_ops", issue = "90080")]
#[rustc_const_unstable(feature = "const_ops", issue = "143802")]
impl const Rem for $t {
type Output = $t;

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

Expand Down
2 changes: 1 addition & 1 deletion tests/ui/const-generics/issues/issue-90318.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#![feature(const_type_id)]
#![feature(generic_const_exprs)]
#![feature(const_trait_impl)]
#![feature(const_trait_impl, const_cmp)]
#![feature(core_intrinsics)]
#![allow(incomplete_features)]

Expand Down
2 changes: 1 addition & 1 deletion tests/ui/consts/const_cmp_type_id.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//@ compile-flags: -Znext-solver
#![feature(const_type_id, const_trait_impl)]
#![feature(const_type_id, const_trait_impl, const_cmp)]

use std::any::TypeId;

Expand Down
2 changes: 1 addition & 1 deletion tests/ui/consts/const_transmute_type_id.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![feature(const_type_id, const_trait_impl)]
#![feature(const_type_id, const_trait_impl, const_cmp)]

use std::any::TypeId;

Expand Down
2 changes: 1 addition & 1 deletion tests/ui/consts/const_transmute_type_id2.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//@ normalize-stderr: "0x(ff)+" -> "<u128::MAX>"

#![feature(const_type_id, const_trait_impl)]
#![feature(const_type_id, const_trait_impl, const_cmp)]

use std::any::TypeId;

Expand Down
2 changes: 1 addition & 1 deletion tests/ui/consts/const_transmute_type_id3.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![feature(const_type_id, const_trait_impl)]
#![feature(const_type_id, const_trait_impl, const_cmp)]

use std::any::TypeId;

Expand Down
2 changes: 1 addition & 1 deletion tests/ui/consts/const_transmute_type_id4.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![feature(const_type_id, const_trait_impl)]
#![feature(const_type_id, const_trait_impl, const_cmp)]

use std::any::TypeId;

Expand Down
1 change: 1 addition & 0 deletions tests/ui/consts/issue-73976-monomorphic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#![feature(const_type_id)]
#![feature(const_type_name)]
#![feature(const_trait_impl)]
#![feature(const_cmp)]

use std::any::{self, TypeId};

Expand Down
6 changes: 3 additions & 3 deletions tests/ui/consts/issue-90870.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
#![allow(dead_code)]

const fn f(a: &u8, b: &u8) -> bool {
//~^ HELP: add `#![feature(const_trait_impl)]` to the crate attributes to enable
//~| HELP: add `#![feature(const_trait_impl)]` to the crate attributes to enable
//~| HELP: add `#![feature(const_trait_impl)]` to the crate attributes to enable
//~^ HELP: add `#![feature(const_cmp)]` to the crate attributes to enable
//~| HELP: add `#![feature(const_cmp)]` to the crate attributes to enable
//~| HELP: add `#![feature(const_cmp)]` to the crate attributes to enable
a == b
//~^ ERROR: cannot call conditionally-const operator in constant functions
//~| ERROR: `PartialEq` is not yet stable as a const trait
Expand Down
12 changes: 6 additions & 6 deletions tests/ui/consts/issue-90870.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ error: `PartialEq` is not yet stable as a const trait
LL | a == b
| ^^^^^^
|
help: add `#![feature(const_trait_impl)]` to the crate attributes to enable
help: add `#![feature(const_cmp)]` to the crate attributes to enable
|
LL + #![feature(const_trait_impl)]
LL + #![feature(const_cmp)]
|

error[E0658]: cannot call conditionally-const operator in constant functions
Expand All @@ -45,9 +45,9 @@ error: `PartialEq` is not yet stable as a const trait
LL | a == b
| ^^^^^^
|
help: add `#![feature(const_trait_impl)]` to the crate attributes to enable
help: add `#![feature(const_cmp)]` to the crate attributes to enable
|
LL + #![feature(const_trait_impl)]
LL + #![feature(const_cmp)]
|

error[E0658]: cannot call conditionally-const operator in constant functions
Expand All @@ -71,9 +71,9 @@ error: `PartialEq` is not yet stable as a const trait
LL | if l == r {
| ^^^^^^
|
help: add `#![feature(const_trait_impl)]` to the crate attributes to enable
help: add `#![feature(const_cmp)]` to the crate attributes to enable
|
LL + #![feature(const_trait_impl)]
LL + #![feature(const_cmp)]
|

error: aborting due to 6 previous errors
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![feature(const_trait_impl, const_ops)]
#![feature(const_trait_impl, const_ops, const_cmp)]
//@ check-pass

struct Int(i32);
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/traits/const-traits/call-generic-in-impl.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//@ check-pass
#![feature(const_trait_impl)]
#![feature(const_trait_impl, const_cmp)]

#[const_trait]
trait MyPartialEq {
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/traits/const-traits/call-generic-method-chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
//@ compile-flags: -Znext-solver
//@ check-pass

#![feature(const_trait_impl)]
#![feature(const_trait_impl, const_cmp)]

struct S;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//@ compile-flags: -Znext-solver
//@ check-pass

#![feature(const_trait_impl)]
#![feature(const_trait_impl, const_cmp)]

struct S;

Expand Down
2 changes: 1 addition & 1 deletion tests/ui/traits/const-traits/call-generic-method-fail.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//@ compile-flags: -Znext-solver
#![feature(const_trait_impl)]
#![feature(const_trait_impl, const_cmp)]

pub const fn equals_self<T: PartialEq>(t: &T) -> bool {
*t == *t
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/traits/const-traits/call-generic-method-pass.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
//@ compile-flags: -Znext-solver
//@ check-pass

#![feature(const_trait_impl)]
#![feature(const_trait_impl, const_cmp)]

struct S;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//@ check-pass

#![feature(derive_const)]
#![feature(const_trait_impl)]
#![feature(const_trait_impl, const_cmp)]

#[derive_const(PartialEq)]
pub struct Reverse<T>(T);
Expand Down
Loading