rust/compiler/rustc_parse/src/parser
Nicholas Nethercote 1564318482 Only have one source of truth for keywords.
`rustc_symbol` is the source of truth for keywords.

rustdoc has its own implicit definition of keywords, via the
`is_doc_keyword`. It (presumably) intends to include all keywords, but
it omits `yeet`.

rustfmt has its own explicit list of Rust keywords. It also (presumably)
intends to include all keywords, but it omits `await`, `builtin`, `gen`,
`macro_rules`, `raw`, `reuse`, `safe`, and `yeet`. Also, it does linear
searches through this list, which is inefficient.

This commit fixes all of the above problems by introducing a new
predicate `is_any_keyword` in rustc and using it in rustdoc and rustfmt.
It documents that it's not the right predicate in most cases.
2024-12-18 20:21:03 +11:00
..
mut_visit Re-export more rustc_span::symbol things from rustc_span. 2024-12-18 13:38:53 +11:00
tokenstream allow symbol_intern_string_literal lint in test modules 2024-12-11 20:38:55 +03:00
attr.rs Re-export more rustc_span::symbol things from rustc_span. 2024-12-18 13:38:53 +11:00
attr_wrapper.rs Introduce InvisibleOrigin on invisible delimiters. 2024-11-21 08:16:54 +11:00
diagnostics.rs Only have one source of truth for keywords. 2024-12-18 20:21:03 +11:00
expr.rs Re-export more rustc_span::symbol things from rustc_span. 2024-12-18 13:38:53 +11:00
generics.rs Re-export more rustc_span::symbol things from rustc_span. 2024-12-18 13:38:53 +11:00
item.rs Re-export more rustc_span::symbol things from rustc_span. 2024-12-18 13:38:53 +11:00
mod.rs Re-export more rustc_span::symbol things from rustc_span. 2024-12-18 13:38:53 +11:00
nonterminal.rs Re-export more rustc_span::symbol things from rustc_span. 2024-12-18 13:38:53 +11:00
pat.rs Re-export more rustc_span::symbol things from rustc_span. 2024-12-18 13:38:53 +11:00
path.rs Re-export more rustc_span::symbol things from rustc_span. 2024-12-18 13:38:53 +11:00
stmt.rs Re-export more rustc_span::symbol things from rustc_span. 2024-12-18 13:38:53 +11:00
tests.rs Re-export more rustc_span::symbol things from rustc_span. 2024-12-18 13:38:53 +11:00
ty.rs Re-export more rustc_span::symbol things from rustc_span. 2024-12-18 13:38:53 +11:00