mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-11-10 07:04:22 +00:00
Rename ra_syntax -> syntax
This commit is contained in:
parent
3d6889cba7
commit
a1c187eef3
958 changed files with 353 additions and 363 deletions
2
.gitattributes
vendored
2
.gitattributes
vendored
|
@ -1,5 +1,5 @@
|
|||
* text=auto eol=lf
|
||||
crates/ra_syntax/test_data/** -text eof=LF
|
||||
crates/syntax/test_data/** -text eof=LF
|
||||
# Older git versions try to fix line endings on images, this prevents it.
|
||||
*.png binary
|
||||
*.jpg binary
|
||||
|
|
68
Cargo.lock
generated
68
Cargo.lock
generated
|
@ -933,9 +933,9 @@ dependencies = [
|
|||
"ra_fmt",
|
||||
"ra_hir",
|
||||
"ra_ide_db",
|
||||
"ra_syntax",
|
||||
"rustc-hash",
|
||||
"stdx",
|
||||
"syntax",
|
||||
"test_utils",
|
||||
"text_edit",
|
||||
]
|
||||
|
@ -945,8 +945,8 @@ name = "ra_cfg"
|
|||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"ra_mbe",
|
||||
"ra_syntax",
|
||||
"rustc-hash",
|
||||
"syntax",
|
||||
"tt",
|
||||
]
|
||||
|
||||
|
@ -956,10 +956,10 @@ version = "0.1.0"
|
|||
dependencies = [
|
||||
"profile",
|
||||
"ra_cfg",
|
||||
"ra_syntax",
|
||||
"rustc-hash",
|
||||
"salsa",
|
||||
"stdx",
|
||||
"syntax",
|
||||
"test_utils",
|
||||
"tt",
|
||||
"vfs",
|
||||
|
@ -970,7 +970,7 @@ name = "ra_fmt"
|
|||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"itertools",
|
||||
"ra_syntax",
|
||||
"syntax",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -986,9 +986,9 @@ dependencies = [
|
|||
"ra_hir_def",
|
||||
"ra_hir_expand",
|
||||
"ra_hir_ty",
|
||||
"ra_syntax",
|
||||
"rustc-hash",
|
||||
"stdx",
|
||||
"syntax",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1010,10 +1010,10 @@ dependencies = [
|
|||
"ra_db",
|
||||
"ra_hir_expand",
|
||||
"ra_mbe",
|
||||
"ra_syntax",
|
||||
"rustc-hash",
|
||||
"smallvec",
|
||||
"stdx",
|
||||
"syntax",
|
||||
"test_utils",
|
||||
"tt",
|
||||
]
|
||||
|
@ -1029,8 +1029,8 @@ dependencies = [
|
|||
"profile",
|
||||
"ra_db",
|
||||
"ra_mbe",
|
||||
"ra_syntax",
|
||||
"rustc-hash",
|
||||
"syntax",
|
||||
"test_utils",
|
||||
"tt",
|
||||
]
|
||||
|
@ -1052,11 +1052,11 @@ dependencies = [
|
|||
"ra_db",
|
||||
"ra_hir_def",
|
||||
"ra_hir_expand",
|
||||
"ra_syntax",
|
||||
"rustc-hash",
|
||||
"scoped-tls",
|
||||
"smallvec",
|
||||
"stdx",
|
||||
"syntax",
|
||||
"test_utils",
|
||||
"tracing",
|
||||
"tracing-subscriber",
|
||||
|
@ -1081,9 +1081,9 @@ dependencies = [
|
|||
"ra_hir",
|
||||
"ra_ide_db",
|
||||
"ra_ssr",
|
||||
"ra_syntax",
|
||||
"rustc-hash",
|
||||
"stdx",
|
||||
"syntax",
|
||||
"test_utils",
|
||||
"text_edit",
|
||||
]
|
||||
|
@ -1099,10 +1099,10 @@ dependencies = [
|
|||
"profile",
|
||||
"ra_db",
|
||||
"ra_hir",
|
||||
"ra_syntax",
|
||||
"rayon",
|
||||
"rustc-hash",
|
||||
"stdx",
|
||||
"syntax",
|
||||
"test_utils",
|
||||
"text_edit",
|
||||
]
|
||||
|
@ -1113,9 +1113,9 @@ version = "0.1.0"
|
|||
dependencies = [
|
||||
"log",
|
||||
"parser",
|
||||
"ra_syntax",
|
||||
"rustc-hash",
|
||||
"smallvec",
|
||||
"syntax",
|
||||
"test_utils",
|
||||
"tt",
|
||||
]
|
||||
|
@ -1176,33 +1176,12 @@ dependencies = [
|
|||
"ra_db",
|
||||
"ra_hir",
|
||||
"ra_ide_db",
|
||||
"ra_syntax",
|
||||
"rustc-hash",
|
||||
"syntax",
|
||||
"test_utils",
|
||||
"text_edit",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ra_syntax"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"arrayvec",
|
||||
"expect",
|
||||
"itertools",
|
||||
"once_cell",
|
||||
"parser",
|
||||
"rayon",
|
||||
"rowan",
|
||||
"rustc-ap-rustc_lexer",
|
||||
"rustc-hash",
|
||||
"serde",
|
||||
"smol_str",
|
||||
"stdx",
|
||||
"test_utils",
|
||||
"text_edit",
|
||||
"walkdir",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rayon"
|
||||
version = "1.3.1"
|
||||
|
@ -1304,12 +1283,12 @@ dependencies = [
|
|||
"ra_proc_macro_srv",
|
||||
"ra_project_model",
|
||||
"ra_ssr",
|
||||
"ra_syntax",
|
||||
"rayon",
|
||||
"rustc-hash",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"stdx",
|
||||
"syntax",
|
||||
"test_utils",
|
||||
"text_edit",
|
||||
"threadpool",
|
||||
|
@ -1532,6 +1511,27 @@ dependencies = [
|
|||
"unicode-xid",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "syntax"
|
||||
version = "0.0.0"
|
||||
dependencies = [
|
||||
"arrayvec",
|
||||
"expect",
|
||||
"itertools",
|
||||
"once_cell",
|
||||
"parser",
|
||||
"rayon",
|
||||
"rowan",
|
||||
"rustc-ap-rustc_lexer",
|
||||
"rustc-hash",
|
||||
"serde",
|
||||
"smol_str",
|
||||
"stdx",
|
||||
"test_utils",
|
||||
"text_edit",
|
||||
"walkdir",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "termcolor"
|
||||
version = "1.1.0"
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
//!
|
||||
//! After adding a new inline-test, run `cargo xtask codegen` to
|
||||
//! extract it as a standalone text-fixture into
|
||||
//! `crates/ra_syntax/test_data/parser/`, and run `cargo test` once to
|
||||
//! `crates/syntax/test_data/parser/`, and run `cargo test` once to
|
||||
//! create the "gold" value.
|
||||
//!
|
||||
//! Coding convention: rules like `where_clause` always produce either a
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
//!
|
||||
//! The actual parsing happens in the `grammar` module.
|
||||
//!
|
||||
//! Tests for this crate live in `ra_syntax` crate.
|
||||
//! Tests for this crate live in `syntax` crate.
|
||||
|
||||
#[macro_use]
|
||||
mod token_set;
|
||||
|
|
|
@ -15,7 +15,7 @@ either = "1.5.3"
|
|||
|
||||
stdx = { path = "../stdx" }
|
||||
|
||||
ra_syntax = { path = "../ra_syntax" }
|
||||
syntax = { path = "../syntax" }
|
||||
text_edit = { path = "../text_edit" }
|
||||
ra_fmt = { path = "../ra_fmt" }
|
||||
profile = { path = "../profile" }
|
||||
|
|
|
@ -10,7 +10,7 @@ use ra_ide_db::{
|
|||
source_change::{SourceChange, SourceFileEdit},
|
||||
RootDatabase,
|
||||
};
|
||||
use ra_syntax::{
|
||||
use syntax::{
|
||||
algo::{self, find_node_at_offset, SyntaxRewriter},
|
||||
AstNode, SourceFile, SyntaxElement, SyntaxKind, SyntaxNode, SyntaxToken, TextRange, TextSize,
|
||||
TokenAtOffset,
|
||||
|
@ -271,7 +271,7 @@ impl AssistBuilder {
|
|||
}
|
||||
/// Replaces specified `node` of text with a given string, reindenting the
|
||||
/// string to maintain `node`'s existing indent.
|
||||
// FIXME: remove in favor of ra_syntax::edit::IndentLevel::increase_indent
|
||||
// FIXME: remove in favor of syntax::edit::IndentLevel::increase_indent
|
||||
pub(crate) fn replace_node_and_indent(
|
||||
&mut self,
|
||||
node: &SyntaxNode,
|
||||
|
|
|
@ -2,13 +2,13 @@
|
|||
use rustc_hash::FxHashMap;
|
||||
|
||||
use hir::{HirDisplay, PathResolution, SemanticsScope};
|
||||
use ra_syntax::{
|
||||
use syntax::{
|
||||
algo::SyntaxRewriter,
|
||||
ast::{self, AstNode},
|
||||
};
|
||||
|
||||
pub trait AstTransform<'a> {
|
||||
fn get_substitution(&self, node: &ra_syntax::SyntaxNode) -> Option<ra_syntax::SyntaxNode>;
|
||||
fn get_substitution(&self, node: &syntax::SyntaxNode) -> Option<syntax::SyntaxNode>;
|
||||
|
||||
fn chain_before(self, other: Box<dyn AstTransform<'a> + 'a>) -> Box<dyn AstTransform<'a> + 'a>;
|
||||
fn or<T: AstTransform<'a> + 'a>(self, other: T) -> Box<dyn AstTransform<'a> + 'a>
|
||||
|
@ -22,7 +22,7 @@ pub trait AstTransform<'a> {
|
|||
struct NullTransformer;
|
||||
|
||||
impl<'a> AstTransform<'a> for NullTransformer {
|
||||
fn get_substitution(&self, _node: &ra_syntax::SyntaxNode) -> Option<ra_syntax::SyntaxNode> {
|
||||
fn get_substitution(&self, _node: &syntax::SyntaxNode) -> Option<syntax::SyntaxNode> {
|
||||
None
|
||||
}
|
||||
fn chain_before(self, other: Box<dyn AstTransform<'a> + 'a>) -> Box<dyn AstTransform<'a> + 'a> {
|
||||
|
@ -101,10 +101,7 @@ impl<'a> SubstituteTypeParams<'a> {
|
|||
Some(result)
|
||||
}
|
||||
}
|
||||
fn get_substitution_inner(
|
||||
&self,
|
||||
node: &ra_syntax::SyntaxNode,
|
||||
) -> Option<ra_syntax::SyntaxNode> {
|
||||
fn get_substitution_inner(&self, node: &syntax::SyntaxNode) -> Option<syntax::SyntaxNode> {
|
||||
let type_ref = ast::Type::cast(node.clone())?;
|
||||
let path = match &type_ref {
|
||||
ast::Type::PathType(path_type) => path_type.path()?,
|
||||
|
@ -122,7 +119,7 @@ impl<'a> SubstituteTypeParams<'a> {
|
|||
}
|
||||
|
||||
impl<'a> AstTransform<'a> for SubstituteTypeParams<'a> {
|
||||
fn get_substitution(&self, node: &ra_syntax::SyntaxNode) -> Option<ra_syntax::SyntaxNode> {
|
||||
fn get_substitution(&self, node: &syntax::SyntaxNode) -> Option<syntax::SyntaxNode> {
|
||||
self.get_substitution_inner(node).or_else(|| self.previous.get_substitution(node))
|
||||
}
|
||||
fn chain_before(self, other: Box<dyn AstTransform<'a> + 'a>) -> Box<dyn AstTransform<'a> + 'a> {
|
||||
|
@ -141,10 +138,7 @@ impl<'a> QualifyPaths<'a> {
|
|||
Self { target_scope, source_scope, previous: Box::new(NullTransformer) }
|
||||
}
|
||||
|
||||
fn get_substitution_inner(
|
||||
&self,
|
||||
node: &ra_syntax::SyntaxNode,
|
||||
) -> Option<ra_syntax::SyntaxNode> {
|
||||
fn get_substitution_inner(&self, node: &syntax::SyntaxNode) -> Option<syntax::SyntaxNode> {
|
||||
// FIXME handle value ns?
|
||||
let from = self.target_scope.module()?;
|
||||
let p = ast::Path::cast(node.clone())?;
|
||||
|
@ -183,7 +177,7 @@ impl<'a> QualifyPaths<'a> {
|
|||
|
||||
pub fn apply<'a, N: AstNode>(transformer: &dyn AstTransform<'a>, node: N) -> N {
|
||||
SyntaxRewriter::from_fn(|element| match element {
|
||||
ra_syntax::SyntaxElement::Node(n) => {
|
||||
syntax::SyntaxElement::Node(n) => {
|
||||
let replacement = transformer.get_substitution(&n)?;
|
||||
Some(replacement.into())
|
||||
}
|
||||
|
@ -193,7 +187,7 @@ pub fn apply<'a, N: AstNode>(transformer: &dyn AstTransform<'a>, node: N) -> N {
|
|||
}
|
||||
|
||||
impl<'a> AstTransform<'a> for QualifyPaths<'a> {
|
||||
fn get_substitution(&self, node: &ra_syntax::SyntaxNode) -> Option<ra_syntax::SyntaxNode> {
|
||||
fn get_substitution(&self, node: &syntax::SyntaxNode) -> Option<syntax::SyntaxNode> {
|
||||
self.get_substitution_inner(node).or_else(|| self.previous.get_substitution(node))
|
||||
}
|
||||
fn chain_before(self, other: Box<dyn AstTransform<'a> + 'a>) -> Box<dyn AstTransform<'a> + 'a> {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use itertools::Itertools;
|
||||
use ra_syntax::{
|
||||
use syntax::{
|
||||
ast::{self, AstNode},
|
||||
Direction, SmolStr,
|
||||
SyntaxKind::{IDENT, WHITESPACE},
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use hir::HirDisplay;
|
||||
use ra_syntax::{
|
||||
use syntax::{
|
||||
ast::{self, AstNode, LetStmt, NameOwner},
|
||||
TextRange,
|
||||
};
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use hir::HasSource;
|
||||
use ra_syntax::{
|
||||
use syntax::{
|
||||
ast::{
|
||||
self,
|
||||
edit::{self, AstNodeEdit, IndentLevel},
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use ra_ide_db::defs::{classify_name_ref, Definition, NameRefClass};
|
||||
use ra_syntax::{ast, AstNode, SyntaxKind, T};
|
||||
use syntax::{ast, AstNode, SyntaxKind, T};
|
||||
use test_utils::mark;
|
||||
|
||||
use crate::{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use ra_syntax::ast::{self, AstNode};
|
||||
use syntax::ast::{self, AstNode};
|
||||
|
||||
use crate::{utils::invert_boolean_expression, AssistContext, AssistId, AssistKind, Assists};
|
||||
|
||||
|
|
|
@ -6,11 +6,11 @@ use hir::{
|
|||
Type,
|
||||
};
|
||||
use ra_ide_db::{imports_locator, RootDatabase};
|
||||
use ra_syntax::{
|
||||
use rustc_hash::FxHashSet;
|
||||
use syntax::{
|
||||
ast::{self, AstNode},
|
||||
SyntaxNode,
|
||||
};
|
||||
use rustc_hash::FxHashSet;
|
||||
|
||||
use crate::{
|
||||
utils::insert_use_statement, AssistContext, AssistId, AssistKind, Assists, GroupLabel,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use ra_syntax::{
|
||||
use syntax::{
|
||||
ast::{self, BlockExpr, Expr, LoopBodyOwner},
|
||||
AstNode, SyntaxNode,
|
||||
};
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use ra_syntax::{
|
||||
use syntax::{
|
||||
ast::{self, NameOwner, VisibilityOwner},
|
||||
AstNode,
|
||||
SyntaxKind::{CONST, ENUM, FN, MODULE, STATIC, STRUCT, TRAIT, VISIBILITY},
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use std::{iter::once, ops::RangeInclusive};
|
||||
|
||||
use ra_syntax::{
|
||||
use syntax::{
|
||||
algo::replace_children,
|
||||
ast::{
|
||||
self,
|
||||
|
|
|
@ -3,7 +3,7 @@ use ra_ide_db::{
|
|||
defs::{classify_name_ref, Definition, NameRefClass},
|
||||
RootDatabase,
|
||||
};
|
||||
use ra_syntax::{algo, ast, match_ast, AstNode, SyntaxNode, SyntaxToken, T};
|
||||
use syntax::{algo, ast, match_ast, AstNode, SyntaxNode, SyntaxToken, T};
|
||||
|
||||
use crate::{
|
||||
assist_context::{AssistBuilder, AssistContext, Assists},
|
||||
|
|
|
@ -2,12 +2,12 @@ use hir::{EnumVariant, Module, ModuleDef, Name};
|
|||
use ra_db::FileId;
|
||||
use ra_fmt::leading_indent;
|
||||
use ra_ide_db::{defs::Definition, search::Reference, RootDatabase};
|
||||
use ra_syntax::{
|
||||
use rustc_hash::FxHashSet;
|
||||
use syntax::{
|
||||
algo::find_node_at_offset,
|
||||
ast::{self, ArgListOwner, AstNode, NameOwner, VisibilityOwner},
|
||||
SourceFile, SyntaxNode, TextRange, TextSize,
|
||||
};
|
||||
use rustc_hash::FxHashSet;
|
||||
|
||||
use crate::{
|
||||
assist_context::AssistBuilder, utils::insert_use_statement, AssistContext, AssistId,
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
use ra_syntax::{
|
||||
use stdx::format_to;
|
||||
use syntax::{
|
||||
ast::{self, AstNode},
|
||||
SyntaxKind::{
|
||||
BLOCK_EXPR, BREAK_EXPR, CLOSURE_EXPR, COMMENT, LOOP_EXPR, MATCH_ARM, PATH_EXPR, RETURN_EXPR,
|
||||
},
|
||||
SyntaxNode,
|
||||
};
|
||||
use stdx::format_to;
|
||||
use test_utils::mark;
|
||||
|
||||
use crate::{AssistContext, AssistId, AssistKind, Assists};
|
||||
|
|
|
@ -3,7 +3,7 @@ use std::iter;
|
|||
use hir::{Adt, HasSource, ModuleDef, Semantics};
|
||||
use itertools::Itertools;
|
||||
use ra_ide_db::RootDatabase;
|
||||
use ra_syntax::ast::{self, make, AstNode, MatchArm, NameOwner, Pat};
|
||||
use syntax::ast::{self, make, AstNode, MatchArm, NameOwner, Pat};
|
||||
use test_utils::mark;
|
||||
|
||||
use crate::{
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use hir::{db::HirDatabase, HasSource, HasVisibility, PathResolution};
|
||||
use ra_db::FileId;
|
||||
use ra_syntax::{ast, AstNode, TextRange, TextSize};
|
||||
use syntax::{ast, AstNode, TextRange, TextSize};
|
||||
|
||||
use crate::{utils::vis_offset, AssistContext, AssistId, AssistKind, Assists};
|
||||
use ast::VisibilityOwner;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use ra_syntax::ast::{AstNode, BinExpr, BinOp};
|
||||
use syntax::ast::{AstNode, BinExpr, BinOp};
|
||||
|
||||
use crate::{AssistContext, AssistId, AssistKind, Assists};
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use ra_syntax::{algo::non_trivia_sibling, Direction, T};
|
||||
use syntax::{algo::non_trivia_sibling, Direction, T};
|
||||
|
||||
use crate::{AssistContext, AssistId, AssistKind, Assists};
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use ra_syntax::{
|
||||
use syntax::{
|
||||
algo::non_trivia_sibling,
|
||||
ast::{self, AstNode},
|
||||
Direction, T,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use ra_syntax::{
|
||||
use syntax::{
|
||||
ast::{self, AstNode, AttrsOwner},
|
||||
SyntaxKind::{COMMENT, WHITESPACE},
|
||||
TextSize,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use ra_ide_db::RootDatabase;
|
||||
use ra_syntax::ast::{self, AstNode, NameOwner};
|
||||
use syntax::ast::{self, AstNode, NameOwner};
|
||||
use test_utils::mark;
|
||||
|
||||
use crate::{utils::FamousDefs, AssistContext, AssistId, AssistKind, Assists};
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
use hir::HirDisplay;
|
||||
use ra_db::FileId;
|
||||
use ra_syntax::{
|
||||
use rustc_hash::{FxHashMap, FxHashSet};
|
||||
use syntax::{
|
||||
ast::{
|
||||
self,
|
||||
edit::{AstNodeEdit, IndentLevel},
|
||||
|
@ -8,7 +9,6 @@ use ra_syntax::{
|
|||
},
|
||||
SyntaxKind, SyntaxNode, TextSize,
|
||||
};
|
||||
use rustc_hash::{FxHashMap, FxHashSet};
|
||||
|
||||
use crate::{
|
||||
assist_config::SnippetCap,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use itertools::Itertools;
|
||||
use ra_syntax::ast::{self, AstNode, GenericParamsOwner, NameOwner};
|
||||
use stdx::format_to;
|
||||
use syntax::ast::{self, AstNode, GenericParamsOwner, NameOwner};
|
||||
|
||||
use crate::{AssistContext, AssistId, AssistKind, Assists};
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
use hir::Adt;
|
||||
use itertools::Itertools;
|
||||
use ra_syntax::{
|
||||
use stdx::format_to;
|
||||
use syntax::{
|
||||
ast::{self, AstNode, GenericParamsOwner, NameOwner, StructKind, VisibilityOwner},
|
||||
T,
|
||||
};
|
||||
use stdx::format_to;
|
||||
|
||||
use crate::{AssistContext, AssistId, AssistKind, Assists};
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use ra_ide_db::defs::Definition;
|
||||
use ra_syntax::{
|
||||
use syntax::{
|
||||
ast::{self, AstNode, AstToken},
|
||||
TextRange,
|
||||
};
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
use ra_syntax::{
|
||||
use rustc_hash::FxHashSet;
|
||||
use syntax::{
|
||||
ast::{self, GenericParamsOwner, NameOwner},
|
||||
AstNode, SyntaxKind, TextRange, TextSize,
|
||||
};
|
||||
use rustc_hash::FxHashSet;
|
||||
|
||||
use crate::{assist_context::AssistBuilder, AssistContext, AssistId, AssistKind, Assists};
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use ra_syntax::{
|
||||
use syntax::{
|
||||
ast::{self, AstNode},
|
||||
T,
|
||||
};
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use std::iter::successors;
|
||||
|
||||
use ra_syntax::{
|
||||
use syntax::{
|
||||
algo::{neighbor, skip_trivia_token, SyntaxRewriter},
|
||||
ast::{self, edit::AstNodeEdit, make},
|
||||
AstNode, Direction, InsertPosition, SyntaxElement, T,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use std::iter::successors;
|
||||
|
||||
use ra_syntax::{
|
||||
use syntax::{
|
||||
algo::neighbor,
|
||||
ast::{self, AstNode},
|
||||
Direction,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use ra_syntax::{
|
||||
use syntax::{
|
||||
ast::{self, edit::AstNodeEdit, make, AstNode, NameOwner, TypeBoundsOwner},
|
||||
match_ast,
|
||||
SyntaxKind::*,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use ra_syntax::{
|
||||
use syntax::{
|
||||
ast::{AstNode, IfExpr, MatchArm},
|
||||
SyntaxKind::WHITESPACE,
|
||||
};
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use std::borrow::Cow;
|
||||
|
||||
use ra_syntax::{
|
||||
use syntax::{
|
||||
ast::{self, HasQuotes, HasStringValue},
|
||||
AstToken,
|
||||
SyntaxKind::{RAW_STRING, STRING},
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use ra_syntax::{
|
||||
use syntax::{
|
||||
ast::{self, AstNode},
|
||||
TextRange, TextSize, T,
|
||||
};
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use ra_syntax::{SyntaxKind, TextRange, T};
|
||||
use syntax::{SyntaxKind, TextRange, T};
|
||||
|
||||
use crate::{AssistContext, AssistId, AssistKind, Assists};
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ use rustc_hash::FxHashMap;
|
|||
|
||||
use hir::{Adt, ModuleDef, PathResolution, Semantics, Struct};
|
||||
use ra_ide_db::RootDatabase;
|
||||
use ra_syntax::{algo, ast, match_ast, AstNode, SyntaxKind, SyntaxKind::*, SyntaxNode};
|
||||
use syntax::{algo, ast, match_ast, AstNode, SyntaxKind, SyntaxKind::*, SyntaxNode};
|
||||
|
||||
use crate::{AssistContext, AssistId, AssistKind, Assists};
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use ra_fmt::unwrap_trivial_block;
|
||||
use ra_syntax::{
|
||||
use syntax::{
|
||||
ast::{
|
||||
self,
|
||||
edit::{AstNodeEdit, IndentLevel},
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use std::iter::once;
|
||||
|
||||
use ra_syntax::{
|
||||
use syntax::{
|
||||
ast::{
|
||||
self,
|
||||
edit::{AstNodeEdit, IndentLevel},
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use hir;
|
||||
use ra_syntax::{algo::SyntaxRewriter, ast, match_ast, AstNode, SmolStr, SyntaxNode};
|
||||
use syntax::{algo::SyntaxRewriter, ast, match_ast, AstNode, SmolStr, SyntaxNode};
|
||||
|
||||
use crate::{
|
||||
utils::{find_insert_use_container, insert_use_statement},
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use std::iter;
|
||||
|
||||
use ra_syntax::{
|
||||
use syntax::{
|
||||
ast::{
|
||||
self,
|
||||
edit::{AstNodeEdit, IndentLevel},
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use std::iter::successors;
|
||||
|
||||
use ra_syntax::{ast, AstNode, T};
|
||||
use syntax::{ast, AstNode, T};
|
||||
|
||||
use crate::{AssistContext, AssistId, AssistKind, Assists};
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use ra_fmt::unwrap_trivial_block;
|
||||
use ra_syntax::{
|
||||
use syntax::{
|
||||
ast::{
|
||||
self,
|
||||
edit::{AstNodeEdit, IndentLevel},
|
||||
|
|
|
@ -20,7 +20,7 @@ pub mod ast_transform;
|
|||
use hir::Semantics;
|
||||
use ra_db::FileRange;
|
||||
use ra_ide_db::{source_change::SourceChange, RootDatabase};
|
||||
use ra_syntax::TextRange;
|
||||
use syntax::TextRange;
|
||||
|
||||
pub(crate) use crate::assist_context::{AssistContext, Assists};
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ mod generated;
|
|||
use hir::Semantics;
|
||||
use ra_db::{fixture::WithFixture, FileId, FileRange, SourceDatabaseExt};
|
||||
use ra_ide_db::RootDatabase;
|
||||
use ra_syntax::TextRange;
|
||||
use syntax::TextRange;
|
||||
use test_utils::{assert_eq_text, extract_offset, extract_range};
|
||||
|
||||
use crate::{handlers::Handler, Assist, AssistConfig, AssistContext, AssistKind, Assists};
|
||||
|
|
|
@ -5,13 +5,13 @@ use std::{iter, ops};
|
|||
|
||||
use hir::{Adt, Crate, Enum, ScopeDef, Semantics, Trait, Type};
|
||||
use ra_ide_db::RootDatabase;
|
||||
use ra_syntax::{
|
||||
use rustc_hash::FxHashSet;
|
||||
use syntax::{
|
||||
ast::{self, make, NameOwner},
|
||||
AstNode,
|
||||
SyntaxKind::*,
|
||||
SyntaxNode, TextSize, T,
|
||||
};
|
||||
use rustc_hash::FxHashSet;
|
||||
|
||||
use crate::assist_config::SnippetCap;
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
use either::Either;
|
||||
use hir::{self, ModPath};
|
||||
use ra_syntax::{
|
||||
use syntax::{
|
||||
ast::{self, NameOwner, VisibilityOwner},
|
||||
AstNode, Direction, SmolStr,
|
||||
SyntaxKind::{PATH, PATH_SEGMENT},
|
||||
|
|
|
@ -11,7 +11,7 @@ doctest = false
|
|||
[dependencies]
|
||||
rustc-hash = "1.1.0"
|
||||
|
||||
ra_syntax = { path = "../ra_syntax" }
|
||||
syntax = { path = "../syntax" }
|
||||
tt = { path = "../tt" }
|
||||
|
||||
[dev-dependencies]
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
use std::slice::Iter as SliceIter;
|
||||
|
||||
use ra_syntax::SmolStr;
|
||||
use syntax::SmolStr;
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub enum CfgExpr {
|
||||
|
@ -87,7 +87,7 @@ mod tests {
|
|||
use super::*;
|
||||
|
||||
use mbe::{ast_to_token_tree, TokenMap};
|
||||
use ra_syntax::ast::{self, AstNode};
|
||||
use syntax::ast::{self, AstNode};
|
||||
|
||||
fn get_token_tree_generated(input: &str) -> (tt::Subtree, TokenMap) {
|
||||
let source_file = ast::SourceFile::parse(input).ok().unwrap();
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
mod cfg_expr;
|
||||
|
||||
use ra_syntax::SmolStr;
|
||||
use rustc_hash::FxHashSet;
|
||||
use syntax::SmolStr;
|
||||
|
||||
pub use cfg_expr::CfgExpr;
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ doctest = false
|
|||
salsa = "0.15.2"
|
||||
rustc-hash = "1.1.0"
|
||||
|
||||
ra_syntax = { path = "../ra_syntax" }
|
||||
syntax = { path = "../syntax" }
|
||||
ra_cfg = { path = "../ra_cfg" }
|
||||
profile = { path = "../profile" }
|
||||
tt = { path = "../tt" }
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
use std::{fmt, iter::FromIterator, ops, str::FromStr, sync::Arc};
|
||||
|
||||
use ra_cfg::CfgOptions;
|
||||
use ra_syntax::SmolStr;
|
||||
use rustc_hash::{FxHashMap, FxHashSet};
|
||||
use syntax::SmolStr;
|
||||
use tt::TokenExpander;
|
||||
use vfs::file_set::FileSet;
|
||||
|
||||
|
|
|
@ -5,8 +5,8 @@ pub mod fixture;
|
|||
|
||||
use std::{panic, sync::Arc};
|
||||
|
||||
use ra_syntax::{ast, Parse, SourceFile, TextRange, TextSize};
|
||||
use rustc_hash::FxHashSet;
|
||||
use syntax::{ast, Parse, SourceFile, TextRange, TextSize};
|
||||
|
||||
pub use crate::{
|
||||
cancellation::Canceled,
|
||||
|
|
|
@ -12,4 +12,4 @@ doctest = false
|
|||
[dependencies]
|
||||
itertools = "0.9.0"
|
||||
|
||||
ra_syntax = { path = "../ra_syntax" }
|
||||
syntax = { path = "../syntax" }
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
use std::iter::successors;
|
||||
|
||||
use itertools::Itertools;
|
||||
use ra_syntax::{
|
||||
use syntax::{
|
||||
ast::{self, AstNode, AstToken},
|
||||
SmolStr, SyntaxKind,
|
||||
SyntaxKind::*,
|
||||
|
|
|
@ -17,7 +17,7 @@ arrayvec = "0.5.1"
|
|||
itertools = "0.9.0"
|
||||
|
||||
stdx = { path = "../stdx" }
|
||||
ra_syntax = { path = "../ra_syntax" }
|
||||
syntax = { path = "../syntax" }
|
||||
ra_db = { path = "../ra_db" }
|
||||
profile = { path = "../profile" }
|
||||
hir_expand = { path = "../ra_hir_expand", package = "ra_hir_expand" }
|
||||
|
|
|
@ -31,12 +31,12 @@ use hir_ty::{
|
|||
InEnvironment, Substs, TraitEnvironment, Ty, TyDefId, TypeCtor,
|
||||
};
|
||||
use ra_db::{CrateId, Edition, FileId};
|
||||
use ra_syntax::{
|
||||
use rustc_hash::FxHashSet;
|
||||
use stdx::impl_from;
|
||||
use syntax::{
|
||||
ast::{self, AttrsOwner, NameOwner},
|
||||
AstNode,
|
||||
};
|
||||
use rustc_hash::FxHashSet;
|
||||
use stdx::impl_from;
|
||||
|
||||
use crate::{
|
||||
db::{DefDatabase, HirDatabase},
|
||||
|
|
|
@ -6,7 +6,7 @@ use hir_def::{
|
|||
src::{HasChildSource, HasSource as _},
|
||||
Lookup, VariantId,
|
||||
};
|
||||
use ra_syntax::ast;
|
||||
use syntax::ast;
|
||||
|
||||
use crate::{
|
||||
db::HirDatabase, Const, Enum, EnumVariant, Field, FieldSource, Function, ImplDef, MacroDef,
|
||||
|
|
|
@ -12,11 +12,11 @@ use hir_expand::{hygiene::Hygiene, name::AsName, ExpansionInfo};
|
|||
use hir_ty::associated_type_shorthand_candidates;
|
||||
use itertools::Itertools;
|
||||
use ra_db::{FileId, FileRange};
|
||||
use ra_syntax::{
|
||||
use rustc_hash::{FxHashMap, FxHashSet};
|
||||
use syntax::{
|
||||
algo::{find_node_at_offset, skip_trivia_token},
|
||||
ast, AstNode, Direction, SyntaxNode, SyntaxToken, TextRange, TextSize,
|
||||
};
|
||||
use rustc_hash::{FxHashMap, FxHashSet};
|
||||
|
||||
use crate::{
|
||||
db::HirDatabase,
|
||||
|
|
|
@ -10,12 +10,12 @@ use hir_def::{
|
|||
};
|
||||
use hir_expand::{name::AsName, AstId, MacroDefKind};
|
||||
use ra_db::FileId;
|
||||
use ra_syntax::{
|
||||
use rustc_hash::FxHashMap;
|
||||
use stdx::impl_from;
|
||||
use syntax::{
|
||||
ast::{self, NameOwner},
|
||||
match_ast, AstNode, SyntaxNode,
|
||||
};
|
||||
use rustc_hash::FxHashMap;
|
||||
use stdx::impl_from;
|
||||
|
||||
use crate::{db::HirDatabase, InFile, MacroDefId};
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ use hir_ty::{
|
|||
diagnostics::{record_literal_missing_fields, record_pattern_missing_fields},
|
||||
InferenceResult, Substs, Ty,
|
||||
};
|
||||
use ra_syntax::{
|
||||
use syntax::{
|
||||
ast::{self, AstNode},
|
||||
SyntaxNode, TextRange, TextSize,
|
||||
};
|
||||
|
|
|
@ -24,7 +24,7 @@ stdx = { path = "../stdx" }
|
|||
|
||||
arena = { path = "../arena" }
|
||||
ra_db = { path = "../ra_db" }
|
||||
ra_syntax = { path = "../ra_syntax" }
|
||||
syntax = { path = "../syntax" }
|
||||
profile = { path = "../profile" }
|
||||
hir_expand = { path = "../ra_hir_expand", package = "ra_hir_expand" }
|
||||
test_utils = { path = "../test_utils" }
|
||||
|
|
|
@ -8,7 +8,7 @@ use hir_expand::{
|
|||
name::{AsName, Name},
|
||||
InFile,
|
||||
};
|
||||
use ra_syntax::ast::{self, NameOwner, VisibilityOwner};
|
||||
use syntax::ast::{self, NameOwner, VisibilityOwner};
|
||||
use tt::{Delimiter, DelimiterKind, Leaf, Subtree, TokenTree};
|
||||
|
||||
use crate::{
|
||||
|
|
|
@ -6,7 +6,7 @@ use either::Either;
|
|||
use hir_expand::{hygiene::Hygiene, AstId, InFile};
|
||||
use mbe::ast_to_token_tree;
|
||||
use ra_cfg::{CfgExpr, CfgOptions};
|
||||
use ra_syntax::{
|
||||
use syntax::{
|
||||
ast::{self, AstNode, AttrsOwner},
|
||||
SmolStr,
|
||||
};
|
||||
|
|
|
@ -11,8 +11,8 @@ use either::Either;
|
|||
use hir_expand::{ast_id_map::AstIdMap, hygiene::Hygiene, AstId, HirFileId, InFile, MacroDefId};
|
||||
use ra_cfg::CfgOptions;
|
||||
use ra_db::CrateId;
|
||||
use ra_syntax::{ast, AstNode, AstPtr};
|
||||
use rustc_hash::FxHashMap;
|
||||
use syntax::{ast, AstNode, AstPtr};
|
||||
use test_utils::mark;
|
||||
|
||||
pub(crate) use lower::LowerCtx;
|
||||
|
|
|
@ -10,14 +10,14 @@ use hir_expand::{
|
|||
name::{name, AsName, Name},
|
||||
HirFileId, MacroDefId, MacroDefKind,
|
||||
};
|
||||
use ra_syntax::{
|
||||
use rustc_hash::FxHashMap;
|
||||
use syntax::{
|
||||
ast::{
|
||||
self, ArgListOwner, ArrayExprKind, AstChildren, LiteralKind, LoopBodyOwner, NameOwner,
|
||||
SlicePatComponents,
|
||||
},
|
||||
AstNode, AstPtr,
|
||||
};
|
||||
use rustc_hash::FxHashMap;
|
||||
use test_utils::mark;
|
||||
|
||||
use crate::{
|
||||
|
|
|
@ -171,7 +171,7 @@ fn compute_expr_scopes(expr: ExprId, body: &Body, scopes: &mut ExprScopes, scope
|
|||
mod tests {
|
||||
use hir_expand::{name::AsName, InFile};
|
||||
use ra_db::{fixture::WithFixture, FileId, SourceDatabase};
|
||||
use ra_syntax::{algo::find_node_at_offset, ast, AstNode};
|
||||
use syntax::{algo::find_node_at_offset, ast, AstNode};
|
||||
use test_utils::{assert_eq_text, extract_offset, mark};
|
||||
|
||||
use crate::{db::DefDatabase, test_db::TestDB, FunctionId, ModuleDefId};
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
use std::sync::Arc;
|
||||
|
||||
use hir_expand::{name::Name, InFile};
|
||||
use ra_syntax::ast;
|
||||
use syntax::ast;
|
||||
|
||||
use crate::{
|
||||
attr::Attrs,
|
||||
|
|
|
@ -3,7 +3,7 @@ use std::sync::Arc;
|
|||
|
||||
use hir_expand::{db::AstDatabase, HirFileId};
|
||||
use ra_db::{salsa, CrateId, SourceDatabase, Upcast};
|
||||
use ra_syntax::SmolStr;
|
||||
use syntax::SmolStr;
|
||||
|
||||
use crate::{
|
||||
adt::{EnumData, StructData},
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
use std::any::Any;
|
||||
|
||||
use hir_expand::diagnostics::Diagnostic;
|
||||
use ra_syntax::{ast, AstPtr, SyntaxNodePtr};
|
||||
use syntax::{ast, AstPtr, SyntaxNodePtr};
|
||||
|
||||
use hir_expand::{HirFileId, InFile};
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
use std::sync::Arc;
|
||||
|
||||
use either::Either;
|
||||
use ra_syntax::ast;
|
||||
use syntax::ast;
|
||||
|
||||
use crate::{
|
||||
db::DefDatabase,
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
use arena::{Idx, RawId};
|
||||
use hir_expand::name::Name;
|
||||
use ra_syntax::ast::RangeOp;
|
||||
use syntax::ast::RangeOp;
|
||||
|
||||
use crate::{
|
||||
builtin_type::{BuiltinFloat, BuiltinInt},
|
||||
|
@ -197,7 +197,7 @@ pub enum ArithOp {
|
|||
BitAnd,
|
||||
}
|
||||
|
||||
pub use ra_syntax::ast::PrefixOp as UnaryOp;
|
||||
pub use syntax::ast::PrefixOp as UnaryOp;
|
||||
#[derive(Debug, Clone, Eq, PartialEq)]
|
||||
pub enum Array {
|
||||
ElementList(Vec<ExprId>),
|
||||
|
|
|
@ -294,7 +294,7 @@ fn find_local_import_locations(
|
|||
mod tests {
|
||||
use hir_expand::hygiene::Hygiene;
|
||||
use ra_db::fixture::WithFixture;
|
||||
use ra_syntax::ast::AstNode;
|
||||
use syntax::ast::AstNode;
|
||||
use test_utils::mark;
|
||||
|
||||
use crate::test_db::TestDB;
|
||||
|
@ -307,12 +307,9 @@ mod tests {
|
|||
fn check_found_path(ra_fixture: &str, path: &str) {
|
||||
let (db, pos) = TestDB::with_position(ra_fixture);
|
||||
let module = db.module_for_file(pos.file_id);
|
||||
let parsed_path_file = ra_syntax::SourceFile::parse(&format!("use {};", path));
|
||||
let ast_path = parsed_path_file
|
||||
.syntax_node()
|
||||
.descendants()
|
||||
.find_map(ra_syntax::ast::Path::cast)
|
||||
.unwrap();
|
||||
let parsed_path_file = syntax::SourceFile::parse(&format!("use {};", path));
|
||||
let ast_path =
|
||||
parsed_path_file.syntax_node().descendants().find_map(syntax::ast::Path::cast).unwrap();
|
||||
let mod_path = ModPath::from_src(ast_path, &Hygiene::new_unhygienic()).unwrap();
|
||||
|
||||
let crate_def_map = db.crate_def_map(module.krate);
|
||||
|
@ -441,12 +438,12 @@ mod tests {
|
|||
// already in scope.
|
||||
check_found_path(
|
||||
r#"
|
||||
//- /main.rs crate:main deps:ra_syntax
|
||||
//- /main.rs crate:main deps:syntax
|
||||
|
||||
use ra_syntax::ast;
|
||||
use syntax::ast;
|
||||
<|>
|
||||
|
||||
//- /lib.rs crate:ra_syntax
|
||||
//- /lib.rs crate:syntax
|
||||
pub mod ast {
|
||||
pub enum ModuleItem {
|
||||
A, B, C,
|
||||
|
@ -458,18 +455,18 @@ mod tests {
|
|||
|
||||
check_found_path(
|
||||
r#"
|
||||
//- /main.rs crate:main deps:ra_syntax
|
||||
//- /main.rs crate:main deps:syntax
|
||||
|
||||
<|>
|
||||
|
||||
//- /lib.rs crate:ra_syntax
|
||||
//- /lib.rs crate:syntax
|
||||
pub mod ast {
|
||||
pub enum ModuleItem {
|
||||
A, B, C,
|
||||
}
|
||||
}
|
||||
"#,
|
||||
"ra_syntax::ast::ModuleItem",
|
||||
"syntax::ast::ModuleItem",
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ use hir_expand::{
|
|||
InFile,
|
||||
};
|
||||
use ra_db::FileId;
|
||||
use ra_syntax::ast::{self, GenericParamsOwner, NameOwner, TypeBoundsOwner};
|
||||
use syntax::ast::{self, GenericParamsOwner, NameOwner, TypeBoundsOwner};
|
||||
|
||||
use crate::{
|
||||
body::LowerCtx,
|
||||
|
|
|
@ -5,9 +5,9 @@ use std::{cmp::Ordering, fmt, hash::BuildHasherDefault, sync::Arc};
|
|||
use fst::{self, Streamer};
|
||||
use indexmap::{map::Entry, IndexMap};
|
||||
use ra_db::CrateId;
|
||||
use ra_syntax::SmolStr;
|
||||
use rustc_hash::{FxHashMap, FxHasher};
|
||||
use smallvec::SmallVec;
|
||||
use syntax::SmolStr;
|
||||
|
||||
use crate::{
|
||||
db::DefDatabase,
|
||||
|
|
|
@ -22,9 +22,9 @@ use hir_expand::{
|
|||
name::{name, AsName, Name},
|
||||
HirFileId, InFile,
|
||||
};
|
||||
use ra_syntax::{ast, match_ast};
|
||||
use rustc_hash::FxHashMap;
|
||||
use smallvec::SmallVec;
|
||||
use syntax::{ast, match_ast};
|
||||
use test_utils::mark;
|
||||
|
||||
use crate::{
|
||||
|
|
|
@ -4,11 +4,11 @@ use std::{collections::hash_map::Entry, mem, sync::Arc};
|
|||
|
||||
use arena::map::ArenaMap;
|
||||
use hir_expand::{ast_id_map::AstIdMap, hygiene::Hygiene, HirFileId};
|
||||
use ra_syntax::{
|
||||
use smallvec::SmallVec;
|
||||
use syntax::{
|
||||
ast::{self, ModuleItemOwner},
|
||||
SyntaxNode,
|
||||
};
|
||||
use smallvec::SmallVec;
|
||||
|
||||
use crate::{
|
||||
attr::Attrs,
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
use expect::{expect, Expect};
|
||||
use hir_expand::{db::AstDatabase, HirFileId, InFile};
|
||||
use ra_db::fixture::WithFixture;
|
||||
use ra_syntax::{ast, AstNode};
|
||||
use rustc_hash::FxHashSet;
|
||||
use std::sync::Arc;
|
||||
use stdx::format_to;
|
||||
use syntax::{ast, AstNode};
|
||||
|
||||
use crate::{db::DefDatabase, test_db::TestDB};
|
||||
|
||||
|
@ -228,31 +228,31 @@ fn smoke() {
|
|||
|
||||
top-level items:
|
||||
#[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("attr_on_use"))] }, input: None }]) }]
|
||||
Import { path: ModPath { kind: Plain, segments: [Name(Text("a"))] }, alias: None, visibility: RawVisibilityId("pub(self)"), is_glob: false, is_prelude: false, ast_id: FileAstId::<ra_syntax::ast::generated::nodes::Use>(0) }
|
||||
Import { path: ModPath { kind: Plain, segments: [Name(Text("a"))] }, alias: None, visibility: RawVisibilityId("pub(self)"), is_glob: false, is_prelude: false, ast_id: FileAstId::<syntax::ast::generated::nodes::Use>(0) }
|
||||
#[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("attr_on_use"))] }, input: None }]) }]
|
||||
Import { path: ModPath { kind: Plain, segments: [Name(Text("b"))] }, alias: None, visibility: RawVisibilityId("pub(self)"), is_glob: true, is_prelude: false, ast_id: FileAstId::<ra_syntax::ast::generated::nodes::Use>(0) }
|
||||
Import { path: ModPath { kind: Plain, segments: [Name(Text("b"))] }, alias: None, visibility: RawVisibilityId("pub(self)"), is_glob: true, is_prelude: false, ast_id: FileAstId::<syntax::ast::generated::nodes::Use>(0) }
|
||||
#[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("ext_crate"))] }, input: None }]) }]
|
||||
ExternCrate { path: ModPath { kind: Plain, segments: [Name(Text("krate"))] }, alias: None, visibility: RawVisibilityId("pub(self)"), is_macro_use: false, ast_id: FileAstId::<ra_syntax::ast::generated::nodes::ExternCrate>(1) }
|
||||
ExternCrate { path: ModPath { kind: Plain, segments: [Name(Text("krate"))] }, alias: None, visibility: RawVisibilityId("pub(self)"), is_macro_use: false, ast_id: FileAstId::<syntax::ast::generated::nodes::ExternCrate>(1) }
|
||||
#[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("on_trait"))] }, input: None }]) }]
|
||||
Trait { name: Name(Text("Tr")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(0), auto: false, items: [TypeAlias(Idx::<TypeAlias>(0)), Const(Idx::<Const>(0)), Function(Idx::<Function>(0)), Function(Idx::<Function>(1))], ast_id: FileAstId::<ra_syntax::ast::generated::nodes::Trait>(2) }
|
||||
Trait { name: Name(Text("Tr")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(0), auto: false, items: [TypeAlias(Idx::<TypeAlias>(0)), Const(Idx::<Const>(0)), Function(Idx::<Function>(0)), Function(Idx::<Function>(1))], ast_id: FileAstId::<syntax::ast::generated::nodes::Trait>(2) }
|
||||
> #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("assoc_ty"))] }, input: None }]) }]
|
||||
> TypeAlias { name: Name(Text("AssocTy")), visibility: RawVisibilityId("pub(self)"), bounds: [Path(Path { type_anchor: None, mod_path: ModPath { kind: Plain, segments: [Name(Text("Tr"))] }, generic_args: [Some(GenericArgs { args: [Type(Tuple([]))], has_self_type: false, bindings: [] })] })], generic_params: GenericParamsId(4294967295), type_ref: None, ast_id: FileAstId::<ra_syntax::ast::generated::nodes::TypeAlias>(8) }
|
||||
> TypeAlias { name: Name(Text("AssocTy")), visibility: RawVisibilityId("pub(self)"), bounds: [Path(Path { type_anchor: None, mod_path: ModPath { kind: Plain, segments: [Name(Text("Tr"))] }, generic_args: [Some(GenericArgs { args: [Type(Tuple([]))], has_self_type: false, bindings: [] })] })], generic_params: GenericParamsId(4294967295), type_ref: None, ast_id: FileAstId::<syntax::ast::generated::nodes::TypeAlias>(8) }
|
||||
> #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("assoc_const"))] }, input: None }]) }]
|
||||
> Const { name: Some(Name(Text("CONST"))), visibility: RawVisibilityId("pub(self)"), type_ref: Path(Path { type_anchor: None, mod_path: ModPath { kind: Plain, segments: [Name(Text("u8"))] }, generic_args: [None] }), ast_id: FileAstId::<ra_syntax::ast::generated::nodes::Const>(9) }
|
||||
> Const { name: Some(Name(Text("CONST"))), visibility: RawVisibilityId("pub(self)"), type_ref: Path(Path { type_anchor: None, mod_path: ModPath { kind: Plain, segments: [Name(Text("u8"))] }, generic_args: [None] }), ast_id: FileAstId::<syntax::ast::generated::nodes::Const>(9) }
|
||||
> #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("assoc_method"))] }, input: None }]) }]
|
||||
> Function { name: Name(Text("method")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(4294967295), has_self_param: true, is_unsafe: false, params: [Reference(Path(Path { type_anchor: None, mod_path: ModPath { kind: Plain, segments: [Name(Text("Self"))] }, generic_args: [None] }), Shared)], is_varargs: false, ret_type: Tuple([]), ast_id: FileAstId::<ra_syntax::ast::generated::nodes::Fn>(10) }
|
||||
> Function { name: Name(Text("method")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(4294967295), has_self_param: true, is_unsafe: false, params: [Reference(Path(Path { type_anchor: None, mod_path: ModPath { kind: Plain, segments: [Name(Text("Self"))] }, generic_args: [None] }), Shared)], is_varargs: false, ret_type: Tuple([]), ast_id: FileAstId::<syntax::ast::generated::nodes::Fn>(10) }
|
||||
> #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("assoc_dfl_method"))] }, input: None }]) }]
|
||||
> Function { name: Name(Text("dfl_method")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(4294967295), has_self_param: true, is_unsafe: false, params: [Reference(Path(Path { type_anchor: None, mod_path: ModPath { kind: Plain, segments: [Name(Text("Self"))] }, generic_args: [None] }), Mut)], is_varargs: false, ret_type: Tuple([]), ast_id: FileAstId::<ra_syntax::ast::generated::nodes::Fn>(11) }
|
||||
> Function { name: Name(Text("dfl_method")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(4294967295), has_self_param: true, is_unsafe: false, params: [Reference(Path(Path { type_anchor: None, mod_path: ModPath { kind: Plain, segments: [Name(Text("Self"))] }, generic_args: [None] }), Mut)], is_varargs: false, ret_type: Tuple([]), ast_id: FileAstId::<syntax::ast::generated::nodes::Fn>(11) }
|
||||
#[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("struct0"))] }, input: None }]) }]
|
||||
Struct { name: Name(Text("Struct0")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(1), fields: Unit, ast_id: FileAstId::<ra_syntax::ast::generated::nodes::Struct>(3), kind: Unit }
|
||||
Struct { name: Name(Text("Struct0")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(1), fields: Unit, ast_id: FileAstId::<syntax::ast::generated::nodes::Struct>(3), kind: Unit }
|
||||
#[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("struct1"))] }, input: None }]) }]
|
||||
Struct { name: Name(Text("Struct1")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(2), fields: Tuple(IdRange::<ra_hir_def::item_tree::Field>(0..1)), ast_id: FileAstId::<ra_syntax::ast::generated::nodes::Struct>(4), kind: Tuple }
|
||||
Struct { name: Name(Text("Struct1")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(2), fields: Tuple(IdRange::<ra_hir_def::item_tree::Field>(0..1)), ast_id: FileAstId::<syntax::ast::generated::nodes::Struct>(4), kind: Tuple }
|
||||
#[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("struct2"))] }, input: None }]) }]
|
||||
Struct { name: Name(Text("Struct2")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(3), fields: Record(IdRange::<ra_hir_def::item_tree::Field>(1..2)), ast_id: FileAstId::<ra_syntax::ast::generated::nodes::Struct>(5), kind: Record }
|
||||
Struct { name: Name(Text("Struct2")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(3), fields: Record(IdRange::<ra_hir_def::item_tree::Field>(1..2)), ast_id: FileAstId::<syntax::ast::generated::nodes::Struct>(5), kind: Record }
|
||||
#[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("en"))] }, input: None }]) }]
|
||||
Enum { name: Name(Text("En")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(4294967295), variants: IdRange::<ra_hir_def::item_tree::Variant>(0..1), ast_id: FileAstId::<ra_syntax::ast::generated::nodes::Enum>(6) }
|
||||
Enum { name: Name(Text("En")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(4294967295), variants: IdRange::<ra_hir_def::item_tree::Variant>(0..1), ast_id: FileAstId::<syntax::ast::generated::nodes::Enum>(6) }
|
||||
#[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("un"))] }, input: None }]) }]
|
||||
Union { name: Name(Text("Un")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(4294967295), fields: Record(IdRange::<ra_hir_def::item_tree::Field>(3..4)), ast_id: FileAstId::<ra_syntax::ast::generated::nodes::Union>(7) }
|
||||
Union { name: Name(Text("Un")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(4294967295), fields: Record(IdRange::<ra_hir_def::item_tree::Field>(3..4)), ast_id: FileAstId::<syntax::ast::generated::nodes::Union>(7) }
|
||||
"##]],
|
||||
);
|
||||
}
|
||||
|
@ -274,13 +274,13 @@ fn simple_inner_items() {
|
|||
inner attrs: Attrs { entries: None }
|
||||
|
||||
top-level items:
|
||||
Impl { generic_params: GenericParamsId(0), target_trait: Some(Path(Path { type_anchor: None, mod_path: ModPath { kind: Plain, segments: [Name(Text("D"))] }, generic_args: [None] })), target_type: Path(Path { type_anchor: None, mod_path: ModPath { kind: Plain, segments: [Name(Text("Response"))] }, generic_args: [Some(GenericArgs { args: [Type(Path(Path { type_anchor: None, mod_path: ModPath { kind: Plain, segments: [Name(Text("T"))] }, generic_args: [None] }))], has_self_type: false, bindings: [] })] }), is_negative: false, items: [Function(Idx::<Function>(1))], ast_id: FileAstId::<ra_syntax::ast::generated::nodes::Impl>(0) }
|
||||
> Function { name: Name(Text("foo")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(4294967295), has_self_param: false, is_unsafe: false, params: [], is_varargs: false, ret_type: Tuple([]), ast_id: FileAstId::<ra_syntax::ast::generated::nodes::Fn>(1) }
|
||||
Impl { generic_params: GenericParamsId(0), target_trait: Some(Path(Path { type_anchor: None, mod_path: ModPath { kind: Plain, segments: [Name(Text("D"))] }, generic_args: [None] })), target_type: Path(Path { type_anchor: None, mod_path: ModPath { kind: Plain, segments: [Name(Text("Response"))] }, generic_args: [Some(GenericArgs { args: [Type(Path(Path { type_anchor: None, mod_path: ModPath { kind: Plain, segments: [Name(Text("T"))] }, generic_args: [None] }))], has_self_type: false, bindings: [] })] }), is_negative: false, items: [Function(Idx::<Function>(1))], ast_id: FileAstId::<syntax::ast::generated::nodes::Impl>(0) }
|
||||
> Function { name: Name(Text("foo")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(4294967295), has_self_param: false, is_unsafe: false, params: [], is_varargs: false, ret_type: Tuple([]), ast_id: FileAstId::<syntax::ast::generated::nodes::Fn>(1) }
|
||||
|
||||
inner items:
|
||||
|
||||
for AST FileAstId::<ra_syntax::ast::generated::nodes::Item>(2):
|
||||
Function { name: Name(Text("end")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(1), has_self_param: false, is_unsafe: false, params: [], is_varargs: false, ret_type: Tuple([]), ast_id: FileAstId::<ra_syntax::ast::generated::nodes::Fn>(2) }
|
||||
for AST FileAstId::<syntax::ast::generated::nodes::Item>(2):
|
||||
Function { name: Name(Text("end")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(1), has_self_param: false, is_unsafe: false, params: [], is_varargs: false, ret_type: Tuple([]), ast_id: FileAstId::<syntax::ast::generated::nodes::Fn>(2) }
|
||||
|
||||
"#]],
|
||||
);
|
||||
|
@ -303,9 +303,9 @@ fn extern_attrs() {
|
|||
|
||||
top-level items:
|
||||
#[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("attr_a"))] }, input: None }, Attr { path: ModPath { kind: Plain, segments: [Name(Text("block_attr"))] }, input: None }]) }]
|
||||
Function { name: Name(Text("a")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(4294967295), has_self_param: false, is_unsafe: true, params: [], is_varargs: false, ret_type: Tuple([]), ast_id: FileAstId::<ra_syntax::ast::generated::nodes::Fn>(1) }
|
||||
Function { name: Name(Text("a")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(4294967295), has_self_param: false, is_unsafe: true, params: [], is_varargs: false, ret_type: Tuple([]), ast_id: FileAstId::<syntax::ast::generated::nodes::Fn>(1) }
|
||||
#[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("attr_b"))] }, input: None }, Attr { path: ModPath { kind: Plain, segments: [Name(Text("block_attr"))] }, input: None }]) }]
|
||||
Function { name: Name(Text("b")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(4294967295), has_self_param: false, is_unsafe: true, params: [], is_varargs: false, ret_type: Tuple([]), ast_id: FileAstId::<ra_syntax::ast::generated::nodes::Fn>(2) }
|
||||
Function { name: Name(Text("b")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(4294967295), has_self_param: false, is_unsafe: true, params: [], is_varargs: false, ret_type: Tuple([]), ast_id: FileAstId::<syntax::ast::generated::nodes::Fn>(2) }
|
||||
"##]],
|
||||
);
|
||||
}
|
||||
|
@ -327,11 +327,11 @@ fn trait_attrs() {
|
|||
|
||||
top-level items:
|
||||
#[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("trait_attr"))] }, input: None }]) }]
|
||||
Trait { name: Name(Text("Tr")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(0), auto: false, items: [Function(Idx::<Function>(0)), Function(Idx::<Function>(1))], ast_id: FileAstId::<ra_syntax::ast::generated::nodes::Trait>(0) }
|
||||
Trait { name: Name(Text("Tr")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(0), auto: false, items: [Function(Idx::<Function>(0)), Function(Idx::<Function>(1))], ast_id: FileAstId::<syntax::ast::generated::nodes::Trait>(0) }
|
||||
> #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("attr_a"))] }, input: None }]) }]
|
||||
> Function { name: Name(Text("a")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(4294967295), has_self_param: false, is_unsafe: false, params: [], is_varargs: false, ret_type: Tuple([]), ast_id: FileAstId::<ra_syntax::ast::generated::nodes::Fn>(1) }
|
||||
> Function { name: Name(Text("a")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(4294967295), has_self_param: false, is_unsafe: false, params: [], is_varargs: false, ret_type: Tuple([]), ast_id: FileAstId::<syntax::ast::generated::nodes::Fn>(1) }
|
||||
> #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("attr_b"))] }, input: None }]) }]
|
||||
> Function { name: Name(Text("b")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(4294967295), has_self_param: false, is_unsafe: false, params: [], is_varargs: false, ret_type: Tuple([]), ast_id: FileAstId::<ra_syntax::ast::generated::nodes::Fn>(2) }
|
||||
> Function { name: Name(Text("b")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(4294967295), has_self_param: false, is_unsafe: false, params: [], is_varargs: false, ret_type: Tuple([]), ast_id: FileAstId::<syntax::ast::generated::nodes::Fn>(2) }
|
||||
"##]],
|
||||
);
|
||||
}
|
||||
|
@ -353,11 +353,11 @@ fn impl_attrs() {
|
|||
|
||||
top-level items:
|
||||
#[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("impl_attr"))] }, input: None }]) }]
|
||||
Impl { generic_params: GenericParamsId(4294967295), target_trait: None, target_type: Path(Path { type_anchor: None, mod_path: ModPath { kind: Plain, segments: [Name(Text("Ty"))] }, generic_args: [None] }), is_negative: false, items: [Function(Idx::<Function>(0)), Function(Idx::<Function>(1))], ast_id: FileAstId::<ra_syntax::ast::generated::nodes::Impl>(0) }
|
||||
Impl { generic_params: GenericParamsId(4294967295), target_trait: None, target_type: Path(Path { type_anchor: None, mod_path: ModPath { kind: Plain, segments: [Name(Text("Ty"))] }, generic_args: [None] }), is_negative: false, items: [Function(Idx::<Function>(0)), Function(Idx::<Function>(1))], ast_id: FileAstId::<syntax::ast::generated::nodes::Impl>(0) }
|
||||
> #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("attr_a"))] }, input: None }]) }]
|
||||
> Function { name: Name(Text("a")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(4294967295), has_self_param: false, is_unsafe: false, params: [], is_varargs: false, ret_type: Tuple([]), ast_id: FileAstId::<ra_syntax::ast::generated::nodes::Fn>(1) }
|
||||
> Function { name: Name(Text("a")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(4294967295), has_self_param: false, is_unsafe: false, params: [], is_varargs: false, ret_type: Tuple([]), ast_id: FileAstId::<syntax::ast::generated::nodes::Fn>(1) }
|
||||
> #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("attr_b"))] }, input: None }]) }]
|
||||
> Function { name: Name(Text("b")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(4294967295), has_self_param: false, is_unsafe: false, params: [], is_varargs: false, ret_type: Tuple([]), ast_id: FileAstId::<ra_syntax::ast::generated::nodes::Fn>(2) }
|
||||
> Function { name: Name(Text("b")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(4294967295), has_self_param: false, is_unsafe: false, params: [], is_varargs: false, ret_type: Tuple([]), ast_id: FileAstId::<syntax::ast::generated::nodes::Fn>(2) }
|
||||
"##]],
|
||||
);
|
||||
}
|
||||
|
@ -408,13 +408,13 @@ fn inner_item_attrs() {
|
|||
inner attrs: Attrs { entries: None }
|
||||
|
||||
top-level items:
|
||||
Function { name: Name(Text("foo")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(4294967295), has_self_param: false, is_unsafe: false, params: [], is_varargs: false, ret_type: Tuple([]), ast_id: FileAstId::<ra_syntax::ast::generated::nodes::Fn>(0) }
|
||||
Function { name: Name(Text("foo")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(4294967295), has_self_param: false, is_unsafe: false, params: [], is_varargs: false, ret_type: Tuple([]), ast_id: FileAstId::<syntax::ast::generated::nodes::Fn>(0) }
|
||||
|
||||
inner items:
|
||||
|
||||
for AST FileAstId::<ra_syntax::ast::generated::nodes::Item>(1):
|
||||
for AST FileAstId::<syntax::ast::generated::nodes::Item>(1):
|
||||
#[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("on_inner"))] }, input: None }]) }]
|
||||
Function { name: Name(Text("inner")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(4294967295), has_self_param: false, is_unsafe: false, params: [], is_varargs: false, ret_type: Tuple([]), ast_id: FileAstId::<ra_syntax::ast::generated::nodes::Fn>(1) }
|
||||
Function { name: Name(Text("inner")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(4294967295), has_self_param: false, is_unsafe: false, params: [], is_varargs: false, ret_type: Tuple([]), ast_id: FileAstId::<syntax::ast::generated::nodes::Fn>(1) }
|
||||
|
||||
"##]],
|
||||
);
|
||||
|
@ -432,8 +432,8 @@ fn assoc_item_macros() {
|
|||
inner attrs: Attrs { entries: None }
|
||||
|
||||
top-level items:
|
||||
Impl { generic_params: GenericParamsId(4294967295), target_trait: None, target_type: Path(Path { type_anchor: None, mod_path: ModPath { kind: Plain, segments: [Name(Text("S"))] }, generic_args: [None] }), is_negative: false, items: [MacroCall(Idx::<MacroCall>(0))], ast_id: FileAstId::<ra_syntax::ast::generated::nodes::Impl>(0) }
|
||||
> MacroCall { name: None, path: ModPath { kind: Plain, segments: [Name(Text("items"))] }, is_export: false, is_local_inner: false, is_builtin: false, ast_id: FileAstId::<ra_syntax::ast::generated::nodes::MacroCall>(1) }
|
||||
Impl { generic_params: GenericParamsId(4294967295), target_trait: None, target_type: Path(Path { type_anchor: None, mod_path: ModPath { kind: Plain, segments: [Name(Text("S"))] }, generic_args: [None] }), is_negative: false, items: [MacroCall(Idx::<MacroCall>(0))], ast_id: FileAstId::<syntax::ast::generated::nodes::Impl>(0) }
|
||||
> MacroCall { name: None, path: ModPath { kind: Plain, segments: [Name(Text("items"))] }, is_export: false, is_local_inner: false, is_builtin: false, ast_id: FileAstId::<syntax::ast::generated::nodes::MacroCall>(1) }
|
||||
"#]],
|
||||
);
|
||||
}
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
use std::marker::PhantomData;
|
||||
|
||||
use hir_expand::{InFile, MacroDefId};
|
||||
use ra_syntax::{ast, AstNode, AstPtr};
|
||||
use rustc_hash::FxHashMap;
|
||||
use syntax::{ast, AstNode, AstPtr};
|
||||
|
||||
use crate::{
|
||||
dyn_map::{DynMap, Policy},
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
//! features, such as Fn family of traits.
|
||||
use std::sync::Arc;
|
||||
|
||||
use ra_syntax::SmolStr;
|
||||
use rustc_hash::FxHashMap;
|
||||
use syntax::SmolStr;
|
||||
|
||||
use crate::{
|
||||
db::DefDatabase, AdtId, AttrDefId, CrateId, EnumId, FunctionId, ImplId, ModuleDefId, ModuleId,
|
||||
|
|
|
@ -58,7 +58,7 @@ use hir_expand::{
|
|||
MacroCallId, MacroCallKind, MacroDefId, MacroDefKind,
|
||||
};
|
||||
use ra_db::{impl_intern_key, salsa, CrateId};
|
||||
use ra_syntax::ast;
|
||||
use syntax::ast;
|
||||
|
||||
use crate::builtin_type::BuiltinType;
|
||||
use item_tree::{
|
||||
|
|
|
@ -59,9 +59,9 @@ use std::sync::Arc;
|
|||
use arena::Arena;
|
||||
use hir_expand::{diagnostics::DiagnosticSink, name::Name, InFile};
|
||||
use ra_db::{CrateId, Edition, FileId};
|
||||
use ra_syntax::ast;
|
||||
use rustc_hash::FxHashMap;
|
||||
use stdx::format_to;
|
||||
use syntax::ast;
|
||||
|
||||
use crate::{
|
||||
db::DefDatabase,
|
||||
|
@ -288,7 +288,7 @@ pub enum ModuleSource {
|
|||
|
||||
mod diagnostics {
|
||||
use hir_expand::diagnostics::DiagnosticSink;
|
||||
use ra_syntax::{ast, AstPtr};
|
||||
use syntax::{ast, AstPtr};
|
||||
|
||||
use crate::{db::DefDatabase, diagnostics::UnresolvedModule, nameres::LocalModuleId, AstId};
|
||||
|
||||
|
|
|
@ -13,8 +13,8 @@ use hir_expand::{
|
|||
};
|
||||
use ra_cfg::CfgOptions;
|
||||
use ra_db::{CrateId, FileId, ProcMacroId};
|
||||
use ra_syntax::ast;
|
||||
use rustc_hash::FxHashMap;
|
||||
use syntax::ast;
|
||||
use test_utils::mark;
|
||||
|
||||
use crate::{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//! This module resolves `mod foo;` declaration to file.
|
||||
use hir_expand::name::Name;
|
||||
use ra_db::FileId;
|
||||
use ra_syntax::SmolStr;
|
||||
use syntax::SmolStr;
|
||||
|
||||
use crate::{db::DefDatabase, HirFileId};
|
||||
|
||||
|
|
|
@ -698,7 +698,7 @@ fn unresolved_module_diagnostics() {
|
|||
),
|
||||
),
|
||||
),
|
||||
value: FileAstId::<ra_syntax::ast::generated::nodes::Module>(1),
|
||||
value: FileAstId::<syntax::ast::generated::nodes::Module>(1),
|
||||
},
|
||||
candidate: "bar.rs",
|
||||
},
|
||||
|
|
|
@ -13,7 +13,7 @@ use hir_expand::{
|
|||
name::{AsName, Name},
|
||||
};
|
||||
use ra_db::CrateId;
|
||||
use ra_syntax::ast;
|
||||
use syntax::ast;
|
||||
|
||||
use crate::{
|
||||
type_ref::{TypeBound, TypeRef},
|
||||
|
|
|
@ -9,7 +9,7 @@ use hir_expand::{
|
|||
hygiene::Hygiene,
|
||||
name::{name, AsName},
|
||||
};
|
||||
use ra_syntax::ast::{self, AstNode, TypeBoundsOwner};
|
||||
use syntax::ast::{self, AstNode, TypeBoundsOwner};
|
||||
|
||||
use super::AssociatedTypeBinding;
|
||||
use crate::{
|
||||
|
|
|
@ -5,7 +5,7 @@ use std::iter;
|
|||
|
||||
use either::Either;
|
||||
use hir_expand::{hygiene::Hygiene, name::AsName};
|
||||
use ra_syntax::ast::{self, NameOwner};
|
||||
use syntax::ast::{self, NameOwner};
|
||||
use test_utils::mark;
|
||||
|
||||
use crate::path::{ImportAlias, ModPath, PathKind};
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
//! HIR for references to types. Paths in these are not yet resolved. They can
|
||||
//! be directly created from an ast::TypeRef, without further queries.
|
||||
use ra_syntax::ast::{self};
|
||||
use syntax::ast::{self};
|
||||
|
||||
use crate::{body::LowerCtx, path::Path};
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//! Defines hir-level representation of visibility (e.g. `pub` and `pub(crate)`).
|
||||
|
||||
use hir_expand::{hygiene::Hygiene, InFile};
|
||||
use ra_syntax::ast;
|
||||
use syntax::ast;
|
||||
|
||||
use crate::{
|
||||
db::DefDatabase,
|
||||
|
|
|
@ -15,7 +15,7 @@ rustc-hash = "1.0.0"
|
|||
|
||||
arena = { path = "../arena" }
|
||||
ra_db = { path = "../ra_db" }
|
||||
ra_syntax = { path = "../ra_syntax" }
|
||||
syntax = { path = "../syntax" }
|
||||
parser = { path = "../parser" }
|
||||
profile = { path = "../profile" }
|
||||
tt = { path = "../tt" }
|
||||
|
|
|
@ -13,7 +13,7 @@ use std::{
|
|||
};
|
||||
|
||||
use arena::{Arena, Idx};
|
||||
use ra_syntax::{ast, AstNode, AstPtr, SyntaxNode, SyntaxNodePtr};
|
||||
use syntax::{ast, AstNode, AstPtr, SyntaxNode, SyntaxNodePtr};
|
||||
|
||||
/// `AstId` points to an AST node in a specific file.
|
||||
pub struct FileAstId<N: AstNode> {
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
use log::debug;
|
||||
|
||||
use parser::FragmentKind;
|
||||
use ra_syntax::{
|
||||
use syntax::{
|
||||
ast::{self, AstNode, GenericParamsOwner, ModuleItemOwner, NameOwner},
|
||||
match_ast,
|
||||
};
|
||||
|
|
|
@ -8,7 +8,7 @@ use either::Either;
|
|||
use mbe::parse_to_token_tree;
|
||||
use parser::FragmentKind;
|
||||
use ra_db::FileId;
|
||||
use ra_syntax::ast::{self, AstToken, HasStringValue};
|
||||
use syntax::ast::{self, AstToken, HasStringValue};
|
||||
|
||||
macro_rules! register_builtin {
|
||||
( LAZY: $(($name:ident, $kind: ident) => $expand:ident),* , EAGER: $(($e_name:ident, $e_kind: ident) => $e_expand:ident),* ) => {
|
||||
|
@ -427,8 +427,8 @@ mod tests {
|
|||
MacroCallLoc,
|
||||
};
|
||||
use ra_db::{fixture::WithFixture, SourceDatabase};
|
||||
use ra_syntax::ast::NameOwner;
|
||||
use std::sync::Arc;
|
||||
use syntax::ast::NameOwner;
|
||||
|
||||
fn expand_builtin_macro(ra_fixture: &str) -> String {
|
||||
let (db, file_id) = TestDB::with_single_file(&ra_fixture);
|
||||
|
|
|
@ -5,7 +5,7 @@ use std::sync::Arc;
|
|||
use mbe::{ExpandResult, MacroRules};
|
||||
use parser::FragmentKind;
|
||||
use ra_db::{salsa, SourceDatabase};
|
||||
use ra_syntax::{algo::diff, AstNode, GreenNode, Parse, SyntaxKind::*, SyntaxNode};
|
||||
use syntax::{algo::diff, AstNode, GreenNode, Parse, SyntaxKind::*, SyntaxNode};
|
||||
|
||||
use crate::{
|
||||
ast_id_map::AstIdMap, BuiltinDeriveExpander, BuiltinFnLikeExpander, EagerCallLoc, EagerMacroId,
|
||||
|
@ -92,9 +92,9 @@ pub trait AstDatabase: SourceDatabase {
|
|||
pub fn expand_hypothetical(
|
||||
db: &dyn AstDatabase,
|
||||
actual_macro_call: MacroCallId,
|
||||
hypothetical_args: &ra_syntax::ast::TokenTree,
|
||||
token_to_map: ra_syntax::SyntaxToken,
|
||||
) -> Option<(SyntaxNode, ra_syntax::SyntaxToken)> {
|
||||
hypothetical_args: &syntax::ast::TokenTree,
|
||||
token_to_map: syntax::SyntaxToken,
|
||||
) -> Option<(SyntaxNode, syntax::SyntaxToken)> {
|
||||
let macro_file = MacroFile { macro_call_id: actual_macro_call };
|
||||
let (tt, tmap_1) = mbe::syntax_node_to_token_tree(hypothetical_args.syntax()).unwrap();
|
||||
let range =
|
||||
|
@ -105,7 +105,7 @@ pub fn expand_hypothetical(
|
|||
parse_macro_with_arg(db, macro_file, Some(std::sync::Arc::new((tt, tmap_1))))?;
|
||||
let token_id = macro_def.0.map_id_down(token_id);
|
||||
let range = tmap_2.range_by_token(token_id)?.by_kind(token_to_map.kind())?;
|
||||
let token = ra_syntax::algo::find_covering_element(&node.syntax_node(), range).into_token()?;
|
||||
let token = syntax::algo::find_covering_element(&node.syntax_node(), range).into_token()?;
|
||||
Some((node.syntax_node(), token))
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
use std::{any::Any, fmt};
|
||||
|
||||
use ra_syntax::SyntaxNodePtr;
|
||||
use syntax::SyntaxNodePtr;
|
||||
|
||||
use crate::InFile;
|
||||
|
||||
|
|
|
@ -27,8 +27,8 @@ use crate::{
|
|||
|
||||
use parser::FragmentKind;
|
||||
use ra_db::CrateId;
|
||||
use ra_syntax::{algo::SyntaxRewriter, SyntaxNode};
|
||||
use std::sync::Arc;
|
||||
use syntax::{algo::SyntaxRewriter, SyntaxNode};
|
||||
|
||||
pub fn expand_eager_macro(
|
||||
db: &dyn AstDatabase,
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue