]> git.lizzy.rs Git - rust.git/blob - tests/ui/suggestions/suggest-move-types.rs
Auto merge of #106646 - Amanieu:ilp32-object, r=Mark-Simulacrum
[rust.git] / tests / ui / suggestions / suggest-move-types.rs
1 #![allow(warnings)]
2
3 // This test verifies that the suggestion to move types before associated type bindings
4 // is correct.
5
6 trait One<T> {
7   type A;
8 }
9
10 trait OneWithLifetime<'a, T> {
11   type A;
12 }
13
14 trait Three<T, U, V> {
15   type A;
16   type B;
17   type C;
18 }
19
20 trait ThreeWithLifetime<'a, 'b, 'c, T, U, V> {
21   type A;
22   type B;
23   type C;
24 }
25
26 struct A<T, M: One<A=(), T>> {
27 //~^ ERROR generic arguments must come before the first constraint
28     m: M,
29     t: T,
30 }
31
32
33 struct Al<'a, T, M: OneWithLifetime<A=(), T, 'a>> {
34 //~^ ERROR generic arguments must come before the first constraint
35 //~^^ ERROR type provided when a lifetime was expected
36     m: M,
37     t: &'a T,
38 }
39
40 struct B<T, U, V, M: Three<A=(), B=(), C=(), T, U, V>> {
41 //~^ ERROR generic arguments must come before the first constraint
42     m: M,
43     t: T,
44     u: U,
45     v: V,
46 }
47
48 struct Bl<'a, 'b, 'c, T, U, V, M: ThreeWithLifetime<A=(), B=(), C=(), T, U, V, 'a, 'b, 'c>> {
49 //~^ ERROR generic arguments must come before the first constraint
50 //~^^ ERROR type provided when a lifetime was expected
51     m: M,
52     t: &'a T,
53     u: &'b U,
54     v: &'c V,
55 }
56
57 struct C<T, U, V, M: Three<T, A=(), B=(), C=(), U, V>> {
58 //~^ ERROR generic arguments must come before the first constraint
59     m: M,
60     t: T,
61     u: U,
62     v: V,
63 }
64
65 struct Cl<'a, 'b, 'c, T, U, V, M: ThreeWithLifetime<T, 'a, A=(), B=(), C=(), U, 'b, V, 'c>> {
66 //~^ ERROR generic arguments must come before the first constraint
67 //~^^ ERROR lifetime provided when a type was expected
68     m: M,
69     t: &'a T,
70     u: &'b U,
71     v: &'c V,
72 }
73
74 struct D<T, U, V, M: Three<T, A=(), B=(), U, C=(), V>> {
75 //~^ ERROR generic arguments must come before the first constraint
76     m: M,
77     t: T,
78     u: U,
79     v: V,
80 }
81
82 struct Dl<'a, 'b, 'c, T, U, V, M: ThreeWithLifetime<T, 'a, A=(), B=(), U, 'b, C=(), V, 'c>> {
83 //~^ ERROR generic arguments must come before the first constraint
84 //~^^ ERROR lifetime provided when a type was expected
85     m: M,
86     t: &'a T,
87     u: &'b U,
88     v: &'c V,
89 }
90
91 fn main() {}