about summary refs log tree commit diff
path: root/compiler/rustc_span
diff options
context:
space:
mode:
authorMatthias Krüger <476013+matthiaskrgr@users.noreply.github.com>2025-03-31 23:05:45 +0200
committerGitHub <noreply@github.com>2025-03-31 23:05:45 +0200
commit2f5d5480027f9a12a833fadfa8398ebef7c8d944 (patch)
tree8c95add61f5042b9c790d98c1ca1700b1d080b9d /compiler/rustc_span
parent50485342a08adf644e30def3a0245649d9dbafbb (diff)
parent27850631638e74bd017d963a35c53e7f81f42e4d (diff)
Rollup merge of #139039 - nnethercote:less-kw-Empty-4, r=petrochenkov
Reduce kw::Empty usage, part 4

Another step towards #137978.

r? `@petrochenkov`
Diffstat (limited to 'compiler/rustc_span')
-rw-r--r--compiler/rustc_span/src/hygiene.rs3
-rw-r--r--compiler/rustc_span/src/symbol.rs6
2 files changed, 7 insertions, 2 deletions
diff --git a/compiler/rustc_span/src/hygiene.rs b/compiler/rustc_span/src/hygiene.rs
index e7a8dee27f5..9959e98e3dd 100644
--- a/compiler/rustc_span/src/hygiene.rs
+++ b/compiler/rustc_span/src/hygiene.rs
@@ -1440,7 +1440,8 @@ pub fn decode_syntax_context<D: Decoder, F: FnOnce(&mut D, u32) -> SyntaxContext
                 }
             }
             Entry::Vacant(entry) => {
-                // We are the first thread to start decoding. Mark the current thread as being progress.
+                // We are the first thread to start decoding. Mark the current thread as being
+                // progress.
                 context.local_in_progress.borrow_mut().insert(raw_id);
 
                 // Allocate and store SyntaxContext id *before* calling the decoder function,
diff --git a/compiler/rustc_span/src/symbol.rs b/compiler/rustc_span/src/symbol.rs
index 47dd80c432e..c6e570e524f 100644
--- a/compiler/rustc_span/src/symbol.rs
+++ b/compiler/rustc_span/src/symbol.rs
@@ -131,7 +131,7 @@ symbols! {
         // tidy-alphabetical-end
 
         // Weak keywords, have special meaning only in specific contexts.
-        // Matching predicates: none
+        // Matching predicates: `is_weak`
         // tidy-alphabetical-start
         Auto:               "auto",
         Builtin:            "builtin",
@@ -2725,6 +2725,10 @@ impl Symbol {
             || self.is_unused_keyword_conditional(edition)
     }
 
+    pub fn is_weak(self) -> bool {
+        self >= kw::Auto && self <= kw::Yeet
+    }
+
     /// A keyword or reserved identifier that can be used as a path segment.
     pub fn is_path_segment_keyword(self) -> bool {
         self == kw::Super