Introduce a way to construct Range from start + length
Rust Internals [Unofficial]
March 13, 2026
appleGun22:
Doesn't have a possibility to express an invalid (
start > end) range
It still does, just via things like 200_u8 ..+ 100.
appleGun22:
Is generally the more natural way to express a range
Unfortunately it works very poorly with general ranges in other places. "a".."b" works fine, and is even used in things like BTreeMap methods.
But if you had something like "a" ..+ 10, what does that mean? It clearly can't implement RangeBounds in std::ops - Rust, for example.
I think if you want the "counted" part, separating it out is useful. my_btree.range(start..).take(count), for example, works well.
appleGun22:
Reduce boilerplate (repeating
start)
How about just a function? Range::from_start_and_len(start, length) would be fine, no new type.
Discussion in the ATmosphere