External Publication
Visit Post

Introduce a way to construct Range from start + length

Rust Internals [Unofficial] March 12, 2026
Source

It's maybe less a footgun in Rust due to strong integer typing; you know when it's a usize vs a isize. On the other hand, you may want a isize but forget to cast and have usize overflow auto-wrapping, so you enter another category of error prone. Anyway, I agree with you.

It's a bit annoying that sometime, you need [..s.len() - 1] but you already have a mutable reference on s so you need to extract s.len() in a variable, but that's rare enough to make with it.

Discussion in the ATmosphere

Loading comments...