mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-27 21:43:37 +00:00
Auto merge of #12828 - fasterthanlime:proc-macro-srv-naming, r=Veykril
Rename proc macro server from 'Rustc' to 'RustAnalyzer' Related to: * https://github.com/rust-lang/rust-analyzer/issues/12818 This is mostly a courtesy PR for the sake of rustc maintainers. When they looked at `proc-macro-srv`, they noticed the server was named `Rustc` — probably because of historical copy-paste. Only rustc's proc macro server should be named `Rustc`, ra's can be named `RustAnalyzer`. Maintainer impact: There's no semantic changes in this PR, only naming. One test snapshot was updated since "proc macro server types" were used to test traits somewhere else and I renamed those too, why not.
This commit is contained in:
commit
100ea1d2d5
7 changed files with 78 additions and 78 deletions
|
@ -2430,29 +2430,29 @@ macro_rules! declare_server_traits {
|
|||
with_api!(Self, self_, declare_server_traits);
|
||||
struct G {}
|
||||
struct T {}
|
||||
struct Rustc;
|
||||
impl Types for Rustc {
|
||||
struct RustAnalyzer;
|
||||
impl Types for RustAnalyzer {
|
||||
type TokenStream = T;
|
||||
type Group = G;
|
||||
}
|
||||
|
||||
fn make<T>() -> T { loop {} }
|
||||
impl TokenStream for Rustc {
|
||||
impl TokenStream for RustAnalyzer {
|
||||
fn new() -> Self::TokenStream {
|
||||
let group: Self::Group = make();
|
||||
make()
|
||||
}
|
||||
}"#,
|
||||
expect![[r#"
|
||||
1061..1072 '{ loop {} }': T
|
||||
1063..1070 'loop {}': !
|
||||
1068..1070 '{}': ()
|
||||
1136..1199 '{ ... }': T
|
||||
1150..1155 'group': G
|
||||
1171..1175 'make': fn make<G>() -> G
|
||||
1171..1177 'make()': G
|
||||
1187..1191 'make': fn make<T>() -> T
|
||||
1187..1193 'make()': T
|
||||
1075..1086 '{ loop {} }': T
|
||||
1077..1084 'loop {}': !
|
||||
1082..1084 '{}': ()
|
||||
1157..1220 '{ ... }': T
|
||||
1171..1176 'group': G
|
||||
1192..1196 'make': fn make<G>() -> G
|
||||
1192..1198 'make()': G
|
||||
1208..1212 'make': fn make<T>() -> T
|
||||
1208..1214 'make()': T
|
||||
"#]],
|
||||
);
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ mod proc_macro;
|
|||
|
||||
#[allow(dead_code)]
|
||||
#[doc(hidden)]
|
||||
mod rustc_server;
|
||||
mod ra_server;
|
||||
|
||||
use libloading::Library;
|
||||
use proc_macro_api::ProcMacroKind;
|
||||
|
@ -36,10 +36,10 @@ impl Abi {
|
|||
macro_body: &tt::Subtree,
|
||||
attributes: Option<&tt::Subtree>,
|
||||
) -> Result<tt::Subtree, PanicMessage> {
|
||||
let parsed_body = rustc_server::TokenStream::with_subtree(macro_body.clone());
|
||||
let parsed_body = ra_server::TokenStream::with_subtree(macro_body.clone());
|
||||
|
||||
let parsed_attributes = attributes.map_or(rustc_server::TokenStream::new(), |attr| {
|
||||
rustc_server::TokenStream::with_subtree(attr.clone())
|
||||
let parsed_attributes = attributes.map_or(ra_server::TokenStream::new(), |attr| {
|
||||
ra_server::TokenStream::with_subtree(attr.clone())
|
||||
});
|
||||
|
||||
for proc_macro in &self.exported_macros {
|
||||
|
@ -49,7 +49,7 @@ impl Abi {
|
|||
} if *trait_name == macro_name => {
|
||||
let res = client.run(
|
||||
&proc_macro::bridge::server::SameThread,
|
||||
rustc_server::Rustc::default(),
|
||||
ra_server::RustAnalyzer::default(),
|
||||
parsed_body,
|
||||
true,
|
||||
);
|
||||
|
@ -60,7 +60,7 @@ impl Abi {
|
|||
{
|
||||
let res = client.run(
|
||||
&proc_macro::bridge::server::SameThread,
|
||||
rustc_server::Rustc::default(),
|
||||
ra_server::RustAnalyzer::default(),
|
||||
parsed_body,
|
||||
true,
|
||||
);
|
||||
|
@ -71,7 +71,7 @@ impl Abi {
|
|||
{
|
||||
let res = client.run(
|
||||
&proc_macro::bridge::server::SameThread,
|
||||
rustc_server::Rustc::default(),
|
||||
ra_server::RustAnalyzer::default(),
|
||||
parsed_attributes,
|
||||
parsed_body,
|
||||
true,
|
||||
|
|
|
@ -268,12 +268,12 @@ pub struct TokenStreamIter {
|
|||
}
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct Rustc {
|
||||
pub struct RustAnalyzer {
|
||||
ident_interner: IdentInterner,
|
||||
// FIXME: store span information here.
|
||||
}
|
||||
|
||||
impl server::Types for Rustc {
|
||||
impl server::Types for RustAnalyzer {
|
||||
type FreeFunctions = FreeFunctions;
|
||||
type TokenStream = TokenStream;
|
||||
type TokenStreamBuilder = TokenStreamBuilder;
|
||||
|
@ -288,7 +288,7 @@ impl server::Types for Rustc {
|
|||
type MultiSpan = Vec<Span>;
|
||||
}
|
||||
|
||||
impl server::FreeFunctions for Rustc {
|
||||
impl server::FreeFunctions for RustAnalyzer {
|
||||
fn track_env_var(&mut self, _var: &str, _value: Option<&str>) {
|
||||
// FIXME: track env var accesses
|
||||
// https://github.com/rust-lang/rust/pull/71858
|
||||
|
@ -296,7 +296,7 @@ impl server::FreeFunctions for Rustc {
|
|||
fn track_path(&mut self, _path: &str) {}
|
||||
}
|
||||
|
||||
impl server::TokenStream for Rustc {
|
||||
impl server::TokenStream for RustAnalyzer {
|
||||
fn new(&mut self) -> Self::TokenStream {
|
||||
Self::TokenStream::new()
|
||||
}
|
||||
|
@ -354,7 +354,7 @@ impl server::TokenStream for Rustc {
|
|||
}
|
||||
}
|
||||
|
||||
impl server::TokenStreamBuilder for Rustc {
|
||||
impl server::TokenStreamBuilder for RustAnalyzer {
|
||||
fn new(&mut self) -> Self::TokenStreamBuilder {
|
||||
Self::TokenStreamBuilder::new()
|
||||
}
|
||||
|
@ -366,7 +366,7 @@ impl server::TokenStreamBuilder for Rustc {
|
|||
}
|
||||
}
|
||||
|
||||
impl server::TokenStreamIter for Rustc {
|
||||
impl server::TokenStreamIter for RustAnalyzer {
|
||||
fn next(
|
||||
&mut self,
|
||||
iter: &mut Self::TokenStreamIter,
|
||||
|
@ -415,7 +415,7 @@ fn spacing_to_external(spacing: Spacing) -> bridge::Spacing {
|
|||
}
|
||||
}
|
||||
|
||||
impl server::Group for Rustc {
|
||||
impl server::Group for RustAnalyzer {
|
||||
fn new(&mut self, delimiter: bridge::Delimiter, stream: Self::TokenStream) -> Self::Group {
|
||||
Self::Group { delimiter: delim_to_internal(delimiter), token_trees: stream.token_trees }
|
||||
}
|
||||
|
@ -449,7 +449,7 @@ impl server::Group for Rustc {
|
|||
}
|
||||
}
|
||||
|
||||
impl server::Punct for Rustc {
|
||||
impl server::Punct for RustAnalyzer {
|
||||
fn new(&mut self, ch: char, spacing: bridge::Spacing) -> Self::Punct {
|
||||
tt::Punct {
|
||||
char: ch,
|
||||
|
@ -471,7 +471,7 @@ impl server::Punct for Rustc {
|
|||
}
|
||||
}
|
||||
|
||||
impl server::Ident for Rustc {
|
||||
impl server::Ident for RustAnalyzer {
|
||||
fn new(&mut self, string: &str, span: Self::Span, _is_raw: bool) -> Self::Ident {
|
||||
IdentId(self.ident_interner.intern(&IdentData(tt::Ident { text: string.into(), id: span })))
|
||||
}
|
||||
|
@ -486,7 +486,7 @@ impl server::Ident for Rustc {
|
|||
}
|
||||
}
|
||||
|
||||
impl server::Literal for Rustc {
|
||||
impl server::Literal for RustAnalyzer {
|
||||
fn debug_kind(&mut self, _literal: &Self::Literal) -> String {
|
||||
// r-a: debug_kind and suffix are unsupported; corresponding client code has been changed to not call these.
|
||||
// They must still be present to be ABI-compatible and work with upstream proc_macro.
|
||||
|
@ -597,7 +597,7 @@ impl server::Literal for Rustc {
|
|||
}
|
||||
}
|
||||
|
||||
impl server::SourceFile for Rustc {
|
||||
impl server::SourceFile for RustAnalyzer {
|
||||
// FIXME these are all stubs
|
||||
fn eq(&mut self, _file1: &Self::SourceFile, _file2: &Self::SourceFile) -> bool {
|
||||
true
|
||||
|
@ -610,7 +610,7 @@ impl server::SourceFile for Rustc {
|
|||
}
|
||||
}
|
||||
|
||||
impl server::Diagnostic for Rustc {
|
||||
impl server::Diagnostic for RustAnalyzer {
|
||||
fn new(&mut self, level: Level, msg: &str, spans: Self::MultiSpan) -> Self::Diagnostic {
|
||||
let mut diag = Diagnostic::new(level, msg);
|
||||
diag.spans = spans;
|
||||
|
@ -634,7 +634,7 @@ impl server::Diagnostic for Rustc {
|
|||
}
|
||||
}
|
||||
|
||||
impl server::Span for Rustc {
|
||||
impl server::Span for RustAnalyzer {
|
||||
fn debug(&mut self, span: Self::Span) -> String {
|
||||
format!("{:?}", span.0)
|
||||
}
|
||||
|
@ -706,7 +706,7 @@ impl server::Span for Rustc {
|
|||
}
|
||||
}
|
||||
|
||||
impl server::MultiSpan for Rustc {
|
||||
impl server::MultiSpan for RustAnalyzer {
|
||||
fn new(&mut self) -> Self::MultiSpan {
|
||||
// FIXME handle span
|
||||
vec![]
|
||||
|
@ -724,8 +724,8 @@ mod tests {
|
|||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test_rustc_server_literals() {
|
||||
let mut srv = Rustc { ident_interner: IdentInterner::default() };
|
||||
fn test_ra_server_literals() {
|
||||
let mut srv = RustAnalyzer { ident_interner: IdentInterner::default() };
|
||||
assert_eq!(srv.integer("1234").text, "1234");
|
||||
|
||||
assert_eq!(srv.typed_integer("12", "u8").text, "12u8");
|
||||
|
@ -761,7 +761,7 @@ mod tests {
|
|||
}
|
||||
|
||||
#[test]
|
||||
fn test_rustc_server_to_string() {
|
||||
fn test_ra_server_to_string() {
|
||||
let s = TokenStream {
|
||||
token_trees: vec![
|
||||
tt::TokenTree::Leaf(tt::Leaf::Ident(tt::Ident {
|
||||
|
@ -786,7 +786,7 @@ mod tests {
|
|||
}
|
||||
|
||||
#[test]
|
||||
fn test_rustc_server_from_str() {
|
||||
fn test_ra_server_from_str() {
|
||||
use std::str::FromStr;
|
||||
let subtree_paren_a = tt::TokenTree::Subtree(tt::Subtree {
|
||||
delimiter: Some(tt::Delimiter {
|
|
@ -6,14 +6,14 @@ mod proc_macro;
|
|||
|
||||
#[allow(dead_code)]
|
||||
#[doc(hidden)]
|
||||
mod rustc_server;
|
||||
mod ra_server;
|
||||
|
||||
use libloading::Library;
|
||||
use proc_macro_api::ProcMacroKind;
|
||||
|
||||
use super::PanicMessage;
|
||||
|
||||
pub use rustc_server::TokenStream;
|
||||
pub use ra_server::TokenStream;
|
||||
|
||||
pub(crate) struct Abi {
|
||||
exported_macros: Vec<proc_macro::bridge::client::ProcMacro>,
|
||||
|
@ -50,7 +50,7 @@ impl Abi {
|
|||
} if *trait_name == macro_name => {
|
||||
let res = client.run(
|
||||
&proc_macro::bridge::server::SameThread,
|
||||
rustc_server::Rustc::default(),
|
||||
ra_server::RustAnalyzer::default(),
|
||||
parsed_body,
|
||||
true,
|
||||
);
|
||||
|
@ -61,7 +61,7 @@ impl Abi {
|
|||
{
|
||||
let res = client.run(
|
||||
&proc_macro::bridge::server::SameThread,
|
||||
rustc_server::Rustc::default(),
|
||||
ra_server::RustAnalyzer::default(),
|
||||
parsed_body,
|
||||
true,
|
||||
);
|
||||
|
@ -72,7 +72,7 @@ impl Abi {
|
|||
{
|
||||
let res = client.run(
|
||||
&proc_macro::bridge::server::SameThread,
|
||||
rustc_server::Rustc::default(),
|
||||
ra_server::RustAnalyzer::default(),
|
||||
parsed_attributes,
|
||||
parsed_body,
|
||||
true,
|
||||
|
|
|
@ -268,12 +268,12 @@ pub struct TokenStreamIter {
|
|||
}
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct Rustc {
|
||||
pub struct RustAnalyzer {
|
||||
ident_interner: IdentInterner,
|
||||
// FIXME: store span information here.
|
||||
}
|
||||
|
||||
impl server::Types for Rustc {
|
||||
impl server::Types for RustAnalyzer {
|
||||
type FreeFunctions = FreeFunctions;
|
||||
type TokenStream = TokenStream;
|
||||
type Group = Group;
|
||||
|
@ -286,7 +286,7 @@ impl server::Types for Rustc {
|
|||
type MultiSpan = Vec<Span>;
|
||||
}
|
||||
|
||||
impl server::FreeFunctions for Rustc {
|
||||
impl server::FreeFunctions for RustAnalyzer {
|
||||
fn track_env_var(&mut self, _var: &str, _value: Option<&str>) {
|
||||
// FIXME: track env var accesses
|
||||
// https://github.com/rust-lang/rust/pull/71858
|
||||
|
@ -294,7 +294,7 @@ impl server::FreeFunctions for Rustc {
|
|||
fn track_path(&mut self, _path: &str) {}
|
||||
}
|
||||
|
||||
impl server::TokenStream for Rustc {
|
||||
impl server::TokenStream for RustAnalyzer {
|
||||
fn is_empty(&mut self, stream: &Self::TokenStream) -> bool {
|
||||
stream.is_empty()
|
||||
}
|
||||
|
@ -423,7 +423,7 @@ fn spacing_to_external(spacing: Spacing) -> bridge::Spacing {
|
|||
}
|
||||
}
|
||||
|
||||
impl server::Group for Rustc {
|
||||
impl server::Group for RustAnalyzer {
|
||||
fn new(
|
||||
&mut self,
|
||||
delimiter: bridge::Delimiter,
|
||||
|
@ -464,7 +464,7 @@ impl server::Group for Rustc {
|
|||
}
|
||||
}
|
||||
|
||||
impl server::Punct for Rustc {
|
||||
impl server::Punct for RustAnalyzer {
|
||||
fn new(&mut self, ch: char, spacing: bridge::Spacing) -> Self::Punct {
|
||||
tt::Punct {
|
||||
char: ch,
|
||||
|
@ -486,7 +486,7 @@ impl server::Punct for Rustc {
|
|||
}
|
||||
}
|
||||
|
||||
impl server::Ident for Rustc {
|
||||
impl server::Ident for RustAnalyzer {
|
||||
fn new(&mut self, string: &str, span: Self::Span, _is_raw: bool) -> Self::Ident {
|
||||
IdentId(self.ident_interner.intern(&IdentData(tt::Ident { text: string.into(), id: span })))
|
||||
}
|
||||
|
@ -501,7 +501,7 @@ impl server::Ident for Rustc {
|
|||
}
|
||||
}
|
||||
|
||||
impl server::Literal for Rustc {
|
||||
impl server::Literal for RustAnalyzer {
|
||||
fn debug_kind(&mut self, _literal: &Self::Literal) -> String {
|
||||
// r-a: debug_kind and suffix are unsupported; corresponding client code has been changed to not call these.
|
||||
// They must still be present to be ABI-compatible and work with upstream proc_macro.
|
||||
|
@ -612,7 +612,7 @@ impl server::Literal for Rustc {
|
|||
}
|
||||
}
|
||||
|
||||
impl server::SourceFile for Rustc {
|
||||
impl server::SourceFile for RustAnalyzer {
|
||||
// FIXME these are all stubs
|
||||
fn eq(&mut self, _file1: &Self::SourceFile, _file2: &Self::SourceFile) -> bool {
|
||||
true
|
||||
|
@ -625,7 +625,7 @@ impl server::SourceFile for Rustc {
|
|||
}
|
||||
}
|
||||
|
||||
impl server::Diagnostic for Rustc {
|
||||
impl server::Diagnostic for RustAnalyzer {
|
||||
fn new(&mut self, level: Level, msg: &str, spans: Self::MultiSpan) -> Self::Diagnostic {
|
||||
let mut diag = Diagnostic::new(level, msg);
|
||||
diag.spans = spans;
|
||||
|
@ -649,7 +649,7 @@ impl server::Diagnostic for Rustc {
|
|||
}
|
||||
}
|
||||
|
||||
impl server::Span for Rustc {
|
||||
impl server::Span for RustAnalyzer {
|
||||
fn debug(&mut self, span: Self::Span) -> String {
|
||||
format!("{:?}", span.0)
|
||||
}
|
||||
|
@ -721,7 +721,7 @@ impl server::Span for Rustc {
|
|||
}
|
||||
}
|
||||
|
||||
impl server::MultiSpan for Rustc {
|
||||
impl server::MultiSpan for RustAnalyzer {
|
||||
fn new(&mut self) -> Self::MultiSpan {
|
||||
// FIXME handle span
|
||||
vec![]
|
||||
|
@ -739,8 +739,8 @@ mod tests {
|
|||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test_rustc_server_literals() {
|
||||
let mut srv = Rustc { ident_interner: IdentInterner::default() };
|
||||
fn test_ra_server_literals() {
|
||||
let mut srv = RustAnalyzer { ident_interner: IdentInterner::default() };
|
||||
assert_eq!(srv.integer("1234").text, "1234");
|
||||
|
||||
assert_eq!(srv.typed_integer("12", "u8").text, "12u8");
|
||||
|
@ -776,7 +776,7 @@ mod tests {
|
|||
}
|
||||
|
||||
#[test]
|
||||
fn test_rustc_server_to_string() {
|
||||
fn test_ra_server_to_string() {
|
||||
let s = TokenStream {
|
||||
token_trees: vec![
|
||||
tt::TokenTree::Leaf(tt::Leaf::Ident(tt::Ident {
|
||||
|
@ -801,7 +801,7 @@ mod tests {
|
|||
}
|
||||
|
||||
#[test]
|
||||
fn test_rustc_server_from_str() {
|
||||
fn test_ra_server_from_str() {
|
||||
use std::str::FromStr;
|
||||
let subtree_paren_a = tt::TokenTree::Subtree(tt::Subtree {
|
||||
delimiter: Some(tt::Delimiter {
|
|
@ -6,14 +6,14 @@ mod proc_macro;
|
|||
|
||||
#[allow(dead_code)]
|
||||
#[doc(hidden)]
|
||||
mod rustc_server;
|
||||
mod ra_server;
|
||||
|
||||
use libloading::Library;
|
||||
use proc_macro_api::ProcMacroKind;
|
||||
|
||||
use super::PanicMessage;
|
||||
|
||||
pub use rustc_server::TokenStream;
|
||||
pub use ra_server::TokenStream;
|
||||
|
||||
pub(crate) struct Abi {
|
||||
exported_macros: Vec<proc_macro::bridge::client::ProcMacro>,
|
||||
|
@ -50,7 +50,7 @@ impl Abi {
|
|||
} if *trait_name == macro_name => {
|
||||
let res = client.run(
|
||||
&proc_macro::bridge::server::SameThread,
|
||||
rustc_server::Rustc::default(),
|
||||
ra_server::RustAnalyzer::default(),
|
||||
parsed_body,
|
||||
true,
|
||||
);
|
||||
|
@ -61,7 +61,7 @@ impl Abi {
|
|||
{
|
||||
let res = client.run(
|
||||
&proc_macro::bridge::server::SameThread,
|
||||
rustc_server::Rustc::default(),
|
||||
ra_server::RustAnalyzer::default(),
|
||||
parsed_body,
|
||||
true,
|
||||
);
|
||||
|
@ -72,7 +72,7 @@ impl Abi {
|
|||
{
|
||||
let res = client.run(
|
||||
&proc_macro::bridge::server::SameThread,
|
||||
rustc_server::Rustc::default(),
|
||||
ra_server::RustAnalyzer::default(),
|
||||
parsed_attributes,
|
||||
parsed_body,
|
||||
true,
|
||||
|
|
|
@ -268,12 +268,12 @@ pub struct TokenStreamIter {
|
|||
}
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct Rustc {
|
||||
pub struct RustAnalyzer {
|
||||
ident_interner: IdentInterner,
|
||||
// FIXME: store span information here.
|
||||
}
|
||||
|
||||
impl server::Types for Rustc {
|
||||
impl server::Types for RustAnalyzer {
|
||||
type FreeFunctions = FreeFunctions;
|
||||
type TokenStream = TokenStream;
|
||||
type Ident = IdentId;
|
||||
|
@ -284,7 +284,7 @@ impl server::Types for Rustc {
|
|||
type MultiSpan = Vec<Span>;
|
||||
}
|
||||
|
||||
impl server::FreeFunctions for Rustc {
|
||||
impl server::FreeFunctions for RustAnalyzer {
|
||||
fn track_env_var(&mut self, _var: &str, _value: Option<&str>) {
|
||||
// FIXME: track env var accesses
|
||||
// https://github.com/rust-lang/rust/pull/71858
|
||||
|
@ -292,7 +292,7 @@ impl server::FreeFunctions for Rustc {
|
|||
fn track_path(&mut self, _path: &str) {}
|
||||
}
|
||||
|
||||
impl server::TokenStream for Rustc {
|
||||
impl server::TokenStream for RustAnalyzer {
|
||||
fn is_empty(&mut self, stream: &Self::TokenStream) -> bool {
|
||||
stream.is_empty()
|
||||
}
|
||||
|
@ -449,7 +449,7 @@ fn spacing_to_external(spacing: Spacing) -> bridge::Spacing {
|
|||
}
|
||||
}
|
||||
|
||||
impl server::Ident for Rustc {
|
||||
impl server::Ident for RustAnalyzer {
|
||||
fn new(&mut self, string: &str, span: Self::Span, _is_raw: bool) -> Self::Ident {
|
||||
IdentId(self.ident_interner.intern(&IdentData(tt::Ident { text: string.into(), id: span })))
|
||||
}
|
||||
|
@ -464,7 +464,7 @@ impl server::Ident for Rustc {
|
|||
}
|
||||
}
|
||||
|
||||
impl server::Literal for Rustc {
|
||||
impl server::Literal for RustAnalyzer {
|
||||
fn debug_kind(&mut self, _literal: &Self::Literal) -> String {
|
||||
// r-a: debug_kind and suffix are unsupported; corresponding client code has been changed to not call these.
|
||||
// They must still be present to be ABI-compatible and work with upstream proc_macro.
|
||||
|
@ -575,7 +575,7 @@ impl server::Literal for Rustc {
|
|||
}
|
||||
}
|
||||
|
||||
impl server::SourceFile for Rustc {
|
||||
impl server::SourceFile for RustAnalyzer {
|
||||
// FIXME these are all stubs
|
||||
fn eq(&mut self, _file1: &Self::SourceFile, _file2: &Self::SourceFile) -> bool {
|
||||
true
|
||||
|
@ -588,7 +588,7 @@ impl server::SourceFile for Rustc {
|
|||
}
|
||||
}
|
||||
|
||||
impl server::Diagnostic for Rustc {
|
||||
impl server::Diagnostic for RustAnalyzer {
|
||||
fn new(&mut self, level: Level, msg: &str, spans: Self::MultiSpan) -> Self::Diagnostic {
|
||||
let mut diag = Diagnostic::new(level, msg);
|
||||
diag.spans = spans;
|
||||
|
@ -612,7 +612,7 @@ impl server::Diagnostic for Rustc {
|
|||
}
|
||||
}
|
||||
|
||||
impl server::Span for Rustc {
|
||||
impl server::Span for RustAnalyzer {
|
||||
fn debug(&mut self, span: Self::Span) -> String {
|
||||
format!("{:?}", span.0)
|
||||
}
|
||||
|
@ -669,7 +669,7 @@ impl server::Span for Rustc {
|
|||
}
|
||||
}
|
||||
|
||||
impl server::MultiSpan for Rustc {
|
||||
impl server::MultiSpan for RustAnalyzer {
|
||||
fn new(&mut self) -> Self::MultiSpan {
|
||||
// FIXME handle span
|
||||
vec![]
|
||||
|
@ -681,7 +681,7 @@ impl server::MultiSpan for Rustc {
|
|||
}
|
||||
}
|
||||
|
||||
impl server::Server for Rustc {
|
||||
impl server::Server for RustAnalyzer {
|
||||
fn globals(&mut self) -> bridge::ExpnGlobals<Self::Span> {
|
||||
bridge::ExpnGlobals {
|
||||
def_site: Span::unspecified(),
|
||||
|
@ -697,8 +697,8 @@ mod tests {
|
|||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test_rustc_server_literals() {
|
||||
let mut srv = Rustc { ident_interner: IdentInterner::default() };
|
||||
fn test_ra_server_literals() {
|
||||
let mut srv = RustAnalyzer { ident_interner: IdentInterner::default() };
|
||||
assert_eq!(srv.integer("1234").text, "1234");
|
||||
|
||||
assert_eq!(srv.typed_integer("12", "u8").text, "12u8");
|
||||
|
@ -734,7 +734,7 @@ mod tests {
|
|||
}
|
||||
|
||||
#[test]
|
||||
fn test_rustc_server_to_string() {
|
||||
fn test_ra_server_to_string() {
|
||||
let s = TokenStream {
|
||||
token_trees: vec![
|
||||
tt::TokenTree::Leaf(tt::Leaf::Ident(tt::Ident {
|
||||
|
@ -759,7 +759,7 @@ mod tests {
|
|||
}
|
||||
|
||||
#[test]
|
||||
fn test_rustc_server_from_str() {
|
||||
fn test_ra_server_from_str() {
|
||||
use std::str::FromStr;
|
||||
let subtree_paren_a = tt::TokenTree::Subtree(tt::Subtree {
|
||||
delimiter: Some(tt::Delimiter {
|
Loading…
Reference in a new issue