Skip to content

add #[rustc_no_writable] to slice::get_unchecked_mut#157202

Open
quiode wants to merge 1 commit into
rust-lang:mainfrom
quiode:add-rustc_no_writable-more-fns
Open

add #[rustc_no_writable] to slice::get_unchecked_mut#157202
quiode wants to merge 1 commit into
rust-lang:mainfrom
quiode:add-rustc_no_writable-more-fns

Conversation

@quiode
Copy link
Copy Markdown
Contributor

@quiode quiode commented May 31, 2026

This PR adds the #[rustc_no_writable] attribute introduced in #155207 to the slice::get_unchecked_mut function.

Two library functions already received this attribute, as they were known to cause problems with the llvm writable attribute and tree borrows. Since that PR, I ran Miri on the 30'000 most downloaded crates to see what kind of code is now UB under Tree Borrows + implicit writes, using the detection implemented in rust-lang/miri#4947. Adding this attribute to ignore checking for this function reduced the new UB introduced by more than 75%, meaning that instead of 19000 tests in 1700 crates having a difference, now only 3500 in 350 crates show a difference (measurement still running).

@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 May 31, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented May 31, 2026

r? @Mark-Simulacrum

rustbot has assigned @Mark-Simulacrum.
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 7 candidates
  • Random selection from Mark-Simulacrum, jhpratt

@quiode
Copy link
Copy Markdown
Contributor Author

quiode commented May 31, 2026

r? @RalfJung

@rustbot rustbot assigned RalfJung and unassigned Mark-Simulacrum May 31, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented May 31, 2026

RalfJung is not on the review rotation at the moment.
They may take a while to respond.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants