Open
Description
Feature gate: #![feature(const_ref_cell)]
This is a tracking issue for using RefCell
in a const
context.
Public API
// core::cell
impl<T> RefCell<T>
pub const fn replace(&self, t: T) -> T;
pub const fn swap(&self, other: &Self);
}
impl<T: ?Sized> RefCell<T> {
pub const fn borrow(&self) -> Ref<'_, T>;
pub const fn try_borrow(&self) -> Result<Ref<'_, T>, BorrowError>;
pub const fn borrow_mut(&self) -> RefMut<'_, T>;
pub const fn try_borrow_mut(&self) -> Result<RefMut<'_, T>, BorrowMutError>;
pub const fn as_ptr(&self) -> *mut T;
pub const fn get_mut(&mut self) -> &mut T;
pub const fn undo_leak(&mut self) -> &mut T;
pub const unsafe fn try_borrow_unguarded(&self) -> Result<&T, BorrowError>;
}
impl<'b, T: ?Sized> Ref<'b, T> {
pub const fn clone(orig: &Ref<'b, T>) -> Ref<'b, T>;
pub const fn leak(orig: Ref<'b, T>) -> &'b T;
}
impl<'b, T: ?Sized> RefMut<'b, T> {
pub const fn leak(mut orig: RefMut<'b, T>) -> &'b mut T;
}
Steps
- Implementation: make RefCell unstably const #137843
- Final comment period (FCP)1
- Stabilization PR
Unresolved Questions
- None yet.