E0055
Labeled argument in a call
ErrorOnly a constructor takes labels on its arguments: Point(x: 1). A function call, a method call and print take plain arguments in parameter order. A variant takes labels only when it declares them, Shape.Rect(w: 2, h: 3); a variant that declares none, Expr.Num(2), takes plain arguments too.
Why
Labels on the arguments of function calls are planned. Until they arrive, a label there is reported, not ignored, so a program does not rely on a meaning that has not arrived. On a variant, the labels say which payload field each argument fills, so a variant without them has nothing to match a label against. The fix there removes the labels, but as an unsafe fix: a label may name the field you meant to declare.
Broken
fn double(n: i64) -> i64 {
n * 2
}
fn main() {
print(double(n: 2))
}
What sisu says
error[E0055]: this call takes no labels on its arguments --> E0055.sisu:6:18 | 6 | print(double(n: 2)) | ^ | = help: remove the labels: only a constructor, or a variant that declares labels, takes labeled arguments sisu: 1 error sisu: for more on a code, run `sisu explain <code>`: E0055
Fixed
fn double(n: i64) -> i64 {
n * 2
}
fn main() {
print(double(2))
}
Sisu