about summary refs log tree commit diff
path: root/tests/ui/lifetimes/refcell-in-tail-expr.rs
blob: 2cca7acbf5a422cbdf4f9215ab0bb032992792b0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
//@ revisions: edition2021 edition2024
//@ [edition2021] edition: 2021
//@ [edition2024] edition: 2024
//@ [edition2024] check-pass

fn main() {
    let cell = std::cell::RefCell::new(0u8);

    if let Ok(mut byte) = cell.try_borrow_mut() {
        //[edition2021]~^ ERROR: `cell` does not live long enough
        *byte = 1;
    }
}