Sisu
E0061

print or eprint of an expression that never finishes

Error

Built from the repository at commit a8614dc.

The argument of print or eprint must finish with a value. An expression such as an if whose branches all return, or a panic, never does, so the call never runs.

Why

A print or eprint that can never write is a mistake: the program meant to write a value, or meant the return or panic without the call.

Broken

fn report(ok: bool) {
    print(if ok { return } else { return })
}

fn main() {
    report(true)
}

What sisu says

error[E0061]: `print` never runs: its argument never finishes
 --> E0061.sisu:2:11
  |
2 |     print(if ok { return } else { return })
  |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

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

Fixed

fn report(ok: bool) {
    print(if ok { 1 } else { 0 })
}

fn main() {
    report(true)
}

Related

  • E0043: another expression without a value.