#68712 adds methods to convert `RefCell` guards `Ref`/`RefMut` into references with the lifetime of the underlying cell. The feature gate for the issue is `#![feature(cell_leak)]`. ### Unresolved Questions - [ ] Should similar methods be provided for `MutexGuard` and `RwLockReadGuard`/`RwLockWriteGuard`? (https://github.com/rust-lang/rust/pull/68712#issuecomment-584894474) - [ ] Should `unsafe` methods be added to forcefully revert a leak? (https://github.com/rust-lang/rust/pull/69528#pullrequestreview-368511305) - Uses cases include situations where you can not keep the guard (https://github.com/rust-lang/rust/issues/69099#issuecomment-2839550930), it'd be more flexible if they did not require a leak of the resource until the next uniqe / &mut reference to the cell. - [ ] For `undo_leak`, would it make more sense not to return a reference (i.e., separate this from `get_mut`)? (https://github.com/rust-lang/rust/pull/69528#discussion_r392589656)
#68712 adds methods to convert
RefCellguardsRef/RefMutinto references with the lifetime of the underlying cell.The feature gate for the issue is
#![feature(cell_leak)].Unresolved Questions
MutexGuardandRwLockReadGuard/RwLockWriteGuard? (Add methods to 'leak' RefCell borrows as references with the lifetime of the original reference #68712 (comment))unsafemethods be added to forcefully revert a leak? (Add undo_leak to reset RefCell borrow state #69528 (review))std::cell::{Ref, RefMut}::leak#69099 (comment)), it'd be more flexible if they did not require a leak of the resource until the next uniqe / &mut reference to the cell.undo_leak, would it make more sense not to return a reference (i.e., separate this fromget_mut)? (Add undo_leak to reset RefCell borrow state #69528 (comment))