Rust 1.96.0

Release published Rust 1.96.0 — the next stable version of the Rust programming language has been released. May 28, 2026; it can be installed using the standard command rustup update stable. The main changes include new range types in core::range, stabilization of macros for pattern matching, stricter behavior for WebAssembly builds, and fixes for two vulnerabilities in Cargo.

Key changes

  • New range types core::range::Range*.
    The standard library has stabilized new variants of ranges: core::range::Range, RangeFrom, RangeInclusive, and their associated iterators. Unlike the old types from core::ops, the new ranges do not directly implement Iterator but are converted to an iterator through IntoIterator. Consequently, such ranges can be Copy, which is convenient for example when storing a range as a field of a structure. Syntax like 0..1 still creates the old range types, but in a future edition of the language, it is planned to transition to the new types.

  • assert_matches! and debug_assert_matches! have been added.
    The new macros allow you to check that a value matches a given pattern. Conceptually, this is similar to assert!(matches!(…)), but on error, it outputs the Debug representation of the value, simplifying diagnostics. These macros were not added to the prelude to avoid conflicts with popular third-party crates, so they need to be explicitly imported from core or std.

  • Modified behavior for WebAssembly targets.
    Rust no longer passes —allow-undefined to the linker for WebAssembly builds. Now, undefined symbols during linking are considered an error instead of being automatically turned into imports from the "env" module. This should identify build errors and incorrect symbol names earlier. The old behavior can be restored if necessary via RUSTFLAGS=-Clink-arg=—allow-undefined or by explicitly specifying the imported wasm module via #[link(wasm_import_module = "env")]

  • Cargo has received security fixes.
    In Rust 1.96.0, two vulnerabilities affecting users of third-party registries have been closed. CVE-2026-5223 is related to the handling of symlinks inside tar archives of crates: a malicious package from a third-party registry could overwrite the cache of another package from the same registry. Starting with Rust 1.96.0, Cargo rejects crate archives with symlinks. CVE-2026-5222 is related to URL normalization for sparse registries and, under rare circumstances, could lead to the Cargo token being sent to a malicious registry. Users of crates.io, according to the Rust team, are not affected by these issues.

  • Changes in the language.
    The release includes Several specific fixes and enhancements: passing expr meta-variable macros to cfg is now allowed, corrected the narrowing of never-type in tuple expressions, fixed rare cases of incorrect type hinting for function arguments, added support for vector registers s390x in inline assembly, and it is once again allowed to use ManuallyDrop type constants as templates — this fixes a regression that appeared in Rust 1.94.0.

  • Changes in the compiler and platforms.
    For Linux targets on LoongArch, support for link relaxation has been enabled — an optimization for linking that allows simplifying some jumps and calls after the code placement. For riscv64gc-unknown-fuchsia, the base configuration has been updated to the RVA22 profile with support for vector extensions.

  • Updates to the standard library.
    Support for iterating over NonZero integer ranges has been added. Additionally, the deferred processing of host addresses in SGX through ToSocketAddr has been fixed, and the definition of memory ‘valid for reading/writing’ has been clarified in the documentation and internal contracts: the null pointer has been excluded from the general definition, while exceptions are specified separately for specific methods.

  • Stabilized APIs.
    Among the stabilized interfaces are assert_matches!, debug_assert_matches!, implementations of From for AssertUnwindSafe, LazyCell, and LazyLock, as well as new types and range iterators from core::range, including Range, RangeFrom, RangeToInclusive and their iterators.

  • Cargo: changes for dependencies and documentation.
    A dependency can now simultaneously point to a Git repository and an alternative registry: the Git version will be used locally, and the version from the registry will be used upon publication, similar to the behavior with crates.io. Support for target.'cfg(..)'.rustdocflags has also been added to the Cargo configuration.

  • Rustdoc has become more precise in handling documentation.
    Notes about deprecated APIs are now rendered as regular documentation, without the previous special handling through white-space: pre-wrap. Additionally, rustdoc no longer emits lint missing_doc_code_examples for items within impl, and on the documentation sidebar, methods and associated functions are separated distinctly.

  • Potential incompatibilities.
    The release includes several changes that may affect unusual code: the layout of some #[repr(Int)] enums has been fixed in edge cases, some unnecessary unsize coercions in Pin are now prohibited, WebAssembly builds will crash on undefined symbols, the accidentally stabilized attribute #![reexport_test_harness_main] is now closed off by a feature gate, the -Csoft-float parameter has been removed, and the minimum version of the external LLVM has been raised to 21. For AVR, the type c_double has been changed to f32, as C double defaults to 32-bit for these targets.

Source: linux.org.ru

Buy reliable website hosting with DDoS protection, VPS VDS servers 🔥 Buy reliable website hosting with DDoS protection, VPS VDS servers | ProHoster