Skip to content

Commit 482b25b

Browse files
committed
Change internal naming of macros.
When a `macro_rules! foo { ... }` invocation is compiled the name used is `foo`, not `macro_rules!`. This is different to all other macro invocations, and confused me when I was inserted debugging println statements for macro evaluation. This commit changes it to `macro_rules` (or just `macro`), which is what I expected. There are no externally visible changes.
1 parent 027a232 commit 482b25b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

compiler/rustc_expand/src/mbe/macro_rules.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,8 @@ pub fn compile_declarative_macro(
439439
let argument_gram = mbe::macro_parser::compute_locs(&sess.parse_sess, &argument_gram);
440440

441441
let parser = Parser::new(&sess.parse_sess, body, true, rustc_parse::MACRO_ARGUMENTS);
442-
let mut tt_parser = TtParser::new(def.ident);
442+
let mut tt_parser =
443+
TtParser::new(Ident::with_dummy_span(if macro_rules { kw::MacroRules } else { kw::Macro }));
443444
let argument_map = match tt_parser.parse_tt(&mut Cow::Borrowed(&parser), &argument_gram) {
444445
Success(m) => m,
445446
Failure(token, msg) => {

0 commit comments

Comments
 (0)