Skip to content

remove outdated comment in UnsafeCell::raw_get source - #162390

Open
RedDaedalus wants to merge 1 commit into
rust-lang:mainfrom
RedDaedalus:fix-raw-get-comment
Open

remove outdated comment in UnsafeCell::raw_get source#162390
RedDaedalus wants to merge 1 commit into
rust-lang:mainfrom
RedDaedalus:fix-raw-get-comment

Conversation

@RedDaedalus

@RedDaedalus RedDaedalus commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

It was decided that UnsafeCell can be accessed mutably without going through get (rust-lang/unsafe-code-guidelines#281) and a comment stating that std has special privileges was removed in #159730, but that PR missed raw_get. This comment actively contradicted CovariantUnsafeCell:

pub const fn raw_get(this: *const Self) -> *mut T {
// We can just cast the pointer from `UnsafeCell<T>` to `T` because of
// #[repr(transparent)].
//
// Note that this is also known to be allowed for user code as per
// `#[rustc_pub_transparent]`.
this as *const T as *mut T
}

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Sep 6, 2026
@rustbot

rustbot commented Sep 6, 2026

Copy link
Copy Markdown
Collaborator

r? @Darksonn

rustbot has assigned @Darksonn.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: libs
  • libs expanded to 12 candidates
  • Random selection from Darksonn, JohnTitor, Mark-Simulacrum, clarfonthey

@Darksonn

Darksonn commented Sep 7, 2026

Copy link
Copy Markdown
Member

@RalfJung You happy with this?

@RalfJung

RalfJung commented Sep 7, 2026

Copy link
Copy Markdown
Member

Good catch, thanks!
@bors r+ rollup

@rust-bors

rust-bors Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

📌 Commit ff72114 has been approved by RalfJung

It is now in the queue for this repository.

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 7, 2026
jhpratt added a commit to jhpratt/rust that referenced this pull request Sep 7, 2026
…=RalfJung

remove outdated comment in `UnsafeCell::raw_get` source

It was decided that UnsafeCell can be accessed mutably without going through `get` (rust-lang/unsafe-code-guidelines#281) and a comment stating that std has special privileges was removed in rust-lang#159730, but that PR missed `raw_get`. This comment actively contradicted `CovariantUnsafeCell`:
https://github.com/rust-lang/rust/blob/5a2be9f5f075d31e3ca5526b5b029881ce441253/library/core/src/cell/covariant_unsafe_cell.rs#L154-L161
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Sep 7, 2026
…=RalfJung

remove outdated comment in `UnsafeCell::raw_get` source

It was decided that UnsafeCell can be accessed mutably without going through `get` (rust-lang/unsafe-code-guidelines#281) and a comment stating that std has special privileges was removed in rust-lang#159730, but that PR missed `raw_get`. This comment actively contradicted `CovariantUnsafeCell`:
https://github.com/rust-lang/rust/blob/5a2be9f5f075d31e3ca5526b5b029881ce441253/library/core/src/cell/covariant_unsafe_cell.rs#L154-L161
jhpratt added a commit to jhpratt/rust that referenced this pull request Sep 7, 2026
…=RalfJung

remove outdated comment in `UnsafeCell::raw_get` source

It was decided that UnsafeCell can be accessed mutably without going through `get` (rust-lang/unsafe-code-guidelines#281) and a comment stating that std has special privileges was removed in rust-lang#159730, but that PR missed `raw_get`. This comment actively contradicted `CovariantUnsafeCell`:
https://github.com/rust-lang/rust/blob/5a2be9f5f075d31e3ca5526b5b029881ce441253/library/core/src/cell/covariant_unsafe_cell.rs#L154-L161
rust-bors Bot pushed a commit that referenced this pull request Sep 7, 2026
Rollup of 14 pull requests

Successful merges:

 - #162404 (`rust-analyzer` subtree update)
 - #161624 (diagnostics: Point closure trait errors at captured values)
 - #161697 (make `Complex` ABI-compatible on sparc64 and powerpc64)
 - #162182 (delay unexpected successful goal during ambiguity reporting)
 - #162328 (Allow overriding filecheck even if LLVM is built or downloaded)
 - #162367 (Use `reason` for tracked item diagnostics from `cfg_select!`)
 - #162381 (fix bare urls split text)
 - #162388 (std: fix set_permissions_nofollow on espidf and horizon)
 - #162319 (docs(core): correct ARMv8-M Baseline atomic CAS support)
 - #162341 (add regression test for packus_epi16 issue)
 - #162383 (Add a hint for using `nolimit` to the limiting error message)
 - #162384 (remove EnumSizeOpt)
 - #162390 (remove outdated comment in `UnsafeCell::raw_get` source)
 - #162397 (docs: Ask for ABI documentation in the platform support template)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants