rust/src/test/ui/span/borrowck-ref-into-rvalue.rs

12 lines
243 B
Rust
Raw Normal View History

fn main() {
let msg;
2014-05-25 05:10:11 -05:00
match Some("Hello".to_string()) {
2017-11-20 06:13:27 -06:00
Some(ref m) => {
2017-12-13 19:27:23 -06:00
//~^ ERROR borrowed value does not live long enough
msg = m;
2013-03-15 14:24:24 -05:00
},
None => { panic!() }
2017-12-13 19:27:23 -06:00
}
println!("{}", *msg);
}