Constify Eq, Ord, PartialOrd

This commit is contained in:
Evgenii Zheltonozhskii
2025-09-12 12:39:31 +03:00
parent 8e2ed71eff
commit ff9b1c1d28
23 changed files with 226 additions and 173 deletions

View File

@@ -215,19 +215,18 @@ fn cmp_default() {
assert_eq!(Fool(false), Fool(true));
}
/* FIXME(#110395)
mod const_cmp {
use super::*;
struct S(i32);
impl PartialEq for S {
impl const PartialEq for S {
fn eq(&self, other: &Self) -> bool {
self.0 == other.0
}
}
impl PartialOrd for S {
impl const PartialOrd for S {
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
let ret = match (self.0, other.0) {
(a, b) if a > b => Ordering::Greater,
@@ -247,4 +246,3 @@ mod const_cmp {
const _: () = assert!(S(0) < S(1));
const _: () = assert!(S(1) > S(0));
}
*/

View File

@@ -15,6 +15,7 @@
#![feature(cfg_target_has_reliable_f16_f128)]
#![feature(char_max_len)]
#![feature(clone_to_uninit)]
#![feature(const_cmp)]
#![feature(const_convert)]
#![feature(const_destruct)]
#![feature(const_eval_select)]