E0059
Error
print or eprint of something it cannot print
Errorprint and eprint take exactly one argument, an i64, a u8, a bool, a char or a string, and write it on its own line: print to standard output, eprint to standard error. The message names the function that was called.
Why
An object, an optional or a call that returns nothing has no one way to be printed. A program prints the fields or the payload it means, one print or eprint each.
Broken
class Point {
x: i64
}
fn main() {
let p = Point(x: 1)
print(p)
}
What sisu says
error[E0059]: cannot print `Point` --> E0059.sisu:7:11 | 7 | print(p) | ^ | = help: `print` takes one `i64`, `u8`, `f64`, `bool`, `char` or `string` sisu: 1 error sisu: for more on a code, run `sisu explain <code>`: E0059
Fixed
class Point {
x: i64
}
fn main() {
let p = Point(x: 1)
print(p.x)
}
Related
- E0060:
printoreprintof an array.
Sisu