External Publication
Visit Post

Introduce a way to construct Range from start + length

Rust Internals [Unofficial] March 28, 2026
Source

I know that in general using inclusive ranges are slower than exclusive ranges, since the type needs to keep track of if it reached the end separately (in case the ending value is one that would overflow).

However, I don't know if rustc can optimise this when the range is known at compile time to not overflow. Otherwise you really should be writing 'a'..'{', which is not ideal for human readers.

Discussion in the ATmosphere

Loading comments...