@@ -28,6 +28,86 @@ note: associated type defined here, with 0 generic parameters
28
28
LL | type Y<'a>;
29
29
| ^
30
30
31
- error: aborting due to 2 previous errors
31
+ error[E0107]: associated type takes 1 lifetime argument but 0 lifetime arguments were supplied
32
+ --> $DIR/invalid_const_in_lifetime_position.rs:4:26
33
+ |
34
+ LL | fn f<'a>(arg : Box<dyn X<Y<1> = &'a ()>>) {}
35
+ | ^ expected 1 lifetime argument
36
+ |
37
+ note: associated type defined here, with 1 lifetime parameter: `'a`
38
+ --> $DIR/invalid_const_in_lifetime_position.rs:2:10
39
+ |
40
+ LL | type Y<'a>;
41
+ | ^ --
42
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
43
+ help: add missing lifetime argument
44
+ |
45
+ LL | fn f<'a>(arg : Box<dyn X<Y<'_, 1> = &'a ()>>) {}
46
+ | +++
47
+
48
+ error[E0107]: associated type takes 0 generic arguments but 1 generic argument was supplied
49
+ --> $DIR/invalid_const_in_lifetime_position.rs:4:26
50
+ |
51
+ LL | fn f<'a>(arg : Box<dyn X<Y<1> = &'a ()>>) {}
52
+ | ^--- help: remove these generics
53
+ | |
54
+ | expected 0 generic arguments
55
+ |
56
+ note: associated type defined here, with 0 generic parameters
57
+ --> $DIR/invalid_const_in_lifetime_position.rs:2:10
58
+ |
59
+ LL | type Y<'a>;
60
+ | ^
61
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
62
+
63
+ error[E0107]: associated type takes 1 lifetime argument but 0 lifetime arguments were supplied
64
+ --> $DIR/invalid_const_in_lifetime_position.rs:4:26
65
+ |
66
+ LL | fn f<'a>(arg : Box<dyn X<Y<1> = &'a ()>>) {}
67
+ | ^ expected 1 lifetime argument
68
+ |
69
+ note: associated type defined here, with 1 lifetime parameter: `'a`
70
+ --> $DIR/invalid_const_in_lifetime_position.rs:2:10
71
+ |
72
+ LL | type Y<'a>;
73
+ | ^ --
74
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
75
+ help: add missing lifetime argument
76
+ |
77
+ LL | fn f<'a>(arg : Box<dyn X<Y<'_, 1> = &'a ()>>) {}
78
+ | +++
79
+
80
+ error[E0107]: associated type takes 0 generic arguments but 1 generic argument was supplied
81
+ --> $DIR/invalid_const_in_lifetime_position.rs:4:26
82
+ |
83
+ LL | fn f<'a>(arg : Box<dyn X<Y<1> = &'a ()>>) {}
84
+ | ^--- help: remove these generics
85
+ | |
86
+ | expected 0 generic arguments
87
+ |
88
+ note: associated type defined here, with 0 generic parameters
89
+ --> $DIR/invalid_const_in_lifetime_position.rs:2:10
90
+ |
91
+ LL | type Y<'a>;
92
+ | ^
93
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
94
+
95
+ error[E0038]: the trait `X` cannot be made into an object
96
+ --> $DIR/invalid_const_in_lifetime_position.rs:4:20
97
+ |
98
+ LL | fn f<'a>(arg : Box<dyn X<Y<1> = &'a ()>>) {}
99
+ | ^^^^^^^^^^^^^^^^^^^^ `X` cannot be made into an object
100
+ |
101
+ note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
102
+ --> $DIR/invalid_const_in_lifetime_position.rs:2:10
103
+ |
104
+ LL | trait X {
105
+ | - this trait cannot be made into an object...
106
+ LL | type Y<'a>;
107
+ | ^ ...because it contains the generic associated type `Y`
108
+ = help: consider moving `Y` to another trait
109
+
110
+ error: aborting due to 7 previous errors
32
111
33
- For more information about this error, try `rustc --explain E0107`.
112
+ Some errors have detailed explanations: E0038, E0107.
113
+ For more information about an error, try `rustc --explain E0038`.
0 commit comments