External Publication
Visit Post

Introduce a way to construct Range from start + length

Rust Internals [Unofficial] March 17, 2026
Source

yaksher:

If a ..+ b was implemented as syntax sugar for a .. (a + b)

It can't be exactly this, because people will expect a to be evaluated only once. It has to be something like { let $temp = a; $temp .. ($temp + b) } instead, and that runs us into the issues discussed up above with what happens when a isn't Copy.

Personally I'd be fine with a requirement for a to be Copy though. My reaction to the "what about "a".."z"?" example up above is "I really don't want people spelling that "a" ..+ 26" (not least because they probably should have written "a" ..+ 25, but +26 is the one that looks right if someone's not reading carefully).

Discussion in the ATmosphere

Loading comments...