2020-11-22 14:51:05 +00:00
|
|
|
// check-pass
|
|
|
|
|
|
|
|
#![feature(const_trait_impl)]
|
2021-04-18 16:36:41 +00:00
|
|
|
#![feature(const_fn_trait_bound)]
|
2020-11-22 14:51:05 +00:00
|
|
|
|
|
|
|
struct S;
|
|
|
|
|
|
|
|
impl const PartialEq for S {
|
|
|
|
fn eq(&self, _: &S) -> bool {
|
|
|
|
true
|
|
|
|
}
|
2021-06-23 10:37:26 +00:00
|
|
|
fn ne(&self, other: &S) -> bool {
|
|
|
|
!self.eq(other)
|
|
|
|
}
|
2020-11-22 14:51:05 +00:00
|
|
|
}
|
|
|
|
|
2021-08-25 14:30:09 +00:00
|
|
|
// This duplicate bound should not result in ambiguities. It should be equivalent to a single ~const
|
2020-11-22 14:51:05 +00:00
|
|
|
// bound.
|
2021-08-25 14:30:09 +00:00
|
|
|
const fn equals_self<T: PartialEq + ~const PartialEq>(t: &T) -> bool {
|
2020-11-22 14:51:05 +00:00
|
|
|
*t == *t
|
|
|
|
}
|
|
|
|
|
|
|
|
pub const EQ: bool = equals_self(&S);
|
|
|
|
|
|
|
|
fn main() {}
|