Sisu
E0074

Assignment to a function

Error

Built from the repository at commit a8614dc.

The left side of = names a function, not a variable.

Why

A function's name stands for its code, which does not change while the program runs. Only a variable, a field or an element of an array can take a new value.

Broken

fn one() -> i64 {
    1
}

fn main() {
    one = 2
    print(one())
}

What sisu says

error[E0074]: `one` is a function, not a variable
 --> E0074.sisu:6:5
  |
6 |     one = 2
  |     ^^^

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

Fixed

fn one() -> i64 {
    1
}

fn main() {
    let mut n = one()
    n = 2
    print(n)
}