-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Closed
Labels
T-langRelevant to the language team, which will review and decide on the RFC.Relevant to the language team, which will review and decide on the RFC.
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.
HadrienG2, stephank, emillaine, crumblingstatue, sarthakn7 and 9 more
Metadata
Metadata
Assignees
Labels
T-langRelevant to the language team, which will review and decide on the RFC.Relevant to the language team, which will review and decide on the RFC.