Open Source & Tools

Rust makes the never type official

Rust 1.100 stabilises the never type and gives Cargo a way to flag unused dependencies.

In brief

  • Rust can now express an impossible error directly in a type such as Result<T, !>.
  • Cargo can flag unused dependencies when the build covers every target that could use them.

Primary source Official release notes

Announcing Rust 1.100.0

The Rust Release Team ·

What remains open. Cargo’s check covers only dependency groups whose relevant targets were built. Existing code can also encounter changes to never-type inference.

Generated editorial illustration

What changed

Rust 1.100 stabilises the never type, written !, in positions where stable Rust previously could not name it. The type has no possible values. A function that exits the process or otherwise never returns gives a simple example of a computation that cannot produce a value for its caller. [1]

This matters for interfaces that describe which outcomes are possible. An infallible conversion can now use ! in the error position of a Result, making it explicit that the error case cannot be constructed. The release also changes a fallback rule for inferred types in editions before 2024. Teams updating a toolchain should check any new compiler errors against the release notes. [1]

A useful Cargo change

Cargo now reports unused dependencies where it has seen all the build targets that can use them. That matters in a package with multiple binaries. A dependency absent from one executable can still be essential to another. A command that builds only one binary cannot establish that the manifest entry is safe to remove. [1]

What to watch next

For maintainers, the practical test is a build across the relevant targets of a real workspace. Compare the warnings with dependencies the team knows are cross-platform or shared before removing entries from a manifest.

Sources

  1. Announcing Rust 1.100.0

    The Rust Release Team · Official release notes ·