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

In macro expansion section, explains why import and collections must be redone

Open
#1,873 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-macros E-hard I-terse T-compiler
Dominant language
HTML
Stars
1.9k
Forks
613
Avg merge
17h 24m
Merged PRs (30d)
39

Description

In https://rustc-dev-guide.rust-lang.org/macro-expansion.html , I'd suggest adding slightly more explanations to the part 2.1 and 2.2. I can guess why they are here but I admit I'm far from certains of being right.

2.1. I would have assume that you don't need to resolve imports at each iteration; that would be wasted work. The only exception I could think of would be if, while expanding a macro, you create new imports. But in this case, 2.4.3. may even consider this case with "integrating its output"

2.2. Similarly, I'd expect that all macro invocations were collected either at step 1, or or at 2.4.3. Unless there is a difference between "unresolved macro" and "macro invocation". In which, I'd really appreciate a clarification.

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

Read the macro expansion section at rustc-dev-guide.rust-lang.org/macro-expansion.html, focusing first on parts 2.1 and 2.2 and their relationship to 2.4.3. Clarify why imports and macro invocations are revisited, including whether unresolved macros differ from macro invocations, so the guide explains the behavior requested in the issue.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.