]> git.lizzy.rs Git - rust.git/blob - src/test/ui/rfc-2632-const-trait-impl/call-generic-method-dup-bound.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-dup-bound.rs
1 // check-pass
2
3 #![feature(const_trait_impl)]
4
5 struct S;
6
7 impl const PartialEq for S {
8     fn eq(&self, _: &S) -> bool {
9         true
10     }
11     fn ne(&self, other: &S) -> bool {
12         !self.eq(other)
13     }
14 }
15
16 // This duplicate bound should not result in ambiguities. It should be equivalent to a single ~const
17 // bound.
18 const fn equals_self<T: PartialEq + ~const PartialEq>(t: &T) -> bool {
19     *t == *t
20 }
21
22 trait A: PartialEq {}
23 impl<T: PartialEq> A for T {}
24
25 const fn equals_self2<T: A + ~const PartialEq>(t: &T) -> bool {
26     *t == *t
27 }
28
29 pub const EQ: bool = equals_self(&S) && equals_self2(&S);
30
31 fn main() {}