rust/tests/ui/lifetimes/lifetime-errors/ex2d-push-inference-variable-2.rs
2023-01-11 09:32:08 +00:00

13 lines
261 B
Rust

struct Ref<'a, T: 'a> {
data: &'a T
}
fn foo<'a, 'b, 'c>(x: &'a mut Vec<Ref<'b, i32>>, y: Ref<'c, i32>) {
let a: &mut Vec<Ref<i32>> = x;
let b = Ref { data: y.data };
a.push(b);
//~^ ERROR lifetime may not live long enough
}
fn main() { }