about summary refs log tree commit diff
path: root/src/test/ui/lifetimes/lifetime-errors/ex2c-push-inference-variable.rs
blob: f676eb403a8aae3d15e12b5761863ef48c7f8e19 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// revisions: base nll
// ignore-compare-mode-nll
//[nll] compile-flags: -Z borrowck=mir

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 z = Ref { data: y.data };
    x.push(z);
    //[base]~^ ERROR lifetime mismatch
    //[nll]~^^ ERROR lifetime may not live long enough
}

fn main() { }