Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

document where various bits of rust are desugared #94

Open
4 tasks
nikomatsakis opened this issue Mar 19, 2018 · 6 comments
Open
4 tasks

document where various bits of rust are desugared #94

nikomatsakis opened this issue Mar 19, 2018 · 6 comments
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

Comments

@nikomatsakis
Copy link
Contributor

nikomatsakis commented Mar 19, 2018

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).

Desugaring that occur during MIR lowering

While lowering to MIR, we perform the following desugarings:

@mark-i-m mark-i-m added E-help-wanted Call for participation: extra help is wanted E-easy Difficulty: might be a good place for a beginner E-medium Difficulty: might require some prior knowledge or code reading labels Mar 19, 2018
@balajisivaraman
Copy link

@nikomatsakis, I'd be interested in picking this up. I'll go through the current guide, and then get started with adding this, if that's OK.

@mark-i-m mark-i-m removed the E-help-wanted Call for participation: extra help is wanted label Apr 2, 2018
@ghost
Copy link

ghost commented May 6, 2018

@nikomatsakis I was planning to document with 3 points for every construct that is desugared

  • which expression are they desugared to and what are their contents e.g. if let to match
  • equivalent rust code - what would be nice to do here, document the corresponding desugared Rust code?or do we want to actually highlight the hir code inside rustc which does this?
  • special mechanisms, unfortunately I have never contributed to rustc so I am actually using this to get into rust, could you please give pointers to special mechanisms I could research?

@mark-i-m
Copy link
Member

mark-i-m commented May 8, 2018

Ping @balajisivaraman Any updates?

Also ping @nikomatsakis, I don't really have the knowledge to help anyone on this issue.

@balajisivaraman
Copy link

@mark-i-m, Unfortunately no, sorry. I'm still in the early stages of going through the current Rustc Guide, while working on a small fix to the compiler itself. It's going to be some time before I'm capable enough of actually making this change. If we have a deadline on this, someone else can pick it up.

Apologies again!

@mark-i-m
Copy link
Member

mark-i-m commented May 8, 2018

@balajisivaraman No worries :)

@jieyouxu jieyouxu added E-hard Difficulty: might require advanced knowledge C-enhancement Category: enhancement A-MIR Area: mid-level intermediate representation (MIR) A-HIR Area: high-level intermediate representation (HIR) A-THIR Area: typed high-level intermediate representation (THIR) T-compiler Relevant to compiler team A-desugaring Area: how constructs are desugared over various IR lowerings and removed E-easy Difficulty: might be a good place for a beginner E-medium Difficulty: might require some prior knowledge or code reading labels Nov 4, 2024
@jieyouxu
Copy link
Member

jieyouxu commented Nov 4, 2024

Triage: AFAIK HAIR isn't a thing now and it's probably more like THIR plus some build-phase MIR? But still good to describe what constructs gets desuguared between the various IRs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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
Projects
None yet
Development

No branches or pull requests

4 participants