]>
Commit | Line | Data |
---|---|---|
fc512014 XL |
1 | //! Basic test for calling methods on generic type parameters in `const fn`. |
2 | ||
3 | // check-pass | |
4 | ||
fc512014 | 5 | #![feature(const_trait_impl)] |
cdc7bbd5 | 6 | #![feature(const_fn_trait_bound)] |
fc512014 XL |
7 | |
8 | struct S; | |
9 | ||
10 | impl const PartialEq for S { | |
11 | fn eq(&self, _: &S) -> bool { | |
12 | true | |
13 | } | |
136023e0 XL |
14 | fn ne(&self, other: &S) -> bool { |
15 | !self.eq(other) | |
16 | } | |
fc512014 XL |
17 | } |
18 | ||
19 | const fn equals_self<T: PartialEq>(t: &T) -> bool { | |
20 | *t == *t | |
21 | } | |
22 | ||
23 | pub const EQ: bool = equals_self(&S); | |
24 | ||
25 | fn main() {} |