]> git.lizzy.rs Git - rust.git/blob - src/test/ui/rfc-2632-const-trait-impl/call-generic-method-pass.rs
Auto merge of #84589 - In-line:zircon-thread-name, r=JohnTitor
[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 #![feature(const_fn_trait_bound)]
7
8 struct S;
9
10 impl const PartialEq for S {
11     fn eq(&self, _: &S) -> bool {
12         true
13     }
14     fn ne(&self, other: &S) -> bool {
15         !self.eq(other)
16     }
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() {}