mmtk::util::rust_util

Function array_from_fn

source
pub(crate) fn array_from_fn<T, const N: usize, F>(cb: F) -> [T; N]
where F: FnMut(usize) -> T,
Expand description

This implements std::array::from_fn introduced in Rust 1.63. We should replace this with the standard counterpart after bumping MSRV, but we also need to evaluate whether it would use too much stack space (see code comments).