External Publication
Visit Post

Introduce a way to construct Range from start + length

Rust Internals [Unofficial] March 13, 2026
Source

toc:

(start..)[..count]

I think this is impossible, since indexing operator can only return values in places that already exist, given the signature

fn index(&self, index: Idx) -> &Self::Output;

(note the connected lifetime of &Self::Output to &self from elision)

and (start..)[..count] would then desugar to *Index::index(&(start..), ..count)). But start.. of course does not happen to already contain the result of calculating start..start+count (for every possible value of count) inside of it

CodesInChaos:

However it's still ambiguous with a.. + b.

a.. + b doesn’t actually parse successfully, since + has higher precedence than .. - so the only place this sequence of tokens can currently come up is in macros that never end up parsing them as an expression at all.

Discussion in the ATmosphere

Loading comments...