Improving macro expansion section (#1875)

This commit is contained in:
Arthur Milchior 2024-01-29 20:53:39 +01:00 committed by GitHub
parent ea1767da49
commit 11aa615575
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 9 deletions

View File

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