Sisu
E0029

main with a wrong signature

Error

Built from the repository at commit a8614dc.

main takes no parameters, or one [string], and returns no value.

Why

Only the program's start calls main. It passes the command-line arguments, without the program name, to a main that takes a [string], and nothing to one that takes no parameters. Nothing reads what main returns: the program ends when main does.

main takes no type parameters either: nothing calls it with type arguments, so fn main<T>() has nothing for T to stand for. The fix removes the list, when nothing in main names its parameters.

Broken

fn main(argc: i64, argv: [string]) {
    print(argc)
}

What sisu says

error[E0029]: `main` takes no parameters, or one `[string]`, and returns no value
 --> E0029.sisu:1:4
  |
1 | fn main(argc: i64, argv: [string]) {
  |    ^^^^

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

Fixed

fn main(args: [string]) {
    print(args.len())
}