Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions library/core/src/slice/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -681,6 +681,7 @@ impl<T> [T] {
#[must_use]
#[track_caller]
#[rustc_const_unstable(feature = "const_index", issue = "143775")]
#[rustc_no_writable]
Copy link
Copy Markdown
Member

@Mark-Simulacrum Mark-Simulacrum May 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this get an annotation of some kind (e.g., "FIXME: #xxx")? I assume the intent is not to guarantee that we don't have compiler-added writes of the full slice, maybe with the long-term intent being that users move to using raw pointer functions where they need that (https://doc.rust-lang.org/nightly/std/primitive.pointer.html#method.get_unchecked_mut)?

View changes since the review

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personally I think this is fine to guarantee. But for now the attribute is experimental anyway.

Copy link
Copy Markdown
Member

@RalfJung RalfJung Jun 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a Miri test that relies on this attribute. Something like https://rust.godbolt.org/z/TreEYqfW8, I assume?

View changes since the review

pub const unsafe fn get_unchecked_mut<I>(&mut self, index: I) -> &mut I::Output
where
I: [const] SliceIndex<Self>,
Expand Down
Loading