Hasty Briefsbeta

Bilingual

Stabilizing Rust's Never Type

21 days ago
  • Rust's never type (!) marks functions that never return and is used for infallible conversions and type inference.
  • Stabilized after two years of work by waffle, involving a breaking change to the fallback type (from () to ! in the 2024 edition).
  • The never type was previously unstable, with a workaround using the Infallible type in the standard library.
  • Breaking changes required simultaneous updates: making Infallible a type alias for ! and changing the fallback type.
  • Crater analysis found 3300 crates affected, but only 7 fully broken; most issues were fixed by backporting patches.
  • Backward compatibility was maintained through warnings, the edition system, and community collaboration.
  • Users can stay on older Rust versions, update dependencies, or add explicit type annotations to fix broken code.