rust/src/test/ui/rfc-2632-const-trait-impl/call-generic-method-dup-bound.rs
2021-08-27 07:12:40 +00:00

27 lines
623 B
Rust

// check-pass
#![feature(const_trait_impl)]
#![feature(const_fn_trait_bound)]
struct S;
impl const PartialEq for S {
fn eq(&self, _: &S) -> bool {
true
}
fn ne(&self, other: &S) -> bool {
!self.eq(other)
}
}
// This duplicate bound should not result in ambiguities. It should be equivalent to a single ~const
// bound.
// const fn equals_self<T: PartialEq + ~const PartialEq>(t: &T) -> bool {
// FIXME(fee1-dead)^ why should the order matter here?
const fn equals_self<T: ~const PartialEq + PartialEq>(t: &T) -> bool {
*t == *t
}
pub const EQ: bool = equals_self(&S);
fn main() {}