Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

That isn't really inferring the size of the array though. [T; N]::map(impl FnMut(T) -> U) defines its return type as [U; N]. N is fixed at the original array literal.

https://doc.rust-lang.org/std/primitive.array.html



It's inferring it from the array literal in the first place, but it is a different kind of inference from the original one. But I think that's what the question was asking for:

> What's a sane/legit use case of such inferring in general?

Depends how you interpret "such inferring"


It's inferring the size of `doubled`




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: