File tree 1 file changed +7
-6
lines changed
1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change 2
2
3
3
Macro expansion happens during parsing. ` rustc ` has two parsers, in fact: the
4
4
normal Rust parser, and the macro parser. During the parsing phase, the normal
5
- Rust parser will call into the macro parser when it encounters a macro
6
- definition or macro invocation (TODO: verify). The macro parser, in turn, may
7
- call back out to the Rust parser when it needs to bind a metavariable (e.g.
8
- ` $my_expr ` ) while parsing the contents of a macro invocation. The code for macro
9
- expansion is in [ ` src/libsyntax/ext/tt/ ` ] [ code_dir ] . This chapter aims to
10
- explain how macro expansion works.
5
+ Rust parser will set aside the contents of macros and their invokations. Later,
6
+ before name resolution, macros are expanded using these portions of the code.
7
+ The macro parser, in turn, may call the normal Rust parser when it needs to
8
+ bind a metavariable (e.g. ` $my_expr ` ) while parsing the contents of a macro
9
+ invocation. The code for macro expansion is in
10
+ [ ` src/libsyntax/ext/tt/ ` ] [ code_dir ] . This chapter aims to explain how macro
11
+ expansion works.
11
12
12
13
### Example
13
14
You can’t perform that action at this time.
0 commit comments