External Publication
Visit Post

Introduce a way to construct Range from start + length

Rust Internals [Unofficial] March 12, 2026
Source

If there was impl BitAnd<RangeTo> for RangeFrom with Output=Range that returned the intersection (semantically very close to and logic) then you could do from.. & ..to

Extended to the rest of the Range types, the intersection operator could be useful for treating Ranges as general interval types.

Then the question is whether BitOr should be overloaded to mean union, but a union of 2 continuous intervals is not necessarily a continuous interval (representable by Range) so maybe not because it doesn't seem obvious what to return there.

Discussion in the ATmosphere

Loading comments...