E0432: Borrow keyword missing
| Code | Category | Stability |
|---|---|---|
E0432 | Struct and enum | Permanent |
Explanation
A call passes an argument to a borrow parameter without the required borrow mode: the argument is unmarked or is marked inout. The call site must select shared read-only access exactly.
Likely cause
The callee's parameter was changed to borrow, or the call uses no marker or the wrong marker. Add or replace the marker with borrow, or change the parameter mode if the callee should take the value by ownership.
Examples
Omit the borrow call-site marker
fn read(borrow value: i32) -> i32 { value }
fn main() -> i32 {
let value = 42;
read(value)
}
Mark the shared argument
fn read(borrow value: i32) -> i32 { value }
fn main() -> i32 {
let value = 42;
read(borrow value)
}