blob: 858be42d540949d613e32150ddd6efd4258c5366 [file] [log] [blame]
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`.