I'm trying to pass an array to a function:
fn my_func(xs: [usize]) -> usize {
0
}
fn main() {
let arr = [329, 457, 657];
let res = my_func(inp);
}
I get the error:
error[E0277]: the trait bound `[usize]: std::marker::Sized` is not satisfied
--> src/main.rs:1:12
|
1 | fn my_func(xs: [usize]) -> usize {
| ^^ `[usize]` does not have a constant size known at compile-time
|
= help: the trait `std::marker::Sized` is not implemented for `[usize]`
= note: all local variables must have a statically known size
I know about these other questions but they don't seem to apply to my simple situation.
How can I fix the error?