Skip to content

Commit

Permalink
Add ErrorGuaranteed to ast::LitKind::Err, token::LitKind::Err.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
nnethercote committed Feb 15, 2024
1 parent 4a13722 commit d33d867
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions crates/proc-macro-srv/src/server/rust_analyzer_span.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions crates/proc-macro-srv/src/server/token_id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit d33d867

Please sign in to comment.