Sisu
E0048

?? on a value that is not optional

Error

Built from the repository at commit a8614dc.

The left side of ?? is the optional that may be None. The right side is the value to use then.

Why

?? supplies a default for a missing value. A value that is not optional is never missing, so the default would never be used.

Broken

fn main() {
    let n = 5
    print(n ?? 0)
}

What sisu says

error[E0048]: the left side of `??` is not optional
 --> E0048.sisu:3:11
  |
3 |     print(n ?? 0)
  |           ^

sisu: 1 error
sisu: for more on a code, run `sisu explain <code>`: E0048

Fixed

fn main() {
    let n: i64? = 5
    print(n ?? 0)
}