about summary refs log tree commit diff
path: root/src/test/ui/lifetimes/lifetime-errors/ex2d-push-inference-variable-2.rs
blob: e65638fb0df13e7d32c77eb2b20a683732840500 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// 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 a: &mut Vec<Ref<i32>> = x;
    //[base]~^ ERROR lifetime mismatch
    let b = Ref { data: y.data };
    a.push(b);
    //[nll]~^ ERROR lifetime may not live long enough
}

fn main() { }