rust-lang / rust-lang/rustc-dev-guide
Not clear sentence "Eager expansion generally performs a subset of the things that lazy (normal) expansion does."
Nobody has claimed this yet.
- 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 fear the sentence
Eager expansion generally performs a subset of the things that lazy (normal) expansion does.
is not clear. And I'd suggest, maybe, to give an example in order to clarify it.
I could imagine that you mean that, in the following example
macro bar($i: ident) { $i }
macro foo($i: ident) { $i + $i }
foo!(bar!(5))
an eager expansion would lead to a single expansion of bar while the normal expansion will lead to two expansions of bar .
However, the query system that was described in the previous section seems to indicate that the expansion would consist in a single query call with a cached result, so that would be very cheap.
Also, if we consider
macro bar($i: ident) { $i }
macro foo($i: ident) { }
foo!(bar!(5))
an eager expansion would lead to expending bar, while a normal expansion would avoid this expansion; showing that there are also case where the eager expansion do more work.
My best hypothesis, to be honest, right now, is that the sentence should be read with eager and lazy reversed
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the macro-expansion.html page and read the sections around the quoted eager-expansion sentence and the preceding query-system discussion. Check the two Rust macro examples against the documented behavior, then clarify the sentence and add an example if that comparison confirms the ambiguity. Done means the distinction between eager and lazy expansion is unambiguous.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100