2024-06-04 13:21:09 +00:00
|
|
|
//@ check-fail
|
2024-01-22 19:08:19 +00:00
|
|
|
|
|
|
|
trait Trait<'a> {}
|
|
|
|
|
|
|
|
fn change_lt<'a, 'b>(x: *mut dyn Trait<'a>) -> *mut dyn Trait<'b> {
|
2024-02-12 21:24:48 +00:00
|
|
|
x as _ //~ error: lifetime may not live long enough
|
|
|
|
//~| error: lifetime may not live long enough
|
2024-01-22 19:08:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
fn change_lt_ab<'a: 'b, 'b>(x: *mut dyn Trait<'a>) -> *mut dyn Trait<'b> {
|
2024-02-12 21:24:48 +00:00
|
|
|
x as _ //~ error: lifetime may not live long enough
|
2024-01-22 19:08:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
fn change_lt_ba<'a, 'b: 'a>(x: *mut dyn Trait<'a>) -> *mut dyn Trait<'b> {
|
2024-02-12 21:24:48 +00:00
|
|
|
x as _ //~ error: lifetime may not live long enough
|
2024-01-22 19:08:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
trait Assocked {
|
|
|
|
type Assoc: ?Sized;
|
|
|
|
}
|
|
|
|
|
|
|
|
fn change_assoc_0<'a, 'b>(
|
|
|
|
x: *mut dyn Assocked<Assoc = dyn Send + 'a>,
|
|
|
|
) -> *mut dyn Assocked<Assoc = dyn Send + 'b> {
|
2024-02-12 21:24:48 +00:00
|
|
|
x as _ //~ error: lifetime may not live long enough
|
|
|
|
//~| error: lifetime may not live long enough
|
2024-01-22 19:08:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
fn change_assoc_1<'a, 'b>(
|
|
|
|
x: *mut dyn Assocked<Assoc = dyn Trait<'a>>,
|
|
|
|
) -> *mut dyn Assocked<Assoc = dyn Trait<'b>> {
|
2024-02-12 21:24:48 +00:00
|
|
|
x as _ //~ error: lifetime may not live long enough
|
|
|
|
//~| error: lifetime may not live long enough
|
2024-01-22 19:08:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fn main() {}
|