summaryrefslogtreecommitdiffstats
path: root/tests/ui/nll/borrowed-temporary-error.rs
blob: 37d0e670d350d1d7f9b47a5588307de541e32ce6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
fn gimme(x: &(u32,)) -> &u32 {
    &x.0
}

fn main() {
    let x = gimme({
        let v = 22;
        &(v,)
        //~^ ERROR temporary value dropped while borrowed [E0716]
    });
    println!("{:?}", x);
}