rust/tests/ui/span/borrowck-ref-into-rvalue.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

13 lines
257 B
Rust
Raw Normal View History

//@ run-rustfix
fn main() {
let msg;
2014-05-25 10:10:11 +00:00
match Some("Hello".to_string()) {
//~^ ERROR temporary value dropped while borrowed
2017-11-20 12:13:27 +00:00
Some(ref m) => {
msg = m;
2013-03-15 19:24:24 +00:00
},
None => { panic!() }
2017-12-14 01:27:23 +00:00
}
println!("{}", *msg);
}