Skip to content

Commit 6f89925

Browse files
committed
mbe: Rename macro parsing state names to use Bang instead of Not
The use of `Not` to describe the `!` in `macro_rules!` reads confusingly, and also results in search collisions with the diagnostic structure `MacroRulesNot` elsewhere in the compiler. Rename it to use the more conventional `Bang` for `!`.
1 parent 30f0257 commit 6f89925

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

compiler/rustc_expand/src/mbe/macro_check.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -357,10 +357,10 @@ enum NestedMacroState {
357357
/// The token `macro_rules` was processed.
358358
MacroRules,
359359
/// The tokens `macro_rules!` were processed.
360-
MacroRulesNot,
360+
MacroRulesBang,
361361
/// The tokens `macro_rules!` followed by a name were processed. The name may be either directly
362362
/// an identifier or a meta-variable (that hopefully would be instantiated by an identifier).
363-
MacroRulesNotName,
363+
MacroRulesBangName,
364364
/// The keyword `macro` was processed.
365365
Macro,
366366
/// The keyword `macro` followed by a name was processed.
@@ -408,24 +408,24 @@ fn check_nested_occurrences(
408408
NestedMacroState::MacroRules,
409409
&TokenTree::Token(Token { kind: TokenKind::Bang, .. }),
410410
) => {
411-
state = NestedMacroState::MacroRulesNot;
411+
state = NestedMacroState::MacroRulesBang;
412412
}
413413
(
414-
NestedMacroState::MacroRulesNot,
414+
NestedMacroState::MacroRulesBang,
415415
&TokenTree::Token(Token { kind: TokenKind::Ident(..), .. }),
416416
) => {
417-
state = NestedMacroState::MacroRulesNotName;
417+
state = NestedMacroState::MacroRulesBangName;
418418
}
419-
(NestedMacroState::MacroRulesNot, &TokenTree::MetaVar(..)) => {
420-
state = NestedMacroState::MacroRulesNotName;
419+
(NestedMacroState::MacroRulesBang, &TokenTree::MetaVar(..)) => {
420+
state = NestedMacroState::MacroRulesBangName;
421421
// We check that the meta-variable is correctly used.
422422
check_occurrences(psess, node_id, tt, macros, binders, ops, guar);
423423
}
424-
(NestedMacroState::MacroRulesNotName, TokenTree::Delimited(.., del))
424+
(NestedMacroState::MacroRulesBangName, TokenTree::Delimited(.., del))
425425
| (NestedMacroState::MacroName, TokenTree::Delimited(.., del))
426426
if del.delim == Delimiter::Brace =>
427427
{
428-
let macro_rules = state == NestedMacroState::MacroRulesNotName;
428+
let macro_rules = state == NestedMacroState::MacroRulesBangName;
429429
state = NestedMacroState::Empty;
430430
let rest =
431431
check_nested_macro(psess, node_id, macro_rules, &del.tts, &nested_macros, guar);

0 commit comments

Comments
 (0)