Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
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
Prev Previous commit
Next Next commit
Disable test on bootstrap compiler
  • Loading branch information
ecstatic-morse committed Dec 17, 2021
commit 20492870307feae4ca57acdca75bcc8ea06fe175
45 changes: 25 additions & 20 deletions library/core/tests/cmp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,30 +204,35 @@ fn cmp_default() {
assert_eq!(Fool(false), Fool(true));
}

struct S(i32);
#[cfg(not(bootstrap))]
mod const_cmp {
use super::*;

impl const PartialEq for S {
fn eq(&self, other: &Self) -> bool {
self.0 == other.0
struct S(i32);

impl const PartialEq for S {
fn eq(&self, other: &Self) -> bool {
self.0 == other.0
}
}
}

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,
(a, b) if a < b => Ordering::Less,
_ => Ordering::Equal,
};
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,
(a, b) if a < b => Ordering::Less,
_ => Ordering::Equal,
};

Some(ret)
Some(ret)
}
}
}

const _: () = assert!(S(1) == S(1));
const _: () = assert!(S(0) != S(1));
const _: () = assert!(S(1) == S(1));
const _: () = assert!(S(0) != S(1));

const _: () = assert!(S(1) <= S(1));
const _: () = assert!(S(1) >= S(1));
const _: () = assert!(S(0) < S(1));
const _: () = assert!(S(1) > S(0));
const _: () = assert!(S(1) <= S(1));
const _: () = assert!(S(1) >= S(1));
const _: () = assert!(S(0) < S(1));
const _: () = assert!(S(1) > S(0));
}