E4086#
The labels are required by this function, but not supplied.
Sometimes this error occurs when you mistakenly treat a labelled argument as a positional argument. There are some common functions that require labelled arguments, such as:
@test.snapshot
. Remember to supplyfilename
as a labelled argument.@test.inspect
. Remember to supplycontent
as a labelled argument.
错误示例#
pub fn f(name~ : String) -> Unit {
println("Hello, \{name}")
}
fn main {
f("John") // Error: The labels name~ are required by this function, but not supplied.
}
建议#
Check the signature of the function and provide the correct labelled argument.
pub fn f(name~ : String) -> Unit {
println("Hello, \{name}")
}
fn main {
f(name="John")
}