| error: lifetime may not live long enough |
| --> $DIR/ptr-to-trait-obj-different-regions-misc.rs:7: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:7: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:12: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:16: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 |
| --> $DIR/ptr-to-trait-obj-different-regions-misc.rs:20: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:20: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:32:5 |
| | |
| 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 |
| --> $DIR/ptr-to-trait-obj-different-regions-misc.rs:32:5 |
| | |
| 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 |
| --> $DIR/ptr-to-trait-obj-different-regions-misc.rs:39:5 |
| | |
| 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 |
| --> $DIR/ptr-to-trait-obj-different-regions-misc.rs:39:5 |
| | |
| 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` |
| |
| error[E0521]: borrowed data escapes outside of function |
| --> $DIR/ptr-to-trait-obj-different-regions-misc.rs:46:5 |
| | |
| LL | fn extend_to_static<'a>(ptr: *const dyn Trait<'a>) { |
| | -- --- |
| | | | |
| | | `ptr` declared here, outside of the function body |
| | | `ptr` is a reference that is only valid in the function body |
| | lifetime `'a` defined here |
| LL | require_static(ptr as _) |
| | ^^^^^^^^^^^^^^^^^^^^^^^^ |
| | | |
| | `ptr` escapes the function body here |
| | argument requires that `'a` must outlive `'static` |
| |
| error: aborting due to 11 previous errors |
| |
| Some errors have detailed explanations: E0308, E0521. |
| For more information about an error, try `rustc --explain E0308`. |