diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2022-04-08 13:10:52 +1000 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2022-04-11 09:38:40 +1000 |
| commit | 482b25b321d06ee2b9e438e458ed41b691553736 (patch) | |
| tree | d03e89e19708be1a7e5446e9b5153718cf8108b0 /compiler | |
| parent | 027a232755fa9728e9699337267f6675dfd0a8ba (diff) | |
| download | rust-482b25b321d06ee2b9e438e458ed41b691553736.tar.gz rust-482b25b321d06ee2b9e438e458ed41b691553736.zip | |
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.
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/rustc_expand/src/mbe/macro_rules.rs | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/compiler/rustc_expand/src/mbe/macro_rules.rs b/compiler/rustc_expand/src/mbe/macro_rules.rs index 31dae6a2fb4..f5c7186bc4b 100644 --- a/compiler/rustc_expand/src/mbe/macro_rules.rs +++ b/compiler/rustc_expand/src/mbe/macro_rules.rs @@ -439,7 +439,8 @@ pub fn compile_declarative_macro( let argument_gram = mbe::macro_parser::compute_locs(&sess.parse_sess, &argument_gram); let parser = Parser::new(&sess.parse_sess, body, true, rustc_parse::MACRO_ARGUMENTS); - let mut tt_parser = TtParser::new(def.ident); + let mut tt_parser = + TtParser::new(Ident::with_dummy_span(if macro_rules { kw::MacroRules } else { kw::Macro })); let argument_map = match tt_parser.parse_tt(&mut Cow::Borrowed(&parser), &argument_gram) { Success(m) => m, Failure(token, msg) => { |
