@@ -61,7 +61,29 @@ LL | x as _
61
61
= help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
62
62
63
63
error: lifetime may not live long enough
64
- --> $DIR/ptr-to-trait-obj-different-regions-misc.rs:25:5
64
+ --> $DIR/ptr-to-trait-obj-different-regions-misc.rs:19:5
65
+ |
66
+ LL | fn change_lt_hr<'a>(x: *mut dyn Trait<'a>) -> *mut dyn for<'b> Trait<'b> {
67
+ | -- lifetime `'a` defined here
68
+ LL | x as _
69
+ | ^^^^^^ cast requires that `'a` must outlive `'static`
70
+ |
71
+ help: to declare that the trait object captures data from argument `x`, you can add an explicit `'a` lifetime bound
72
+ |
73
+ LL | fn change_lt_hr<'a>(x: *mut dyn Trait<'a>) -> *mut dyn for<'b> Trait<'b> + 'a {
74
+ | ++++
75
+
76
+ error[E0308]: mismatched types
77
+ --> $DIR/ptr-to-trait-obj-different-regions-misc.rs:19:5
78
+ |
79
+ LL | x as _
80
+ | ^^^^^^ one type is more general than the other
81
+ |
82
+ = note: expected trait object `dyn for<'b> Trait<'b>`
83
+ found trait object `dyn Trait<'_>`
84
+
85
+ error: lifetime may not live long enough
86
+ --> $DIR/ptr-to-trait-obj-different-regions-misc.rs:31:5
65
87
|
66
88
LL | fn change_assoc_0<'a, 'b>(
67
89
| -- -- lifetime `'b` defined here
@@ -77,7 +99,7 @@ LL | x as _
77
99
= help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
78
100
79
101
error: lifetime may not live long enough
80
- --> $DIR/ptr-to-trait-obj-different-regions-misc.rs:25 :5
102
+ --> $DIR/ptr-to-trait-obj-different-regions-misc.rs:31 :5
81
103
|
82
104
LL | fn change_assoc_0<'a, 'b>(
83
105
| -- -- lifetime `'b` defined here
@@ -97,7 +119,7 @@ help: `'b` and `'a` must be the same: replace one with the other
97
119
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
98
120
99
121
error: lifetime may not live long enough
100
- --> $DIR/ptr-to-trait-obj-different-regions-misc.rs:32 :5
122
+ --> $DIR/ptr-to-trait-obj-different-regions-misc.rs:38 :5
101
123
|
102
124
LL | fn change_assoc_1<'a, 'b>(
103
125
| -- -- lifetime `'b` defined here
@@ -113,7 +135,7 @@ LL | x as _
113
135
= help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
114
136
115
137
error: lifetime may not live long enough
116
- --> $DIR/ptr-to-trait-obj-different-regions-misc.rs:32 :5
138
+ --> $DIR/ptr-to-trait-obj-different-regions-misc.rs:38 :5
117
139
|
118
140
LL | fn change_assoc_1<'a, 'b>(
119
141
| -- -- lifetime `'b` defined here
@@ -133,12 +155,13 @@ help: `'b` and `'a` must be the same: replace one with the other
133
155
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
134
156
135
157
error: lifetime may not live long enough
136
- --> $DIR/ptr-to-trait-obj-different-regions-misc.rs:39 :20
158
+ --> $DIR/ptr-to-trait-obj-different-regions-misc.rs:45 :20
137
159
|
138
160
LL | fn extend_to_static<'a>(ptr: *const dyn Trait<'a>) {
139
161
| -- lifetime `'a` defined here
140
162
LL | require_static(ptr as _)
141
163
| ^^^^^^^^ cast requires that `'a` must outlive `'static`
142
164
143
- error: aborting due to 9 previous errors
165
+ error: aborting due to 11 previous errors
144
166
167
+ For more information about this error, try `rustc --explain E0308`.
0 commit comments