]> git.lizzy.rs Git - rust.git/blob - tests/ui/rfc-2632-const-trait-impl/call-generic-method-chain.rs
Rollup merge of #106323 - starkat99:stabilize-f16c_target_feature, r=petrochenkov
[rust.git] / tests / ui / rfc-2632-const-trait-impl / call-generic-method-chain.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 const fn equals_self_wrapper<T: ~const PartialEq>(t: &T) -> bool {
23     equals_self(t)
24 }
25
26 pub const EQ: bool = equals_self_wrapper(&S);
27
28 fn main() {}