rust/tests/ui/span/issue-15480.rs

14 lines
210 B
Rust
Raw Normal View History

//@ run-rustfix
2017-08-13 08:46:49 +00:00
fn id<T>(x: T) -> T { x }
2014-12-07 15:22:06 +00:00
fn main() {
let v = vec![
2017-08-13 08:46:49 +00:00
&id(3)
2017-12-14 01:27:23 +00:00
];
//~^^ ERROR temporary value dropped while borrowed
2014-12-07 15:22:06 +00:00
2015-01-31 17:20:46 +00:00
for &&x in &v {
2014-12-07 15:22:06 +00:00
println!("{}", x + 3);
}
}