rust/src/test/ui/nll/borrowed-temporary-error.rs
2018-12-25 21:08:33 -07:00

15 lines
228 B
Rust

#![feature(nll)]
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);
}