]> git.lizzy.rs Git - rust.git/blob - src/test/ui/rfc-2632-const-trait-impl/call-generic-method-pass.rs
const fn: allow use of trait impls from bounds
[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_fn)]
6 #![feature(const_trait_impl)]
7 #![allow(incomplete_features)]
8
9 struct S;
10
11 impl const PartialEq for S {
12     fn eq(&self, _: &S) -> bool {
13         true
14     }
15 }
16
17 const fn equals_self<T: PartialEq>(t: &T) -> bool {
18     *t == *t
19 }
20
21 pub const EQ: bool = equals_self(&S);
22
23 fn main() {}