]> git.lizzy.rs Git - rust.git/blob - src/test/ui/traits/impl-evaluation-order.rs
:arrow_up: rust-analyzer
[rust.git] / src / test / ui / traits / impl-evaluation-order.rs
1 // Regression test for #79902
2
3 // Check that evaluation (which is used to determine whether to copy a type in
4 // MIR building) evaluates bounds from normalizing an impl after evaluating
5 // any bounds on the impl.
6
7 // check-pass
8
9 trait A {
10     type B;
11 }
12 trait M {}
13
14 struct G<T, U>(*const T, *const U);
15
16 impl<T, U> Clone for G<T, U> {
17     fn clone(&self) -> Self {
18         G { ..*self }
19     }
20 }
21
22 impl<T, U> Copy for G<T, U::B>
23 where
24     T: A<B = U>,
25     U: A,
26 {
27 }
28
29 impl A for () {
30     type B = ();
31 }
32
33 fn is_m<T: M>(_: T) {}
34
35 fn main() {
36     let x = G(&(), &());
37     drop(x);
38     drop(x);
39 }