Phased Initialization
At this stage, some compound value expressions remain, namely struct, enum and union constructors. In this step we desugar those into individual assignments, using Phased Initialization.
#![allow(unused)] fn main() { x = Struct { a: $expr_a, b: $expr_b }; // becomes: x.a = $expr_a; x.b = $expr_b; }
#![allow(unused)] fn main() { x = Enum::Variant { a: $expr_a, b: $expr_b }; // becomes: x.Variant.a = $expr_a; x.Variant.b = $expr_b; x.enum#discriminant = discriminant_of!(Enum, Variant)); }
Note that we don't desugar tuple struct/enum constructors since these are semantically function calls.
The one aggregate we keep is array repeat expressions [$expr; $const].