rust/tests/ui/lifetimes/shorter-tail-expr-lifetime.rs
2024-10-24 01:56:08 +08:00

14 lines
321 B
Rust

//@ revisions: edition2021 edition2024
//@ [edition2024] compile-flags: -Zunstable-options
//@ [edition2024] edition: 2024
//@ [edition2024] run-pass
fn f() -> usize {
let c = std::cell::RefCell::new("..");
c.borrow().len() //[edition2021]~ ERROR: `c` does not live long enough
}
fn main() {
let _ = f();
}