rust-lang / rust-lang/rust

Tracking Issue for `CovariantUnsafeCell`

Open
#159,735 0 comments 1 reaction 1 assignee View on GitHub

@WaffleLapkin is already working on this.

Since Jul 22, 2026.

C-tracking-issue S-tracking-needs-to-bake T-libs
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

Feature gate: #![feature(covariant_unsafe_cell)]

This is a tracking issue for https://github.com/rust-lang/libs-team/issues/815.

Public API
// core::cell

pub struct CovariantUnsafeCell<T: ?Sized> { ... }

impl<T> CovariantUnsafeCell<T> {
    pub const fn new(value: T) -> Self { ... }
    pub const fn into_inner(self) -> T { ... }
}

impl<T> CovariantUnsafeCell<T> {
    pub const fn get(&self) -> NonNull<T> { ... }
    pub const fn get_mut(&mut self) -> &mut T { ... }
    pub const fn raw_get(this: *const Self) -> *mut T { ... }
}
Steps / History

(Remember to update the S-tracking-* label when checking boxes.)

Unresolved Questions
  • What should be the return type of get? ACP originally proposed *mut T as with normal UnsafeCell, but the implementation PR used NonNull<T>

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.