Sisu
E0046

is on something that is not an object

Error

Built from the repository at commit a8614dc.

is tests identity, so both sides must be objects: values of a class, or optionals of one. A number, a bool, a string, an array or an enum value is not.

Why

A number, a string, an array or an enum value is a value. Two of them are the same when they are equal, and == tests that. Identity only makes a difference between objects.

A value whose type is a type parameter T may not be an object, so is does not take it either. Neither does ==, which a type parameter does not have (E0139).

An optional of an optional, such as a Node??, is not an object either: its outer layer can hold a None of the inner one. Peel one layer with ?? first: (a ?? None) is b.

Broken

fn main() {
    let a = 1
    let b = 1
    print(a is b)
}

What sisu says

error[E0046]: `is` needs objects; found `i64`
 --> E0046.sisu:4:11
  |
4 |     print(a is b)
  |           ^
  |
  = help: use `==` to compare values

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

Fixed

fn main() {
    let a = 1
    let b = 1
    print(a == b)
}

Related

  • E0045: is used to test for None.