]> git.lizzy.rs Git - rust.git/blob - src/test/ui/rfc-2632-const-trait-impl/call-generic-method-nonconst.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-nonconst.rs
1 // FIXME(jschievink): this is not rejected correctly (only when the non-const impl is actually used)
2 // ignore-test
3
4 #![feature(const_trait_impl)]
5
6 struct S;
7
8 impl PartialEq for S {
9     fn eq(&self, _: &S) -> bool {
10         true
11     }
12 }
13
14 const fn equals_self<T: PartialEq>(t: &T) -> bool {
15     true
16 }
17
18 // Calling `equals_self` with something that has a non-const impl should throw an error, despite
19 // it not using the impl.
20
21 pub const EQ: bool = equals_self(&S);
22 //~^ ERROR
23
24 fn main() {}