]> git.lizzy.rs Git - rust.git/commit
Auto merge of #75212 - JulianKnodt:array_map, r=LukasKalbertodt
authorbors <bors@rust-lang.org>
Thu, 13 Aug 2020 12:43:12 +0000 (12:43 +0000)
committerbors <bors@rust-lang.org>
Thu, 13 Aug 2020 12:43:12 +0000 (12:43 +0000)
commita0c290f951076d781b0ff08370445517446cee05
tree19eb1d8ba7b30c480dddd4a86dcb3e8de42f5b91
parent1a7d9f52bc3545631c7485dce65b31742ef81c4d
parentaf32db21c8e1b1970886eb64b9955f9590e4c445
Auto merge of #75212 - JulianKnodt:array_map, r=LukasKalbertodt

Add `array` lang item and `[T; N]::map(f: FnMut(T) -> S)`

This introduces an `array` lang item so functions can be defined on top of `[T; N]`. This was previously not done because const-generics was not complete enough to allow for this. Now it is in a state that is usable enough to start adding functions.

The function added is a monadic (I think?) map from `[T; N] -> [S; N]`. Until transmute can function on arrays, it also allocates an extra temporary array, but this can be removed at some point.

r? @lcnr