1
Fork 0

Rename ast::TokenKind::Not as ast::TokenKind::Bang.

For consistency with `rustc_lexer::TokenKind::Bang`, and because other
`ast::TokenKind` variants generally have syntactic names instead of
semantic names (e.g. `Star` and `DotDot` instead of `Mul` and `Range`).
This commit is contained in:
Nicholas Nethercote 2024-12-20 14:04:25 +11:00
parent 2a1e2e9632
commit 53167c0b7f
20 changed files with 48 additions and 48 deletions

View file

@ -328,7 +328,7 @@ impl<'a> StripUnconfigured<'a> {
// For inner attributes, we do the same thing for the `!` in `#![attr]`.
let mut trees = if cfg_attr.style == AttrStyle::Inner {
let Some(TokenTree::Token(bang_token @ Token { kind: TokenKind::Not, .. }, _)) =
let Some(TokenTree::Token(bang_token @ Token { kind: TokenKind::Bang, .. }, _)) =
orig_trees.next()
else {
panic!("Bad tokens for attribute {cfg_attr:?}");

View file

@ -432,7 +432,7 @@ fn check_nested_occurrences(
}
(
NestedMacroState::MacroRules,
&TokenTree::Token(Token { kind: TokenKind::Not, .. }),
&TokenTree::Token(Token { kind: TokenKind::Bang, .. }),
) => {
state = NestedMacroState::MacroRulesNot;
}

View file

@ -690,7 +690,7 @@ fn has_compile_error_macro(rhs: &mbe::TokenTree) -> bool {
&& let TokenKind::Ident(ident, _) = ident.kind
&& ident == sym::compile_error
&& let mbe::TokenTree::Token(bang) = bang
&& let TokenKind::Not = bang.kind
&& let TokenKind::Bang = bang.kind
&& let mbe::TokenTree::Delimited(.., del) = args
&& !del.delim.skip()
{

View file

@ -180,7 +180,7 @@ impl FromInternal<(TokenStream, &mut Rustc<'_, '_>)> for Vec<TokenTree<TokenStre
Gt => op(">"),
AndAnd => op("&&"),
OrOr => op("||"),
Not => op("!"),
Bang => op("!"),
Tilde => op("~"),
Plus => op("+"),
Minus => op("-"),
@ -322,7 +322,7 @@ impl ToInternal<SmallVec<[tokenstream::TokenTree; 2]>>
b'=' => Eq,
b'<' => Lt,
b'>' => Gt,
b'!' => Not,
b'!' => Bang,
b'~' => Tilde,
b'+' => Plus,
b'-' => Minus,