Closed
Description
const fn i((a, b): (u32, u32)) -> u32 { a + b }
Errors with E0022 "arguments of constant functions can only be immutable by-value bindings". The detailed explanation for E0022 is:
Constant functions are not allowed to mutate anything. Thus, binding to an argument with a mutable pattern is not allowed. For example,
const fn foo(mut x: u8) { // do stuff }is bad because the function body may not mutate x.
Remove any mutable bindings from the argument list to fix this error. In case you need to mutate the argument, try lazily initializing a global variable instead of using a const fn, or refactoring the code to a functional style to avoid mutation if possible.
This does not seem to be the correct error message.