Error codes

E0251: ! on a value that is not T? or T!

In a terminal: auk explain E0251 prints this page.

On this page

Postfix ! unwraps a T? or T! and panics on a missing value or error. The value here can't be missing or fail, so the ! does nothing (and isn't a "not"; that's prefix !x).

Wrong#

auk
fn main() {
  let n = 1
  print(n!)
}

Fixed#

auk
fn main() {
  let n = 1
  print(n)
}

Common causes#

  • A leftover ! after a function stopped returning T? or T!.
  • Rust-style macro syntax (print!): Auk has none.

Stuck on a word? Try the glossary. Got a compiler error? Look up its code. Improve this page