Hacker News new | ask | show | jobs
by tomjakubowski 1416 days ago
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

2 comments

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`