Skip to content

Commit 11aa615

Browse files
Improving macro expansion section (#1875)
1 parent ea1767d commit 11aa615

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

Diff for: src/macro-expansion.md

+5-9
Original file line numberDiff line numberDiff line change
@@ -292,13 +292,8 @@ macro_rules! foo { () => { println!(); } }
292292
fn main() { foo!(); }
293293
```
294294

295-
In this code, the AST nodes that are finally generated would have hierarchy:
296-
297-
```
298-
root
299-
expn_id_foo
300-
expn_id_println
301-
```
295+
In this code, the AST nodes that are finally generated would have hierarchy
296+
`root -> id(foo) -> id(println)`.
302297

303298
### The Macro Definition Hierarchy
304299

@@ -397,8 +392,9 @@ macro foo($i: ident) { $i }
397392
foo!(bar!(baz));
398393
```
399394

400-
For the `baz` AST node in the final output, the first hierarchy is `ROOT ->
401-
id(foo) -> id(bar) -> baz`, while the third hierarchy is `ROOT -> baz`.
395+
For the `baz` AST node in the final output, the expansion-order hierarchy is
396+
`ROOT -> id(foo) -> id(bar) -> baz`, while the call-site hierarchy is `ROOT ->
397+
baz`.
402398

403399
### Macro Backtraces
404400

0 commit comments

Comments
 (0)