Closed
Description
It would be very nice if
let array = [$expression; N];
was syntactic sugar for
let array = [$expression, $expression, $expression, ...];
This would allow things like
let bools = [AtomicBool::new(false); 10];
let array: [T; 10] = [Default::default(); 10];
Currently it only works for values that implement Copy
. For the use case above, there is currently not really any alternative to just writing [$expr, $expr, ...]
.
I think this is a backwards-compatible change.