Rust Updates Core Range Types in Version 1.96.0
TL;DR. The Rust team released version 1.96.0, introducing new Range types to improve software reliability and efficiency. - The update stabilizes core::range types, enabling Copy for storage of slice accessors without splitting. - New macros, assert_matches! and debug_assert_matches!, improve failure diagnosis in pattern matching. - Library authors should consider implementing impl RangeBounds for future compatibility.
- Rust 1.96.0 introduces new core::range types (Range, RangeFrom, RangeInclusive) which implement IntoIterator and are Copy-able.
- This update allows storing slice accessors in Copy types without splitting start and end points, fixing a previous 'footgun'.
- New assert_matches! and debug_assert_matches! macros provide clearer diagnostics for pattern matching failures.
- Future updates will default to the new Range types, making them preferred for library authors.
- The new RangeInclusive type makes its fields public, unlike its legacy counterpart.
Sources
- Announcing Rust 1.96 — blog.rust-lang.org