Improving macro expansion section (#1875)
This commit is contained in:
parent
ea1767da49
commit
11aa615575
|
|
@ -292,13 +292,8 @@ macro_rules! foo { () => { println!(); } }
|
||||||
fn main() { foo!(); }
|
fn main() { foo!(); }
|
||||||
```
|
```
|
||||||
|
|
||||||
In this code, the AST nodes that are finally generated would have hierarchy:
|
In this code, the AST nodes that are finally generated would have hierarchy
|
||||||
|
`root -> id(foo) -> id(println)`.
|
||||||
```
|
|
||||||
root
|
|
||||||
expn_id_foo
|
|
||||||
expn_id_println
|
|
||||||
```
|
|
||||||
|
|
||||||
### The Macro Definition Hierarchy
|
### The Macro Definition Hierarchy
|
||||||
|
|
||||||
|
|
@ -397,8 +392,9 @@ macro foo($i: ident) { $i }
|
||||||
foo!(bar!(baz));
|
foo!(bar!(baz));
|
||||||
```
|
```
|
||||||
|
|
||||||
For the `baz` AST node in the final output, the first hierarchy is `ROOT ->
|
For the `baz` AST node in the final output, the expansion-order hierarchy is
|
||||||
id(foo) -> id(bar) -> baz`, while the third hierarchy is `ROOT -> baz`.
|
`ROOT -> id(foo) -> id(bar) -> baz`, while the call-site hierarchy is `ROOT ->
|
||||||
|
baz`.
|
||||||
|
|
||||||
### Macro Backtraces
|
### Macro Backtraces
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue