about summary refs log tree commit diff
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2024-02-14 20:12:05 +1100
committerNicholas Nethercote <n.nethercote@gmail.com>2024-02-15 14:46:08 +1100
commitd33d8675d0fff6f9652790baa5346ac478e528ea (patch)
tree8a2d18db1bf38596d4cfd6119359a8f6a3ba6244
parent4a1372251850c6cf62dfe7d380bc515763426107 (diff)
downloadrust-d33d8675d0fff6f9652790baa5346ac478e528ea.tar.gz
rust-d33d8675d0fff6f9652790baa5346ac478e528ea.zip
Add `ErrorGuaranteed` to `ast::LitKind::Err`, `token::LitKind::Err`.
This mostly works well, and eliminates a couple of delayed bugs.

One annoying thing is that we should really also add an
`ErrorGuaranteed` to `proc_macro::bridge::LitKind::Err`. But that's
difficult because `proc_macro` doesn't have access to `ErrorGuaranteed`,
so we have to fake it.
-rw-r--r--crates/proc-macro-srv/src/server/rust_analyzer_span.rs4
-rw-r--r--crates/proc-macro-srv/src/server/token_id.rs4
2 files changed, 4 insertions, 4 deletions
diff --git a/crates/proc-macro-srv/src/server/rust_analyzer_span.rs b/crates/proc-macro-srv/src/server/rust_analyzer_span.rs
index c7c7bea9941..8a9d52a37a2 100644
--- a/crates/proc-macro-srv/src/server/rust_analyzer_span.rs
+++ b/crates/proc-macro-srv/src/server/rust_analyzer_span.rs
@@ -72,7 +72,7 @@ impl server::FreeFunctions for RaSpanServer {
     ) -> Result<bridge::Literal<Self::Span, Self::Symbol>, ()> {
         // FIXME: keep track of LitKind and Suffix
         Ok(bridge::Literal {
-            kind: bridge::LitKind::Err,
+            kind: bridge::LitKind::Integer, // dummy
             symbol: Symbol::intern(self.interner, s),
             suffix: None,
             span: self.call_site,
@@ -202,7 +202,7 @@ impl server::TokenStream for RaSpanServer {
                 tt::TokenTree::Leaf(tt::Leaf::Literal(lit)) => {
                     bridge::TokenTree::Literal(bridge::Literal {
                         // FIXME: handle literal kinds
-                        kind: bridge::LitKind::Err,
+                        kind: bridge::LitKind::Integer, // dummy
                         symbol: Symbol::intern(self.interner, &lit.text),
                         // FIXME: handle suffixes
                         suffix: None,
diff --git a/crates/proc-macro-srv/src/server/token_id.rs b/crates/proc-macro-srv/src/server/token_id.rs
index edbdc67b482..15a9e0deae4 100644
--- a/crates/proc-macro-srv/src/server/token_id.rs
+++ b/crates/proc-macro-srv/src/server/token_id.rs
@@ -64,7 +64,7 @@ impl server::FreeFunctions for TokenIdServer {
     ) -> Result<bridge::Literal<Self::Span, Self::Symbol>, ()> {
         // FIXME: keep track of LitKind and Suffix
         Ok(bridge::Literal {
-            kind: bridge::LitKind::Err,
+            kind: bridge::LitKind::Integer, // dummy
             symbol: Symbol::intern(self.interner, s),
             suffix: None,
             span: self.call_site,
@@ -187,7 +187,7 @@ impl server::TokenStream for TokenIdServer {
                 tt::TokenTree::Leaf(tt::Leaf::Literal(lit)) => {
                     bridge::TokenTree::Literal(bridge::Literal {
                         // FIXME: handle literal kinds
-                        kind: bridge::LitKind::Err,
+                        kind: bridge::LitKind::Integer, // dummy
                         symbol: Symbol::intern(self.interner, &lit.text),
                         // FIXME: handle suffixes
                         suffix: None,