]> git.lizzy.rs Git - rust.git/blob - src/test/ui/rfc-2632-const-trait-impl/call-generic-method-nonconst.rs
Auto merge of #100845 - timvermeulen:iter_compare, r=scottmcm
[rust.git] / src / test / ui / rfc-2632-const-trait-impl / call-generic-method-nonconst.rs
1 #![feature(const_trait_impl)]
2
3 struct S;
4
5 impl PartialEq for S {
6     fn eq(&self, _: &S) -> bool {
7         true
8     }
9 }
10
11 const fn equals_self<T: ~const PartialEq>(t: &T) -> bool {
12     true
13 }
14
15 // Calling `equals_self` with something that has a non-const impl should throw an error, despite
16 // it not using the impl.
17
18 pub const EQ: bool = equals_self(&S);
19 //~^ ERROR
20
21 fn main() {}