E4086#
这个函数需要标签,但没有提供。
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.
}
建议#
检查函数的签名并提供正确的标记参数。
pub fn f(name~ : String) -> Unit {
println("Hello, \{name}")
}
fn main {
f(name="John")
}