@@ -36,14 +36,14 @@ handled in [`rustc_expand::config`][cfg].
36
36
Firstly, expansion happens at the crate level. Given a raw source code for
37
37
a crate, the compiler will produce a massive ` AST ` with all ` macro ` s expanded, all
38
38
modules inlined, etc. The primary entry point for this process is the
39
- [ ` MacroExpander::fully_expand_fragment() ` ] [ fef ] method. With few exceptions, we
39
+ [ ` MacroExpander::fully_expand_fragment ` ] [ fef ] method. With few exceptions, we
40
40
use this method on the whole crate (see [ "Eager Expansion"] ( #eager-expansion )
41
41
below for more detailed discussion of edge case expansion issues).
42
42
43
43
[ `rustc_builtin_macros` ] : https://doc.rust-lang.org/nightly/nightly-rustc/rustc_builtin_macros/index.html
44
44
[ reb ] : https://doc.rust-lang.org/nightly/nightly-rustc/rustc_expand/build/index.html
45
45
46
- At a high level, [ ` fully_expand_fragment() ` ] [ fef ] works in iterations. We keep a
46
+ At a high level, [ ` fully_expand_fragment ` ] [ fef ] works in iterations. We keep a
47
47
queue of unresolved ` macro ` invocations (i.e. ` macro ` s we haven't found the
48
48
definition of yet). We repeatedly try to pick a ` macro ` from the queue, resolve
49
49
it, expand it, and integrate it back. If we can't make progress in an
@@ -67,7 +67,7 @@ iteration, this represents a compile error. Here is the [algorithm][original]:
67
67
each of which are a token (punctuation, identifier, or literal) or a
68
68
delimited group (anything inside ` () ` /` [] ` /` {} ` )).
69
69
- At this point, we know everything about the ` macro ` itself and can
70
- call [ ` set_expn_data() ` ] to fill in its properties in the global
70
+ call [ ` set_expn_data ` ] to fill in its properties in the global
71
71
data; that is the [ hygiene] data associated with [ ` ExpnId ` ] (see
72
72
[ Hygiene] [ hybelow ] below).
73
73
2 . Integrate that piece of ` AST ` into the currently-existing though
@@ -88,7 +88,7 @@ iteration, this represents a compile error. Here is the [algorithm][original]:
88
88
- Names are put into modules (from the resolver's point of
89
89
view) by [ ` BuildReducedGraphVisitor ` ] .
90
90
3 . After expanding a single ` macro ` and integrating its output, continue
91
- to the next iteration of [ ` fully_expand_fragment() ` ] [ fef ] .
91
+ to the next iteration of [ ` fully_expand_fragment ` ] [ fef ] .
92
92
5 . If it's not resolved:
93
93
1 . Put the ` macro ` back in the queue.
94
94
2 . Continue to next iteration...
@@ -100,7 +100,7 @@ iteration, this represents a compile error. Here is the [algorithm][original]:
100
100
[ `ExpnId` ] : https://doc.rust-lang.org/nightly/nightly-rustc/rustc_span/hygiene/struct.ExpnId.html
101
101
[ `InvocationCollector` ] : https://doc.rust-lang.org/nightly/nightly-rustc/rustc_expand/expand/struct.InvocationCollector.html
102
102
[ `NodeId` ] : https://doc.rust-lang.org/nightly/nightly-rustc/rustc_ast/node_id/struct.NodeId.html
103
- [ `set_expn_data() ` ] : https://doc.rust-lang.org/nightly/nightly-rustc/rustc_span/hygiene/struct.LocalExpnId.html#method.set_expn_data
103
+ [ `set_expn_data` ] : https://doc.rust-lang.org/nightly/nightly-rustc/rustc_span/hygiene/struct.LocalExpnId.html#method.set_expn_data
104
104
[ `SyntaxContext` ] : https://doc.rust-lang.org/nightly/nightly-rustc/rustc_span/hygiene/struct.SyntaxContext.html
105
105
[ `TokenStream` ] : https://doc.rust-lang.org/nightly/nightly-rustc/rustc_ast/tokenstream/struct.TokenStream.html
106
106
[ defpath ] : hir.md#identifiers-in-the-hir
@@ -262,7 +262,7 @@ crate.
262
262
All of these hierarchies need some sort of "`macro` ID" to identify individual
263
263
elements in the chain of expansions. This ID is [`ExpnId`]. All `macro`s receive
264
264
an integer ID, assigned continuously starting from 0 as we discover new `macro`
265
- calls. All hierarchies start at [`ExpnId::root() `][rootid], which is its own
265
+ calls. All hierarchies start at [`ExpnId::root`][rootid], which is its own
266
266
parent.
267
267
268
268
The [`rustc_span::hygiene`][hy] library contains all of the hygiene-related algorithms
@@ -346,7 +346,7 @@ macro m() { ident }
346
346
m!();
347
347
```
348
348
349
- Here ` ident ` originally has context [ ` SyntaxContext::root() ` ] [ scr ] . ` ident ` has
349
+ Here ` ident ` originally has context [ ` SyntaxContext::root ` ] [ scr ] . ` ident ` has
350
350
context ` ROOT -> id(m) ` after it's produced by ` m ` .
351
351
352
352
[ scr ] : https://doc.rust-lang.org/nightly/nightly-rustc/rustc_span/hygiene/struct.SyntaxContext.html#method.root
0 commit comments