rust-lang / rust-lang/rustc-dev-guide

document where various bits of rust are desugared

Open
#94 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-desugaring A-HIR A-MIR A-THIR C-enhancement E-hard T-compiler
Dominant language
HTML
Stars
1.9k
Forks
613
Avg merge
17h 24m
Merged PRs (30d)
39

Description

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:

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked HIR lowering.rs locations, the HAIR pattern code in src/librustc_mir/hair/pattern/mod.rs, and the MIR matches directory. Trace the listed HIR, HAIR, and MIR transformations, then expand the checklist into a high-level writeup with equivalent Rust examples and the relevant mechanisms; done means the documented desugarings cover the listed cases and compilation stages.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers, documentation
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.