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

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

I think a comment explaining why those functions would be written that way should be enough to dissuade Rust maintainers from rewriting it without a stronger reason.

But at a broader level, note that .len() is special. (...)

As far as I understand, these special cases are motivated by performance, or are there any that affect the functional behavior of .len()?

I can recognize that what I'm proposing is a hard sell. Even if my proposal doesn't win, what I'm hoping to get out of this discussion is also a clearer understanding of what makes self.len() special in this context, if it is indeed special.

Discussion in the ATmosphere

Loading comments...