Skip to content

Tracking Issue for const_ref_cell #137844

Open
@Daniel-Aaron-Bloom

Description

@Daniel-Aaron-Bloom

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

Unresolved Questions

  • None yet.

Footnotes

Footnotes

  1. https://std-dev-guide.rust-lang.org/feature-lifecycle/stabilization.html

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCT-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions