27 lines
1014 B
Plaintext
27 lines
1014 B
Plaintext
error[E0597]: `cell` does not live long enough
|
|
--> $DIR/refcell-in-tail-expr.rs:12:27
|
|
|
|
|
LL | let cell = std::cell::RefCell::new(0u8);
|
|
| ---- binding `cell` declared here
|
|
LL |
|
|
LL | if let Ok(mut byte) = cell.try_borrow_mut() {
|
|
| ^^^^-----------------
|
|
| |
|
|
| borrowed value does not live long enough
|
|
| a temporary with access to the borrow is created here ...
|
|
...
|
|
LL | }
|
|
| -
|
|
| |
|
|
| `cell` dropped here while still borrowed
|
|
| ... and the borrow might be used here, when that temporary is dropped and runs the destructor for type `Result<RefMut<'_, u8>, BorrowMutError>`
|
|
|
|
|
help: consider adding semicolon after the expression so its temporaries are dropped sooner, before the local variables declared by the block are dropped
|
|
|
|
|
LL | };
|
|
| +
|
|
|
|
error: aborting due to 1 previous error
|
|
|
|
For more information about this error, try `rustc --explain E0597`.
|