External Publication
Visit Post

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

Rust Internals [Unofficial] April 22, 2026
Source

The core thing to me with this is that if you did this, I expect someone will change it back to the other way since it's "obviously" unnecessary.

What's your plan to have a test for it to keep it from regressing?


But at a broader level, note that .len() is special. We do things like rust/compiler/rustc_mir_transform/src/lower_slice_len.rs at main · rust-lang/rust · GitHub that special-case it already. It's special in the ABI since .len() is actually just looking at a function parameter, etc.

So I think you should just support this. Could probably even enable that particular mir pass if you need it.

Discussion in the ATmosphere

Loading comments...