mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-28 14:03:35 +00:00
Fix compilation errors
This commit is contained in:
parent
027f263ef5
commit
965b14d17a
3 changed files with 10 additions and 9 deletions
|
@ -55,8 +55,8 @@ fn spacing_to_external(spacing: Spacing) -> proc_macro::Spacing {
|
|||
}
|
||||
}
|
||||
|
||||
fn literal_to_external(literal: ast::LiteralKind) -> Option<proc_macro::bridge::LitKind> {
|
||||
Some(match lit.kind() {
|
||||
fn literal_to_external(literal_kind: ast::LiteralKind) -> Option<proc_macro::bridge::LitKind> {
|
||||
Some(match literal_kind {
|
||||
ast::LiteralKind::String(data) => {
|
||||
if data.is_raw() {
|
||||
bridge::LitKind::StrRaw(data.raw_delimiter_count()?)
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
//! It is an unfortunate result of how the proc-macro API works that we need to look into the
|
||||
//! concrete representation of the spans, and as such, RustRover cannot make use of this unless they
|
||||
//! change their representation to be compatible with rust-analyzer's.
|
||||
use core::num;
|
||||
use std::{
|
||||
collections::{HashMap, HashSet},
|
||||
iter,
|
||||
|
@ -72,13 +71,14 @@ impl server::FreeFunctions for RaSpanServer {
|
|||
&mut self,
|
||||
s: &str,
|
||||
) -> Result<bridge::Literal<Self::Span, Self::Symbol>, ()> {
|
||||
let literal = str_to_lit_node(s).ok_or(Err(()))?;
|
||||
let literal = str_to_lit_node(s).ok_or(())?;
|
||||
|
||||
let kind = literal_to_external(literal.kind()).ok_or(Err(()))?;
|
||||
let kind = literal_to_external(literal.kind()).ok_or(())?;
|
||||
|
||||
// FIXME: handle more than just int and float suffixes
|
||||
let suffix = match literal.kind() {
|
||||
ast::LiteralKind::FloatNumber(num) | ast::LiteralKind::IntNumber(num) => num.suffix(),
|
||||
ast::LiteralKind::FloatNumber(num) => num.suffix(),
|
||||
ast::LiteralKind::IntNumber(num) => num.suffix(),
|
||||
_ => None,
|
||||
}
|
||||
.map(|suffix| Symbol::intern(self.interner, suffix));
|
||||
|
|
|
@ -63,13 +63,14 @@ impl server::FreeFunctions for TokenIdServer {
|
|||
&mut self,
|
||||
s: &str,
|
||||
) -> Result<bridge::Literal<Self::Span, Self::Symbol>, ()> {
|
||||
let literal = str_to_lit_node(s).ok_or(Err(()))?;
|
||||
let literal = str_to_lit_node(s).ok_or(())?;
|
||||
|
||||
let kind = literal_to_external(literal.kind()).ok_or(Err(()))?;
|
||||
let kind = literal_to_external(literal.kind()).ok_or(())?;
|
||||
|
||||
// FIXME: handle more than just int and float suffixes
|
||||
let suffix = match literal.kind() {
|
||||
ast::LiteralKind::FloatNumber(num) | ast::LiteralKind::IntNumber(num) => num.suffix(),
|
||||
ast::LiteralKind::FloatNumber(num) => num.suffix(),
|
||||
ast::LiteralKind::IntNumber(num) => num.suffix(),
|
||||
_ => None,
|
||||
}
|
||||
.map(|suffix| Symbol::intern(self.interner, suffix));
|
||||
|
|
Loading…
Reference in a new issue