External Publication
Visit Post

[Pre-RFC] A tiny internal change to `reverse`, `copy_from_slice`, `swap_with_slice`

Rust Internals [Unofficial] April 23, 2026
Source

I don't know if I'd say this is a good way to think of it, but a slice reference is kind of a pointer/metadata pair (where the metadata is the length), so as_mut_ptr could be seen as exclusively borrowing the pointer part but not the metadata part, similar to what you can do with separate fields of tuples (or structs). It wouldn't have to only be an optimization thing. (The special bit would then be that you're doing it using methods instead of direct field access, but at least that's instantaneous special behavior rather than ongoing, and something at least some people would like to support for arbitrary methods some day.)

Discussion in the ATmosphere

Loading comments...