2018-09-25 10:24:20 -05:00
|
|
|
error[E0716]: temporary value dropped while borrowed
|
2018-12-25 09:56:47 -06:00
|
|
|
--> $DIR/borrowck-ref-into-rvalue.rs:3:11
|
2018-04-10 17:38:35 -05:00
|
|
|
|
|
2018-09-23 10:19:00 -05:00
|
|
|
LL | match Some("Hello".to_string()) {
|
2018-09-25 10:24:20 -05:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
|
2018-04-10 17:38:35 -05:00
|
|
|
...
|
|
|
|
LL | }
|
2018-09-25 10:24:20 -05:00
|
|
|
| - temporary value is freed at the end of this statement
|
2018-04-10 17:38:35 -05:00
|
|
|
LL | println!("{}", *msg);
|
|
|
|
| ---- borrow later used here
|
2018-09-09 13:43:46 -05:00
|
|
|
|
|
|
|
|
= note: consider using a `let` binding to create a longer lived value
|
2018-04-10 17:38:35 -05:00
|
|
|
|
|
|
|
error: aborting due to previous error
|
|
|
|
|
2018-09-25 10:24:20 -05:00
|
|
|
For more information about this error, try `rustc --explain E0716`.
|