Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tracking Issue for const_ref_cell #137844

Open
3 tasks
Daniel-Aaron-Bloom opened this issue Mar 1, 2025 · 0 comments
Open
3 tasks

Tracking Issue for const_ref_cell #137844

Daniel-Aaron-Bloom opened this issue Mar 1, 2025 · 0 comments
Labels
C-tracking-issue Category: An issue tracking the progress of sth. like the implementation of an RFC T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.

Comments

@Daniel-Aaron-Bloom
Copy link

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

@Daniel-Aaron-Bloom Daniel-Aaron-Bloom added C-tracking-issue Category: An issue tracking the progress of sth. like the implementation of an RFC T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. labels Mar 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-tracking-issue Category: An issue tracking the progress of sth. like the implementation of an RFC T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

1 participant