bynk.types.never_inferred
Error An unannotated let or <- binding has a type that is, or contains, the bottom type (never returns) because its value only faults (a faulting lambda bound this way included); the type cannot be written in source, so an annotation is needed.
A value that only faults, such as unreachable("…") or todo("…"), has the bottom type never returns, which stands in for any type. If an unannotated let or <- binding took it, every later use would type-check whatever it was used as, and the type cannot be written in source to say otherwise. Annotate the binding with the type it is meant to have. A lambda that only faults is annotated with a function type.
Example
fn later() -> Int { let x = unreachable("never") // ✗ `x` would have no usable type x}
fn later() -> Int { let x: Int = unreachable("never") // ✓ x}In the Book
See also
- The grammar rule it governs:
let_stmt. - Every code in its category, Type checking, on the diagnostic index.
bynk explain bynk.types.never_inferredshows the same from the installed toolchain, without a network.