2024-02-12 15:24:48 -06:00
|
|
|
error: lifetime may not live long enough
|
|
|
|
--> $DIR/ptr-to-trait-obj-different-regions-misc.rs:6:5
|
|
|
|
|
|
|
|
|
LL | fn change_lt<'a, 'b>(x: *mut dyn Trait<'a>) -> *mut dyn Trait<'b> {
|
|
|
|
| -- -- lifetime `'b` defined here
|
|
|
|
| |
|
|
|
|
| lifetime `'a` defined here
|
|
|
|
LL | x as _
|
|
|
|
| ^^^^^^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'b`
|
|
|
|
|
|
|
|
|
= help: consider adding the following bound: `'b: 'a`
|
|
|
|
= note: requirement occurs because of a mutable pointer to `dyn Trait<'_>`
|
|
|
|
= note: mutable pointers are invariant over their type parameter
|
|
|
|
= help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
|
|
|
|
|
|
|
|
error: lifetime may not live long enough
|
|
|
|
--> $DIR/ptr-to-trait-obj-different-regions-misc.rs:6:5
|
|
|
|
|
|
|
|
|
LL | fn change_lt<'a, 'b>(x: *mut dyn Trait<'a>) -> *mut dyn Trait<'b> {
|
|
|
|
| -- -- lifetime `'b` defined here
|
|
|
|
| |
|
|
|
|
| lifetime `'a` defined here
|
|
|
|
LL | x as _
|
|
|
|
| ^^^^^^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a`
|
|
|
|
|
|
|
|
|
= help: consider adding the following bound: `'a: 'b`
|
|
|
|
= note: requirement occurs because of a mutable pointer to `dyn Trait<'_>`
|
|
|
|
= note: mutable pointers are invariant over their type parameter
|
|
|
|
= help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
|
|
|
|
|
|
|
|
help: `'b` and `'a` must be the same: replace one with the other
|
|
|
|
|
|
|
|
error: lifetime may not live long enough
|
|
|
|
--> $DIR/ptr-to-trait-obj-different-regions-misc.rs:11:5
|
|
|
|
|
|
|
|
|
LL | fn change_lt_ab<'a: 'b, 'b>(x: *mut dyn Trait<'a>) -> *mut dyn Trait<'b> {
|
|
|
|
| -- -- lifetime `'b` defined here
|
|
|
|
| |
|
|
|
|
| lifetime `'a` defined here
|
|
|
|
LL | x as _
|
|
|
|
| ^^^^^^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'b`
|
|
|
|
|
|
|
|
|
= help: consider adding the following bound: `'b: 'a`
|
|
|
|
= note: requirement occurs because of a mutable pointer to `dyn Trait<'_>`
|
|
|
|
= note: mutable pointers are invariant over their type parameter
|
|
|
|
= help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
|
|
|
|
|
|
|
|
error: lifetime may not live long enough
|
|
|
|
--> $DIR/ptr-to-trait-obj-different-regions-misc.rs:15:5
|
|
|
|
|
|
|
|
|
LL | fn change_lt_ba<'a, 'b: 'a>(x: *mut dyn Trait<'a>) -> *mut dyn Trait<'b> {
|
|
|
|
| -- -- lifetime `'b` defined here
|
|
|
|
| |
|
|
|
|
| lifetime `'a` defined here
|
|
|
|
LL | x as _
|
|
|
|
| ^^^^^^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a`
|
|
|
|
|
|
|
|
|
= help: consider adding the following bound: `'a: 'b`
|
|
|
|
= note: requirement occurs because of a mutable pointer to `dyn Trait<'_>`
|
|
|
|
= note: mutable pointers are invariant over their type parameter
|
|
|
|
= help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
|
|
|
|
|
|
|
|
error: lifetime may not live long enough
|
2024-09-27 12:27:48 -05:00
|
|
|
--> $DIR/ptr-to-trait-obj-different-regions-misc.rs:19:5
|
|
|
|
|
|
|
|
|
LL | fn change_lt_hr<'a>(x: *mut dyn Trait<'a>) -> *mut dyn for<'b> Trait<'b> {
|
|
|
|
| -- lifetime `'a` defined here
|
|
|
|
LL | x as _
|
|
|
|
| ^^^^^^ cast requires that `'a` must outlive `'static`
|
|
|
|
|
|
|
|
|
help: to declare that the trait object captures data from argument `x`, you can add an explicit `'a` lifetime bound
|
|
|
|
|
|
|
|
|
LL | fn change_lt_hr<'a>(x: *mut dyn Trait<'a>) -> *mut dyn for<'b> Trait<'b> + 'a {
|
|
|
|
| ++++
|
|
|
|
|
|
|
|
error[E0308]: mismatched types
|
|
|
|
--> $DIR/ptr-to-trait-obj-different-regions-misc.rs:19:5
|
|
|
|
|
|
|
|
|
LL | x as _
|
|
|
|
| ^^^^^^ one type is more general than the other
|
|
|
|
|
|
|
|
|
= note: expected trait object `dyn for<'b> Trait<'b>`
|
|
|
|
found trait object `dyn Trait<'_>`
|
|
|
|
|
|
|
|
error: lifetime may not live long enough
|
|
|
|
--> $DIR/ptr-to-trait-obj-different-regions-misc.rs:31:5
|
2024-02-12 15:24:48 -06:00
|
|
|
|
|
|
|
|
LL | fn change_assoc_0<'a, 'b>(
|
|
|
|
| -- -- lifetime `'b` defined here
|
|
|
|
| |
|
|
|
|
| lifetime `'a` defined here
|
|
|
|
...
|
|
|
|
LL | x as _
|
|
|
|
| ^^^^^^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'b`
|
|
|
|
|
|
|
|
|
= help: consider adding the following bound: `'b: 'a`
|
|
|
|
= note: requirement occurs because of a mutable pointer to `dyn Assocked<Assoc = dyn Send>`
|
|
|
|
= note: mutable pointers are invariant over their type parameter
|
|
|
|
= help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
|
|
|
|
|
|
|
|
error: lifetime may not live long enough
|
2024-09-27 12:27:48 -05:00
|
|
|
--> $DIR/ptr-to-trait-obj-different-regions-misc.rs:31:5
|
2024-02-12 15:24:48 -06:00
|
|
|
|
|
|
|
|
LL | fn change_assoc_0<'a, 'b>(
|
|
|
|
| -- -- lifetime `'b` defined here
|
|
|
|
| |
|
|
|
|
| lifetime `'a` defined here
|
|
|
|
...
|
|
|
|
LL | x as _
|
|
|
|
| ^^^^^^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a`
|
|
|
|
|
|
|
|
|
= help: consider adding the following bound: `'a: 'b`
|
|
|
|
= note: requirement occurs because of a mutable pointer to `dyn Assocked<Assoc = dyn Send>`
|
|
|
|
= note: mutable pointers are invariant over their type parameter
|
|
|
|
= help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
|
|
|
|
|
|
|
|
help: `'b` and `'a` must be the same: replace one with the other
|
|
|
|
|
|
|
|
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
|
|
|
|
|
|
|
error: lifetime may not live long enough
|
2024-09-27 12:27:48 -05:00
|
|
|
--> $DIR/ptr-to-trait-obj-different-regions-misc.rs:38:5
|
2024-02-12 15:24:48 -06:00
|
|
|
|
|
|
|
|
LL | fn change_assoc_1<'a, 'b>(
|
|
|
|
| -- -- lifetime `'b` defined here
|
|
|
|
| |
|
|
|
|
| lifetime `'a` defined here
|
|
|
|
...
|
|
|
|
LL | x as _
|
|
|
|
| ^^^^^^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'b`
|
|
|
|
|
|
|
|
|
= help: consider adding the following bound: `'b: 'a`
|
|
|
|
= note: requirement occurs because of a mutable pointer to `dyn Assocked<Assoc = dyn Trait<'_>>`
|
|
|
|
= note: mutable pointers are invariant over their type parameter
|
|
|
|
= help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
|
|
|
|
|
|
|
|
error: lifetime may not live long enough
|
2024-09-27 12:27:48 -05:00
|
|
|
--> $DIR/ptr-to-trait-obj-different-regions-misc.rs:38:5
|
2024-02-12 15:24:48 -06:00
|
|
|
|
|
|
|
|
LL | fn change_assoc_1<'a, 'b>(
|
|
|
|
| -- -- lifetime `'b` defined here
|
|
|
|
| |
|
|
|
|
| lifetime `'a` defined here
|
|
|
|
...
|
|
|
|
LL | x as _
|
|
|
|
| ^^^^^^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a`
|
|
|
|
|
|
|
|
|
= help: consider adding the following bound: `'a: 'b`
|
|
|
|
= note: requirement occurs because of a mutable pointer to `dyn Assocked<Assoc = dyn Trait<'_>>`
|
|
|
|
= note: mutable pointers are invariant over their type parameter
|
|
|
|
= help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
|
|
|
|
|
|
|
|
help: `'b` and `'a` must be the same: replace one with the other
|
|
|
|
|
|
|
|
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
|
|
|
|
2024-09-10 14:41:50 -05:00
|
|
|
error: lifetime may not live long enough
|
2024-09-27 12:27:48 -05:00
|
|
|
--> $DIR/ptr-to-trait-obj-different-regions-misc.rs:45:20
|
2024-09-10 14:41:50 -05:00
|
|
|
|
|
|
|
|
LL | fn extend_to_static<'a>(ptr: *const dyn Trait<'a>) {
|
|
|
|
| -- lifetime `'a` defined here
|
|
|
|
LL | require_static(ptr as _)
|
2024-09-10 12:20:27 -05:00
|
|
|
| ^^^^^^^^ cast requires that `'a` must outlive `'static`
|
2024-09-10 14:41:50 -05:00
|
|
|
|
2024-09-27 12:27:48 -05:00
|
|
|
error: aborting due to 11 previous errors
|
2024-02-12 15:24:48 -06:00
|
|
|
|
2024-09-27 12:27:48 -05:00
|
|
|
For more information about this error, try `rustc --explain E0308`.
|