Skip to content

Commit af44a52

Browse files
committed
Rename is_special/is_special_ident as is_reserved_ident.
Because "special" isn't a term used anywhere else, but "reserved identifier" is. (E.g. in error messages.)
1 parent b5933c8 commit af44a52

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

compiler/rustc_ast/src/token.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -923,8 +923,8 @@ impl Token {
923923
}
924924

925925
/// Returns true for reserved identifiers.
926-
pub fn is_special_ident(&self) -> bool {
927-
self.is_non_raw_ident_where(Ident::is_special)
926+
pub fn is_reserved_ident(&self) -> bool {
927+
self.is_non_raw_ident_where(Ident::is_reserved_ident)
928928
}
929929

930930
/// Returns `true` if the token is a keyword used in the language.

compiler/rustc_parse/src/parser/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ pub(super) enum TokenDescription {
423423
impl TokenDescription {
424424
pub(super) fn from_token(token: &Token) -> Option<Self> {
425425
match token.kind {
426-
_ if token.is_special_ident() => Some(TokenDescription::ReservedIdentifier),
426+
_ if token.is_reserved_ident() => Some(TokenDescription::ReservedIdentifier),
427427
_ if token.is_used_keyword() => Some(TokenDescription::Keyword),
428428
_ if token.is_unused_keyword() => Some(TokenDescription::ReservedKeyword),
429429
token::DocComment(..) => Some(TokenDescription::DocComment),

compiler/rustc_span/src/symbol.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ mod tests;
2020

2121
// The proc macro code for this is in `compiler/rustc_macros/src/symbols.rs`.
2222
symbols! {
23-
// If you modify this list, adjust `is_any_keyword`, `is_special`,
23+
// If you modify this list, adjust `is_any_keyword`, `is_reserved_ident`,
2424
// `is_used_keyword`/`is_unused_keyword` and `AllKeywords`.
2525
// But this should rarely be necessary if the keywords are kept in alphabetic order.
2626
Keywords {
@@ -2586,7 +2586,7 @@ impl Symbol {
25862586
self >= kw::As && self <= kw::Yeet
25872587
}
25882588

2589-
fn is_special(self) -> bool {
2589+
fn is_reserved_ident(self) -> bool {
25902590
self == sym::dollar_crate || self == sym::underscore
25912591
}
25922592

@@ -2608,7 +2608,7 @@ impl Symbol {
26082608
}
26092609

26102610
pub fn is_reserved(self, edition: impl Copy + FnOnce() -> Edition) -> bool {
2611-
self.is_special()
2611+
self.is_reserved_ident()
26122612
|| self.is_used_keyword_always()
26132613
|| self.is_unused_keyword_always()
26142614
|| self.is_used_keyword_conditional(edition)
@@ -2648,8 +2648,8 @@ impl Ident {
26482648
}
26492649

26502650
/// Returns `true` for reserved identifiers.
2651-
pub fn is_special(self) -> bool {
2652-
self.name.is_special()
2651+
pub fn is_reserved_ident(self) -> bool {
2652+
self.name.is_reserved_ident()
26532653
}
26542654

26552655
/// Returns `true` if the token is a keyword used in the language.

0 commit comments

Comments
 (0)