-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Description
So in #rustlang trait implementations on arrays are only implemented to maximum hardcoded 32 elements. I was bitten by this today, and I couldn't figure this out for a while. This would compile if you remove 5 since it would fit in 32 elems but the real solution is to call .iter() and not rely on IntoIter. This of course was reduced to simple case and my original problem appeared in a more complex expression with a lot extra clutter.
I realize this is probably gonna be solved with advent of const generics but I'm not sure how far or close they are. This is also mentioned in array docs., but in the meantime maybe #rustlang rustc compiler could give better diagnostic message for this particular case. I was banging my head really hard on this one.
Maybe it could detect hard coded 32 and point to the passage in array docs that mentions these limitations and offer some hints like calling .iter() in this case. Not sure what could be detected and done here exactly.