2020-11-21 21:19:46 -06:00
|
|
|
//! Basic test for calling methods on generic type parameters in `const fn`.
|
|
|
|
|
|
|
|
// check-pass
|
|
|
|
|
|
|
|
#![feature(const_trait_impl)]
|
|
|
|
|
|
|
|
struct S;
|
|
|
|
|
|
|
|
impl const PartialEq for S {
|
|
|
|
fn eq(&self, _: &S) -> bool {
|
|
|
|
true
|
|
|
|
}
|
2021-06-23 05:37:26 -05:00
|
|
|
fn ne(&self, other: &S) -> bool {
|
|
|
|
!self.eq(other)
|
|
|
|
}
|
2020-11-21 21:19:46 -06:00
|
|
|
}
|
|
|
|
|
2021-08-25 10:21:55 -05:00
|
|
|
const fn equals_self<T: ~const PartialEq>(t: &T) -> bool {
|
2020-11-21 21:19:46 -06:00
|
|
|
*t == *t
|
|
|
|
}
|
|
|
|
|
|
|
|
pub const EQ: bool = equals_self(&S);
|
|
|
|
|
|
|
|
fn main() {}
|