]> git.lizzy.rs Git - rust.git/blob - src/test/ui/rfc-2632-const-trait-impl/call-generic-method-pass.rs
Rollup merge of #99244 - gthb:doc-improve-iterator-scan, r=m-ou-se
[rust.git] / src / test / ui / rfc-2632-const-trait-impl / call-generic-method-pass.rs
1 //! Basic test for calling methods on generic type parameters in `const fn`.
2
3 // check-pass
4
5 #![feature(const_trait_impl)]
6
7 struct S;
8
9 impl const PartialEq for S {
10     fn eq(&self, _: &S) -> bool {
11         true
12     }
13     fn ne(&self, other: &S) -> bool {
14         !self.eq(other)
15     }
16 }
17
18 const fn equals_self<T: ~const PartialEq>(t: &T) -> bool {
19     *t == *t
20 }
21
22 pub const EQ: bool = equals_self(&S);
23
24 fn main() {}