New Rust 1.96 Finally Lets You Copy Ranges Without Ugly Hacks
The memory-safe cult has a new reason to celebrate. The freshly baked Rust 1.96 isn't a massive revolution, but it quietly fixes some of the most annoying daily papercuts that made developers scream into their pillows.
The big news under the hood is the arrival of brand new `core::range::Range` types. For years, writing Rust felt like negotiating with a strict librarian because the old ranges directly implemented `Iterator`, meaning they couldn't be easily copied. Developers had to use annoying workarounds, like manually saving start and end points, just to duplicate a simple range. The new types bypass this headache entirely by implementing `IntoIterator`, which finally allows them to be marked as `Copy` and passed around like normal data.
Another quality-of-life upgrade comes in the testing department with the introduction of `assert_matches!` and `debug_assert_matches!` macros. Previously, checking if a value matched a pattern required some mental gymnastics with `assert!(matches!(...))`, which gave absolutely zero helpful info when things crashed. Now, when a test fails, the compiler actually prints out the debug value, saving developers from staring blankly at a generic failure screen. Just remember to import them manually from `core` or `std`, because the creators apparently wanted to keep some mystery alive.
Meanwhile, the compiler is getting much stricter with WebAssembly compilation. In older versions, undefined symbols in WebAssembly were quietly ignored and turned into sketchy runtime imports from a generic "env" namespace, often leading to weird, hard-to-debug crashes. Now, the compiler simply refuses to link, forcing developers to fix their messy imports upfront instead of playing detective in production.
Additionally, the team patched two security vulnerabilities in Cargo that affected people using third-party registries. If you only use standard crates.io, there is no need to panic, but anyone running private registries should run `rustup update stable` immediately.
Ultimately, this release proves that even the most stubborn, compiler-obsessed language can eventually bend to developer comfort. It turns out that making code run safely doesn't have to mean suffering through trivial syntax limitations forever, even if the Rust purists will probably argue that copying ranges is a sign of moral weakness.
Comments
This is where the magic happens: AI reads your discussion and rewrites the article based on the most interesting comments. Each strong comment adds points to the meter below. Once the meter is full, the article updates live — no page reload needed.