document where various bits of rust are desugared #94
Labels
A-desugaring
Area: how constructs are desugared over various IR lowerings
A-HIR
Area: high-level intermediate representation (HIR)
A-MIR
Area: mid-level intermediate representation (MIR)
A-THIR
Area: typed high-level intermediate representation (THIR)
C-enhancement
Category: enhancement
E-hard
Difficulty: might require advanced knowledge
T-compiler
Relevant to compiler team
It's been mentioned to me that it would be useful to have a list of all the "desugarings" that occur during the compilation process. In particular, which bits of Rust disappear during e.g. HIR conversion, HAIR conversion, MIR conversion. Here are some notes, I'd love to see someone turn some of this into a more detailed writeup! If you're interested, ping me here or (better) on gitter/IRC.
Desugaring that occur during HIR lowering
While constructing the HIR, we perform the following desugarings. It seems worth documenting these at a high-level (e.g, showing the equivalent Rust code), as well as covering some of the mechanisms we use to do it (e.g., the special spans we construct).
?
operator andcatch
blocksfor
loopif let
andwhile let
formsDesugaring that occur during MIR lowering
While lowering to MIR, we perform the following desugarings:
match
expressions&
patterns to implement default binding modesThe text was updated successfully, but these errors were encountered: