]> git.lizzy.rs Git - rust.git/blob - src/test/ui/rfc-2632-const-trait-impl/call-generic-method-nonconst-opt-out.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-opt-out.rs
1 // check-pass
2
3 #![feature(const_fn_trait_bound)]
4 #![feature(const_trait_impl)]
5 #![feature(const_trait_bound_opt_out)]
6 #![allow(incomplete_features)]
7
8 struct S;
9
10 impl PartialEq for S {
11     fn eq(&self, _: &S) -> bool {
12         true
13     }
14 }
15
16 const fn equals_self<T: ?const PartialEq>(t: &T) -> bool {
17     true
18 }
19
20 pub const EQ: bool = equals_self(&S);
21
22 // Calling `equals_self` with a type that only has a non-const impl is fine, because we opted out.
23
24 fn main() {}