Rename ra_syntax -> syntax

This commit is contained in:
Aleksey Kladov 2020-08-12 18:26:51 +02:00
parent 3d6889cba7
commit a1c187eef3
958 changed files with 353 additions and 363 deletions

2
.gitattributes vendored
View file

@ -1,5 +1,5 @@
* text=auto eol=lf * 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. # Older git versions try to fix line endings on images, this prevents it.
*.png binary *.png binary
*.jpg binary *.jpg binary

68
Cargo.lock generated
View file

@ -933,9 +933,9 @@ dependencies = [
"ra_fmt", "ra_fmt",
"ra_hir", "ra_hir",
"ra_ide_db", "ra_ide_db",
"ra_syntax",
"rustc-hash", "rustc-hash",
"stdx", "stdx",
"syntax",
"test_utils", "test_utils",
"text_edit", "text_edit",
] ]
@ -945,8 +945,8 @@ name = "ra_cfg"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"ra_mbe", "ra_mbe",
"ra_syntax",
"rustc-hash", "rustc-hash",
"syntax",
"tt", "tt",
] ]
@ -956,10 +956,10 @@ version = "0.1.0"
dependencies = [ dependencies = [
"profile", "profile",
"ra_cfg", "ra_cfg",
"ra_syntax",
"rustc-hash", "rustc-hash",
"salsa", "salsa",
"stdx", "stdx",
"syntax",
"test_utils", "test_utils",
"tt", "tt",
"vfs", "vfs",
@ -970,7 +970,7 @@ name = "ra_fmt"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"itertools", "itertools",
"ra_syntax", "syntax",
] ]
[[package]] [[package]]
@ -986,9 +986,9 @@ dependencies = [
"ra_hir_def", "ra_hir_def",
"ra_hir_expand", "ra_hir_expand",
"ra_hir_ty", "ra_hir_ty",
"ra_syntax",
"rustc-hash", "rustc-hash",
"stdx", "stdx",
"syntax",
] ]
[[package]] [[package]]
@ -1010,10 +1010,10 @@ dependencies = [
"ra_db", "ra_db",
"ra_hir_expand", "ra_hir_expand",
"ra_mbe", "ra_mbe",
"ra_syntax",
"rustc-hash", "rustc-hash",
"smallvec", "smallvec",
"stdx", "stdx",
"syntax",
"test_utils", "test_utils",
"tt", "tt",
] ]
@ -1029,8 +1029,8 @@ dependencies = [
"profile", "profile",
"ra_db", "ra_db",
"ra_mbe", "ra_mbe",
"ra_syntax",
"rustc-hash", "rustc-hash",
"syntax",
"test_utils", "test_utils",
"tt", "tt",
] ]
@ -1052,11 +1052,11 @@ dependencies = [
"ra_db", "ra_db",
"ra_hir_def", "ra_hir_def",
"ra_hir_expand", "ra_hir_expand",
"ra_syntax",
"rustc-hash", "rustc-hash",
"scoped-tls", "scoped-tls",
"smallvec", "smallvec",
"stdx", "stdx",
"syntax",
"test_utils", "test_utils",
"tracing", "tracing",
"tracing-subscriber", "tracing-subscriber",
@ -1081,9 +1081,9 @@ dependencies = [
"ra_hir", "ra_hir",
"ra_ide_db", "ra_ide_db",
"ra_ssr", "ra_ssr",
"ra_syntax",
"rustc-hash", "rustc-hash",
"stdx", "stdx",
"syntax",
"test_utils", "test_utils",
"text_edit", "text_edit",
] ]
@ -1099,10 +1099,10 @@ dependencies = [
"profile", "profile",
"ra_db", "ra_db",
"ra_hir", "ra_hir",
"ra_syntax",
"rayon", "rayon",
"rustc-hash", "rustc-hash",
"stdx", "stdx",
"syntax",
"test_utils", "test_utils",
"text_edit", "text_edit",
] ]
@ -1113,9 +1113,9 @@ version = "0.1.0"
dependencies = [ dependencies = [
"log", "log",
"parser", "parser",
"ra_syntax",
"rustc-hash", "rustc-hash",
"smallvec", "smallvec",
"syntax",
"test_utils", "test_utils",
"tt", "tt",
] ]
@ -1176,33 +1176,12 @@ dependencies = [
"ra_db", "ra_db",
"ra_hir", "ra_hir",
"ra_ide_db", "ra_ide_db",
"ra_syntax",
"rustc-hash", "rustc-hash",
"syntax",
"test_utils", "test_utils",
"text_edit", "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]] [[package]]
name = "rayon" name = "rayon"
version = "1.3.1" version = "1.3.1"
@ -1304,12 +1283,12 @@ dependencies = [
"ra_proc_macro_srv", "ra_proc_macro_srv",
"ra_project_model", "ra_project_model",
"ra_ssr", "ra_ssr",
"ra_syntax",
"rayon", "rayon",
"rustc-hash", "rustc-hash",
"serde", "serde",
"serde_json", "serde_json",
"stdx", "stdx",
"syntax",
"test_utils", "test_utils",
"text_edit", "text_edit",
"threadpool", "threadpool",
@ -1532,6 +1511,27 @@ dependencies = [
"unicode-xid", "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]] [[package]]
name = "termcolor" name = "termcolor"
version = "1.1.0" version = "1.1.0"

View file

@ -20,7 +20,7 @@
//! //!
//! After adding a new inline-test, run `cargo xtask codegen` to //! After adding a new inline-test, run `cargo xtask codegen` to
//! extract it as a standalone text-fixture into //! 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. //! create the "gold" value.
//! //!
//! Coding convention: rules like `where_clause` always produce either a //! Coding convention: rules like `where_clause` always produce either a

View file

@ -10,7 +10,7 @@
//! //!
//! The actual parsing happens in the `grammar` module. //! 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] #[macro_use]
mod token_set; mod token_set;

View file

@ -15,7 +15,7 @@ either = "1.5.3"
stdx = { path = "../stdx" } stdx = { path = "../stdx" }
ra_syntax = { path = "../ra_syntax" } syntax = { path = "../syntax" }
text_edit = { path = "../text_edit" } text_edit = { path = "../text_edit" }
ra_fmt = { path = "../ra_fmt" } ra_fmt = { path = "../ra_fmt" }
profile = { path = "../profile" } profile = { path = "../profile" }

View file

@ -10,7 +10,7 @@ use ra_ide_db::{
source_change::{SourceChange, SourceFileEdit}, source_change::{SourceChange, SourceFileEdit},
RootDatabase, RootDatabase,
}; };
use ra_syntax::{ use syntax::{
algo::{self, find_node_at_offset, SyntaxRewriter}, algo::{self, find_node_at_offset, SyntaxRewriter},
AstNode, SourceFile, SyntaxElement, SyntaxKind, SyntaxNode, SyntaxToken, TextRange, TextSize, AstNode, SourceFile, SyntaxElement, SyntaxKind, SyntaxNode, SyntaxToken, TextRange, TextSize,
TokenAtOffset, TokenAtOffset,
@ -271,7 +271,7 @@ impl AssistBuilder {
} }
/// Replaces specified `node` of text with a given string, reindenting the /// Replaces specified `node` of text with a given string, reindenting the
/// string to maintain `node`'s existing indent. /// 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( pub(crate) fn replace_node_and_indent(
&mut self, &mut self,
node: &SyntaxNode, node: &SyntaxNode,

View file

@ -2,13 +2,13 @@
use rustc_hash::FxHashMap; use rustc_hash::FxHashMap;
use hir::{HirDisplay, PathResolution, SemanticsScope}; use hir::{HirDisplay, PathResolution, SemanticsScope};
use ra_syntax::{ use syntax::{
algo::SyntaxRewriter, algo::SyntaxRewriter,
ast::{self, AstNode}, ast::{self, AstNode},
}; };
pub trait AstTransform<'a> { 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 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> fn or<T: AstTransform<'a> + 'a>(self, other: T) -> Box<dyn AstTransform<'a> + 'a>
@ -22,7 +22,7 @@ pub trait AstTransform<'a> {
struct NullTransformer; struct NullTransformer;
impl<'a> AstTransform<'a> for 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 None
} }
fn chain_before(self, other: Box<dyn AstTransform<'a> + 'a>) -> Box<dyn AstTransform<'a> + 'a> { 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) Some(result)
} }
} }
fn get_substitution_inner( fn get_substitution_inner(&self, node: &syntax::SyntaxNode) -> Option<syntax::SyntaxNode> {
&self,
node: &ra_syntax::SyntaxNode,
) -> Option<ra_syntax::SyntaxNode> {
let type_ref = ast::Type::cast(node.clone())?; let type_ref = ast::Type::cast(node.clone())?;
let path = match &type_ref { let path = match &type_ref {
ast::Type::PathType(path_type) => path_type.path()?, ast::Type::PathType(path_type) => path_type.path()?,
@ -122,7 +119,7 @@ impl<'a> SubstituteTypeParams<'a> {
} }
impl<'a> AstTransform<'a> for 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)) 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> { 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) } Self { target_scope, source_scope, previous: Box::new(NullTransformer) }
} }
fn get_substitution_inner( fn get_substitution_inner(&self, node: &syntax::SyntaxNode) -> Option<syntax::SyntaxNode> {
&self,
node: &ra_syntax::SyntaxNode,
) -> Option<ra_syntax::SyntaxNode> {
// FIXME handle value ns? // FIXME handle value ns?
let from = self.target_scope.module()?; let from = self.target_scope.module()?;
let p = ast::Path::cast(node.clone())?; 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 { pub fn apply<'a, N: AstNode>(transformer: &dyn AstTransform<'a>, node: N) -> N {
SyntaxRewriter::from_fn(|element| match element { SyntaxRewriter::from_fn(|element| match element {
ra_syntax::SyntaxElement::Node(n) => { syntax::SyntaxElement::Node(n) => {
let replacement = transformer.get_substitution(&n)?; let replacement = transformer.get_substitution(&n)?;
Some(replacement.into()) 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> { 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)) 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> { fn chain_before(self, other: Box<dyn AstTransform<'a> + 'a>) -> Box<dyn AstTransform<'a> + 'a> {

View file

@ -1,5 +1,5 @@
use itertools::Itertools; use itertools::Itertools;
use ra_syntax::{ use syntax::{
ast::{self, AstNode}, ast::{self, AstNode},
Direction, SmolStr, Direction, SmolStr,
SyntaxKind::{IDENT, WHITESPACE}, SyntaxKind::{IDENT, WHITESPACE},

View file

@ -1,5 +1,5 @@
use hir::HirDisplay; use hir::HirDisplay;
use ra_syntax::{ use syntax::{
ast::{self, AstNode, LetStmt, NameOwner}, ast::{self, AstNode, LetStmt, NameOwner},
TextRange, TextRange,
}; };

View file

@ -1,5 +1,5 @@
use hir::HasSource; use hir::HasSource;
use ra_syntax::{ use syntax::{
ast::{ ast::{
self, self,
edit::{self, AstNodeEdit, IndentLevel}, edit::{self, AstNodeEdit, IndentLevel},

View file

@ -1,5 +1,5 @@
use ra_ide_db::defs::{classify_name_ref, Definition, NameRefClass}; 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 test_utils::mark;
use crate::{ use crate::{

View file

@ -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}; use crate::{utils::invert_boolean_expression, AssistContext, AssistId, AssistKind, Assists};

View file

@ -6,11 +6,11 @@ use hir::{
Type, Type,
}; };
use ra_ide_db::{imports_locator, RootDatabase}; use ra_ide_db::{imports_locator, RootDatabase};
use ra_syntax::{ use rustc_hash::FxHashSet;
use syntax::{
ast::{self, AstNode}, ast::{self, AstNode},
SyntaxNode, SyntaxNode,
}; };
use rustc_hash::FxHashSet;
use crate::{ use crate::{
utils::insert_use_statement, AssistContext, AssistId, AssistKind, Assists, GroupLabel, utils::insert_use_statement, AssistContext, AssistId, AssistKind, Assists, GroupLabel,

View file

@ -1,4 +1,4 @@
use ra_syntax::{ use syntax::{
ast::{self, BlockExpr, Expr, LoopBodyOwner}, ast::{self, BlockExpr, Expr, LoopBodyOwner},
AstNode, SyntaxNode, AstNode, SyntaxNode,
}; };

View file

@ -1,4 +1,4 @@
use ra_syntax::{ use syntax::{
ast::{self, NameOwner, VisibilityOwner}, ast::{self, NameOwner, VisibilityOwner},
AstNode, AstNode,
SyntaxKind::{CONST, ENUM, FN, MODULE, STATIC, STRUCT, TRAIT, VISIBILITY}, SyntaxKind::{CONST, ENUM, FN, MODULE, STATIC, STRUCT, TRAIT, VISIBILITY},

View file

@ -1,6 +1,6 @@
use std::{iter::once, ops::RangeInclusive}; use std::{iter::once, ops::RangeInclusive};
use ra_syntax::{ use syntax::{
algo::replace_children, algo::replace_children,
ast::{ ast::{
self, self,

View file

@ -3,7 +3,7 @@ use ra_ide_db::{
defs::{classify_name_ref, Definition, NameRefClass}, defs::{classify_name_ref, Definition, NameRefClass},
RootDatabase, RootDatabase,
}; };
use ra_syntax::{algo, ast, match_ast, AstNode, SyntaxNode, SyntaxToken, T}; use syntax::{algo, ast, match_ast, AstNode, SyntaxNode, SyntaxToken, T};
use crate::{ use crate::{
assist_context::{AssistBuilder, AssistContext, Assists}, assist_context::{AssistBuilder, AssistContext, Assists},

View file

@ -2,12 +2,12 @@ use hir::{EnumVariant, Module, ModuleDef, Name};
use ra_db::FileId; use ra_db::FileId;
use ra_fmt::leading_indent; use ra_fmt::leading_indent;
use ra_ide_db::{defs::Definition, search::Reference, RootDatabase}; use ra_ide_db::{defs::Definition, search::Reference, RootDatabase};
use ra_syntax::{ use rustc_hash::FxHashSet;
use syntax::{
algo::find_node_at_offset, algo::find_node_at_offset,
ast::{self, ArgListOwner, AstNode, NameOwner, VisibilityOwner}, ast::{self, ArgListOwner, AstNode, NameOwner, VisibilityOwner},
SourceFile, SyntaxNode, TextRange, TextSize, SourceFile, SyntaxNode, TextRange, TextSize,
}; };
use rustc_hash::FxHashSet;
use crate::{ use crate::{
assist_context::AssistBuilder, utils::insert_use_statement, AssistContext, AssistId, assist_context::AssistBuilder, utils::insert_use_statement, AssistContext, AssistId,

View file

@ -1,11 +1,11 @@
use ra_syntax::{ use stdx::format_to;
use syntax::{
ast::{self, AstNode}, ast::{self, AstNode},
SyntaxKind::{ SyntaxKind::{
BLOCK_EXPR, BREAK_EXPR, CLOSURE_EXPR, COMMENT, LOOP_EXPR, MATCH_ARM, PATH_EXPR, RETURN_EXPR, BLOCK_EXPR, BREAK_EXPR, CLOSURE_EXPR, COMMENT, LOOP_EXPR, MATCH_ARM, PATH_EXPR, RETURN_EXPR,
}, },
SyntaxNode, SyntaxNode,
}; };
use stdx::format_to;
use test_utils::mark; use test_utils::mark;
use crate::{AssistContext, AssistId, AssistKind, Assists}; use crate::{AssistContext, AssistId, AssistKind, Assists};

View file

@ -3,7 +3,7 @@ use std::iter;
use hir::{Adt, HasSource, ModuleDef, Semantics}; use hir::{Adt, HasSource, ModuleDef, Semantics};
use itertools::Itertools; use itertools::Itertools;
use ra_ide_db::RootDatabase; 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 test_utils::mark;
use crate::{ use crate::{

View file

@ -1,6 +1,6 @@
use hir::{db::HirDatabase, HasSource, HasVisibility, PathResolution}; use hir::{db::HirDatabase, HasSource, HasVisibility, PathResolution};
use ra_db::FileId; 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 crate::{utils::vis_offset, AssistContext, AssistId, AssistKind, Assists};
use ast::VisibilityOwner; use ast::VisibilityOwner;

View file

@ -1,4 +1,4 @@
use ra_syntax::ast::{AstNode, BinExpr, BinOp}; use syntax::ast::{AstNode, BinExpr, BinOp};
use crate::{AssistContext, AssistId, AssistKind, Assists}; use crate::{AssistContext, AssistId, AssistKind, Assists};

View file

@ -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}; use crate::{AssistContext, AssistId, AssistKind, Assists};

View file

@ -1,4 +1,4 @@
use ra_syntax::{ use syntax::{
algo::non_trivia_sibling, algo::non_trivia_sibling,
ast::{self, AstNode}, ast::{self, AstNode},
Direction, T, Direction, T,

View file

@ -1,4 +1,4 @@
use ra_syntax::{ use syntax::{
ast::{self, AstNode, AttrsOwner}, ast::{self, AstNode, AttrsOwner},
SyntaxKind::{COMMENT, WHITESPACE}, SyntaxKind::{COMMENT, WHITESPACE},
TextSize, TextSize,

View file

@ -1,5 +1,5 @@
use ra_ide_db::RootDatabase; use ra_ide_db::RootDatabase;
use ra_syntax::ast::{self, AstNode, NameOwner}; use syntax::ast::{self, AstNode, NameOwner};
use test_utils::mark; use test_utils::mark;
use crate::{utils::FamousDefs, AssistContext, AssistId, AssistKind, Assists}; use crate::{utils::FamousDefs, AssistContext, AssistId, AssistKind, Assists};

View file

@ -1,6 +1,7 @@
use hir::HirDisplay; use hir::HirDisplay;
use ra_db::FileId; use ra_db::FileId;
use ra_syntax::{ use rustc_hash::{FxHashMap, FxHashSet};
use syntax::{
ast::{ ast::{
self, self,
edit::{AstNodeEdit, IndentLevel}, edit::{AstNodeEdit, IndentLevel},
@ -8,7 +9,6 @@ use ra_syntax::{
}, },
SyntaxKind, SyntaxNode, TextSize, SyntaxKind, SyntaxNode, TextSize,
}; };
use rustc_hash::{FxHashMap, FxHashSet};
use crate::{ use crate::{
assist_config::SnippetCap, assist_config::SnippetCap,

View file

@ -1,6 +1,6 @@
use itertools::Itertools; use itertools::Itertools;
use ra_syntax::ast::{self, AstNode, GenericParamsOwner, NameOwner};
use stdx::format_to; use stdx::format_to;
use syntax::ast::{self, AstNode, GenericParamsOwner, NameOwner};
use crate::{AssistContext, AssistId, AssistKind, Assists}; use crate::{AssistContext, AssistId, AssistKind, Assists};

View file

@ -1,10 +1,10 @@
use hir::Adt; use hir::Adt;
use itertools::Itertools; use itertools::Itertools;
use ra_syntax::{ use stdx::format_to;
use syntax::{
ast::{self, AstNode, GenericParamsOwner, NameOwner, StructKind, VisibilityOwner}, ast::{self, AstNode, GenericParamsOwner, NameOwner, StructKind, VisibilityOwner},
T, T,
}; };
use stdx::format_to;
use crate::{AssistContext, AssistId, AssistKind, Assists}; use crate::{AssistContext, AssistId, AssistKind, Assists};

View file

@ -1,5 +1,5 @@
use ra_ide_db::defs::Definition; use ra_ide_db::defs::Definition;
use ra_syntax::{ use syntax::{
ast::{self, AstNode, AstToken}, ast::{self, AstNode, AstToken},
TextRange, TextRange,
}; };

View file

@ -1,8 +1,8 @@
use ra_syntax::{ use rustc_hash::FxHashSet;
use syntax::{
ast::{self, GenericParamsOwner, NameOwner}, ast::{self, GenericParamsOwner, NameOwner},
AstNode, SyntaxKind, TextRange, TextSize, AstNode, SyntaxKind, TextRange, TextSize,
}; };
use rustc_hash::FxHashSet;
use crate::{assist_context::AssistBuilder, AssistContext, AssistId, AssistKind, Assists}; use crate::{assist_context::AssistBuilder, AssistContext, AssistId, AssistKind, Assists};

View file

@ -1,4 +1,4 @@
use ra_syntax::{ use syntax::{
ast::{self, AstNode}, ast::{self, AstNode},
T, T,
}; };

View file

@ -1,6 +1,6 @@
use std::iter::successors; use std::iter::successors;
use ra_syntax::{ use syntax::{
algo::{neighbor, skip_trivia_token, SyntaxRewriter}, algo::{neighbor, skip_trivia_token, SyntaxRewriter},
ast::{self, edit::AstNodeEdit, make}, ast::{self, edit::AstNodeEdit, make},
AstNode, Direction, InsertPosition, SyntaxElement, T, AstNode, Direction, InsertPosition, SyntaxElement, T,

View file

@ -1,6 +1,6 @@
use std::iter::successors; use std::iter::successors;
use ra_syntax::{ use syntax::{
algo::neighbor, algo::neighbor,
ast::{self, AstNode}, ast::{self, AstNode},
Direction, Direction,

View file

@ -1,4 +1,4 @@
use ra_syntax::{ use syntax::{
ast::{self, edit::AstNodeEdit, make, AstNode, NameOwner, TypeBoundsOwner}, ast::{self, edit::AstNodeEdit, make, AstNode, NameOwner, TypeBoundsOwner},
match_ast, match_ast,
SyntaxKind::*, SyntaxKind::*,

View file

@ -1,4 +1,4 @@
use ra_syntax::{ use syntax::{
ast::{AstNode, IfExpr, MatchArm}, ast::{AstNode, IfExpr, MatchArm},
SyntaxKind::WHITESPACE, SyntaxKind::WHITESPACE,
}; };

View file

@ -1,6 +1,6 @@
use std::borrow::Cow; use std::borrow::Cow;
use ra_syntax::{ use syntax::{
ast::{self, HasQuotes, HasStringValue}, ast::{self, HasQuotes, HasStringValue},
AstToken, AstToken,
SyntaxKind::{RAW_STRING, STRING}, SyntaxKind::{RAW_STRING, STRING},

View file

@ -1,4 +1,4 @@
use ra_syntax::{ use syntax::{
ast::{self, AstNode}, ast::{self, AstNode},
TextRange, TextSize, T, TextRange, TextSize, T,
}; };

View file

@ -1,4 +1,4 @@
use ra_syntax::{SyntaxKind, TextRange, T}; use syntax::{SyntaxKind, TextRange, T};
use crate::{AssistContext, AssistId, AssistKind, Assists}; use crate::{AssistContext, AssistId, AssistKind, Assists};

View file

@ -3,7 +3,7 @@ use rustc_hash::FxHashMap;
use hir::{Adt, ModuleDef, PathResolution, Semantics, Struct}; use hir::{Adt, ModuleDef, PathResolution, Semantics, Struct};
use ra_ide_db::RootDatabase; 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}; use crate::{AssistContext, AssistId, AssistKind, Assists};

View file

@ -1,5 +1,5 @@
use ra_fmt::unwrap_trivial_block; use ra_fmt::unwrap_trivial_block;
use ra_syntax::{ use syntax::{
ast::{ ast::{
self, self,
edit::{AstNodeEdit, IndentLevel}, edit::{AstNodeEdit, IndentLevel},

View file

@ -1,6 +1,6 @@
use std::iter::once; use std::iter::once;
use ra_syntax::{ use syntax::{
ast::{ ast::{
self, self,
edit::{AstNodeEdit, IndentLevel}, edit::{AstNodeEdit, IndentLevel},

View file

@ -1,5 +1,5 @@
use hir; 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::{ use crate::{
utils::{find_insert_use_container, insert_use_statement}, utils::{find_insert_use_container, insert_use_statement},

View file

@ -1,6 +1,6 @@
use std::iter; use std::iter;
use ra_syntax::{ use syntax::{
ast::{ ast::{
self, self,
edit::{AstNodeEdit, IndentLevel}, edit::{AstNodeEdit, IndentLevel},

View file

@ -1,6 +1,6 @@
use std::iter::successors; use std::iter::successors;
use ra_syntax::{ast, AstNode, T}; use syntax::{ast, AstNode, T};
use crate::{AssistContext, AssistId, AssistKind, Assists}; use crate::{AssistContext, AssistId, AssistKind, Assists};

View file

@ -1,5 +1,5 @@
use ra_fmt::unwrap_trivial_block; use ra_fmt::unwrap_trivial_block;
use ra_syntax::{ use syntax::{
ast::{ ast::{
self, self,
edit::{AstNodeEdit, IndentLevel}, edit::{AstNodeEdit, IndentLevel},

View file

@ -20,7 +20,7 @@ pub mod ast_transform;
use hir::Semantics; use hir::Semantics;
use ra_db::FileRange; use ra_db::FileRange;
use ra_ide_db::{source_change::SourceChange, RootDatabase}; use ra_ide_db::{source_change::SourceChange, RootDatabase};
use ra_syntax::TextRange; use syntax::TextRange;
pub(crate) use crate::assist_context::{AssistContext, Assists}; pub(crate) use crate::assist_context::{AssistContext, Assists};

View file

@ -3,7 +3,7 @@ mod generated;
use hir::Semantics; use hir::Semantics;
use ra_db::{fixture::WithFixture, FileId, FileRange, SourceDatabaseExt}; use ra_db::{fixture::WithFixture, FileId, FileRange, SourceDatabaseExt};
use ra_ide_db::RootDatabase; use ra_ide_db::RootDatabase;
use ra_syntax::TextRange; use syntax::TextRange;
use test_utils::{assert_eq_text, extract_offset, extract_range}; use test_utils::{assert_eq_text, extract_offset, extract_range};
use crate::{handlers::Handler, Assist, AssistConfig, AssistContext, AssistKind, Assists}; use crate::{handlers::Handler, Assist, AssistConfig, AssistContext, AssistKind, Assists};

View file

@ -5,13 +5,13 @@ use std::{iter, ops};
use hir::{Adt, Crate, Enum, ScopeDef, Semantics, Trait, Type}; use hir::{Adt, Crate, Enum, ScopeDef, Semantics, Trait, Type};
use ra_ide_db::RootDatabase; use ra_ide_db::RootDatabase;
use ra_syntax::{ use rustc_hash::FxHashSet;
use syntax::{
ast::{self, make, NameOwner}, ast::{self, make, NameOwner},
AstNode, AstNode,
SyntaxKind::*, SyntaxKind::*,
SyntaxNode, TextSize, T, SyntaxNode, TextSize, T,
}; };
use rustc_hash::FxHashSet;
use crate::assist_config::SnippetCap; use crate::assist_config::SnippetCap;

View file

@ -4,7 +4,7 @@
use either::Either; use either::Either;
use hir::{self, ModPath}; use hir::{self, ModPath};
use ra_syntax::{ use syntax::{
ast::{self, NameOwner, VisibilityOwner}, ast::{self, NameOwner, VisibilityOwner},
AstNode, Direction, SmolStr, AstNode, Direction, SmolStr,
SyntaxKind::{PATH, PATH_SEGMENT}, SyntaxKind::{PATH, PATH_SEGMENT},

View file

@ -11,7 +11,7 @@ doctest = false
[dependencies] [dependencies]
rustc-hash = "1.1.0" rustc-hash = "1.1.0"
ra_syntax = { path = "../ra_syntax" } syntax = { path = "../syntax" }
tt = { path = "../tt" } tt = { path = "../tt" }
[dev-dependencies] [dev-dependencies]

View file

@ -4,7 +4,7 @@
use std::slice::Iter as SliceIter; use std::slice::Iter as SliceIter;
use ra_syntax::SmolStr; use syntax::SmolStr;
#[derive(Debug, Clone, PartialEq, Eq)] #[derive(Debug, Clone, PartialEq, Eq)]
pub enum CfgExpr { pub enum CfgExpr {
@ -87,7 +87,7 @@ mod tests {
use super::*; use super::*;
use mbe::{ast_to_token_tree, TokenMap}; 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) { fn get_token_tree_generated(input: &str) -> (tt::Subtree, TokenMap) {
let source_file = ast::SourceFile::parse(input).ok().unwrap(); let source_file = ast::SourceFile::parse(input).ok().unwrap();

View file

@ -2,8 +2,8 @@
mod cfg_expr; mod cfg_expr;
use ra_syntax::SmolStr;
use rustc_hash::FxHashSet; use rustc_hash::FxHashSet;
use syntax::SmolStr;
pub use cfg_expr::CfgExpr; pub use cfg_expr::CfgExpr;

View file

@ -12,7 +12,7 @@ doctest = false
salsa = "0.15.2" salsa = "0.15.2"
rustc-hash = "1.1.0" rustc-hash = "1.1.0"
ra_syntax = { path = "../ra_syntax" } syntax = { path = "../syntax" }
ra_cfg = { path = "../ra_cfg" } ra_cfg = { path = "../ra_cfg" }
profile = { path = "../profile" } profile = { path = "../profile" }
tt = { path = "../tt" } tt = { path = "../tt" }

View file

@ -9,8 +9,8 @@
use std::{fmt, iter::FromIterator, ops, str::FromStr, sync::Arc}; use std::{fmt, iter::FromIterator, ops, str::FromStr, sync::Arc};
use ra_cfg::CfgOptions; use ra_cfg::CfgOptions;
use ra_syntax::SmolStr;
use rustc_hash::{FxHashMap, FxHashSet}; use rustc_hash::{FxHashMap, FxHashSet};
use syntax::SmolStr;
use tt::TokenExpander; use tt::TokenExpander;
use vfs::file_set::FileSet; use vfs::file_set::FileSet;

View file

@ -5,8 +5,8 @@ pub mod fixture;
use std::{panic, sync::Arc}; use std::{panic, sync::Arc};
use ra_syntax::{ast, Parse, SourceFile, TextRange, TextSize};
use rustc_hash::FxHashSet; use rustc_hash::FxHashSet;
use syntax::{ast, Parse, SourceFile, TextRange, TextSize};
pub use crate::{ pub use crate::{
cancellation::Canceled, cancellation::Canceled,

View file

@ -12,4 +12,4 @@ doctest = false
[dependencies] [dependencies]
itertools = "0.9.0" itertools = "0.9.0"
ra_syntax = { path = "../ra_syntax" } syntax = { path = "../syntax" }

View file

@ -3,7 +3,7 @@
use std::iter::successors; use std::iter::successors;
use itertools::Itertools; use itertools::Itertools;
use ra_syntax::{ use syntax::{
ast::{self, AstNode, AstToken}, ast::{self, AstNode, AstToken},
SmolStr, SyntaxKind, SmolStr, SyntaxKind,
SyntaxKind::*, SyntaxKind::*,

View file

@ -17,7 +17,7 @@ arrayvec = "0.5.1"
itertools = "0.9.0" itertools = "0.9.0"
stdx = { path = "../stdx" } stdx = { path = "../stdx" }
ra_syntax = { path = "../ra_syntax" } syntax = { path = "../syntax" }
ra_db = { path = "../ra_db" } ra_db = { path = "../ra_db" }
profile = { path = "../profile" } profile = { path = "../profile" }
hir_expand = { path = "../ra_hir_expand", package = "ra_hir_expand" } hir_expand = { path = "../ra_hir_expand", package = "ra_hir_expand" }

View file

@ -31,12 +31,12 @@ use hir_ty::{
InEnvironment, Substs, TraitEnvironment, Ty, TyDefId, TypeCtor, InEnvironment, Substs, TraitEnvironment, Ty, TyDefId, TypeCtor,
}; };
use ra_db::{CrateId, Edition, FileId}; use ra_db::{CrateId, Edition, FileId};
use ra_syntax::{ use rustc_hash::FxHashSet;
use stdx::impl_from;
use syntax::{
ast::{self, AttrsOwner, NameOwner}, ast::{self, AttrsOwner, NameOwner},
AstNode, AstNode,
}; };
use rustc_hash::FxHashSet;
use stdx::impl_from;
use crate::{ use crate::{
db::{DefDatabase, HirDatabase}, db::{DefDatabase, HirDatabase},

View file

@ -6,7 +6,7 @@ use hir_def::{
src::{HasChildSource, HasSource as _}, src::{HasChildSource, HasSource as _},
Lookup, VariantId, Lookup, VariantId,
}; };
use ra_syntax::ast; use syntax::ast;
use crate::{ use crate::{
db::HirDatabase, Const, Enum, EnumVariant, Field, FieldSource, Function, ImplDef, MacroDef, db::HirDatabase, Const, Enum, EnumVariant, Field, FieldSource, Function, ImplDef, MacroDef,

View file

@ -12,11 +12,11 @@ use hir_expand::{hygiene::Hygiene, name::AsName, ExpansionInfo};
use hir_ty::associated_type_shorthand_candidates; use hir_ty::associated_type_shorthand_candidates;
use itertools::Itertools; use itertools::Itertools;
use ra_db::{FileId, FileRange}; use ra_db::{FileId, FileRange};
use ra_syntax::{ use rustc_hash::{FxHashMap, FxHashSet};
use syntax::{
algo::{find_node_at_offset, skip_trivia_token}, algo::{find_node_at_offset, skip_trivia_token},
ast, AstNode, Direction, SyntaxNode, SyntaxToken, TextRange, TextSize, ast, AstNode, Direction, SyntaxNode, SyntaxToken, TextRange, TextSize,
}; };
use rustc_hash::{FxHashMap, FxHashSet};
use crate::{ use crate::{
db::HirDatabase, db::HirDatabase,

View file

@ -10,12 +10,12 @@ use hir_def::{
}; };
use hir_expand::{name::AsName, AstId, MacroDefKind}; use hir_expand::{name::AsName, AstId, MacroDefKind};
use ra_db::FileId; use ra_db::FileId;
use ra_syntax::{ use rustc_hash::FxHashMap;
use stdx::impl_from;
use syntax::{
ast::{self, NameOwner}, ast::{self, NameOwner},
match_ast, AstNode, SyntaxNode, match_ast, AstNode, SyntaxNode,
}; };
use rustc_hash::FxHashMap;
use stdx::impl_from;
use crate::{db::HirDatabase, InFile, MacroDefId}; use crate::{db::HirDatabase, InFile, MacroDefId};

View file

@ -21,7 +21,7 @@ use hir_ty::{
diagnostics::{record_literal_missing_fields, record_pattern_missing_fields}, diagnostics::{record_literal_missing_fields, record_pattern_missing_fields},
InferenceResult, Substs, Ty, InferenceResult, Substs, Ty,
}; };
use ra_syntax::{ use syntax::{
ast::{self, AstNode}, ast::{self, AstNode},
SyntaxNode, TextRange, TextSize, SyntaxNode, TextRange, TextSize,
}; };

View file

@ -24,7 +24,7 @@ stdx = { path = "../stdx" }
arena = { path = "../arena" } arena = { path = "../arena" }
ra_db = { path = "../ra_db" } ra_db = { path = "../ra_db" }
ra_syntax = { path = "../ra_syntax" } syntax = { path = "../syntax" }
profile = { path = "../profile" } profile = { path = "../profile" }
hir_expand = { path = "../ra_hir_expand", package = "ra_hir_expand" } hir_expand = { path = "../ra_hir_expand", package = "ra_hir_expand" }
test_utils = { path = "../test_utils" } test_utils = { path = "../test_utils" }

View file

@ -8,7 +8,7 @@ use hir_expand::{
name::{AsName, Name}, name::{AsName, Name},
InFile, InFile,
}; };
use ra_syntax::ast::{self, NameOwner, VisibilityOwner}; use syntax::ast::{self, NameOwner, VisibilityOwner};
use tt::{Delimiter, DelimiterKind, Leaf, Subtree, TokenTree}; use tt::{Delimiter, DelimiterKind, Leaf, Subtree, TokenTree};
use crate::{ use crate::{

View file

@ -6,7 +6,7 @@ use either::Either;
use hir_expand::{hygiene::Hygiene, AstId, InFile}; use hir_expand::{hygiene::Hygiene, AstId, InFile};
use mbe::ast_to_token_tree; use mbe::ast_to_token_tree;
use ra_cfg::{CfgExpr, CfgOptions}; use ra_cfg::{CfgExpr, CfgOptions};
use ra_syntax::{ use syntax::{
ast::{self, AstNode, AttrsOwner}, ast::{self, AstNode, AttrsOwner},
SmolStr, SmolStr,
}; };

View file

@ -11,8 +11,8 @@ use either::Either;
use hir_expand::{ast_id_map::AstIdMap, hygiene::Hygiene, AstId, HirFileId, InFile, MacroDefId}; use hir_expand::{ast_id_map::AstIdMap, hygiene::Hygiene, AstId, HirFileId, InFile, MacroDefId};
use ra_cfg::CfgOptions; use ra_cfg::CfgOptions;
use ra_db::CrateId; use ra_db::CrateId;
use ra_syntax::{ast, AstNode, AstPtr};
use rustc_hash::FxHashMap; use rustc_hash::FxHashMap;
use syntax::{ast, AstNode, AstPtr};
use test_utils::mark; use test_utils::mark;
pub(crate) use lower::LowerCtx; pub(crate) use lower::LowerCtx;

View file

@ -10,14 +10,14 @@ use hir_expand::{
name::{name, AsName, Name}, name::{name, AsName, Name},
HirFileId, MacroDefId, MacroDefKind, HirFileId, MacroDefId, MacroDefKind,
}; };
use ra_syntax::{ use rustc_hash::FxHashMap;
use syntax::{
ast::{ ast::{
self, ArgListOwner, ArrayExprKind, AstChildren, LiteralKind, LoopBodyOwner, NameOwner, self, ArgListOwner, ArrayExprKind, AstChildren, LiteralKind, LoopBodyOwner, NameOwner,
SlicePatComponents, SlicePatComponents,
}, },
AstNode, AstPtr, AstNode, AstPtr,
}; };
use rustc_hash::FxHashMap;
use test_utils::mark; use test_utils::mark;
use crate::{ use crate::{

View file

@ -171,7 +171,7 @@ fn compute_expr_scopes(expr: ExprId, body: &Body, scopes: &mut ExprScopes, scope
mod tests { mod tests {
use hir_expand::{name::AsName, InFile}; use hir_expand::{name::AsName, InFile};
use ra_db::{fixture::WithFixture, FileId, SourceDatabase}; 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 test_utils::{assert_eq_text, extract_offset, mark};
use crate::{db::DefDatabase, test_db::TestDB, FunctionId, ModuleDefId}; use crate::{db::DefDatabase, test_db::TestDB, FunctionId, ModuleDefId};

View file

@ -3,7 +3,7 @@
use std::sync::Arc; use std::sync::Arc;
use hir_expand::{name::Name, InFile}; use hir_expand::{name::Name, InFile};
use ra_syntax::ast; use syntax::ast;
use crate::{ use crate::{
attr::Attrs, attr::Attrs,

View file

@ -3,7 +3,7 @@ use std::sync::Arc;
use hir_expand::{db::AstDatabase, HirFileId}; use hir_expand::{db::AstDatabase, HirFileId};
use ra_db::{salsa, CrateId, SourceDatabase, Upcast}; use ra_db::{salsa, CrateId, SourceDatabase, Upcast};
use ra_syntax::SmolStr; use syntax::SmolStr;
use crate::{ use crate::{
adt::{EnumData, StructData}, adt::{EnumData, StructData},

View file

@ -3,7 +3,7 @@
use std::any::Any; use std::any::Any;
use hir_expand::diagnostics::Diagnostic; use hir_expand::diagnostics::Diagnostic;
use ra_syntax::{ast, AstPtr, SyntaxNodePtr}; use syntax::{ast, AstPtr, SyntaxNodePtr};
use hir_expand::{HirFileId, InFile}; use hir_expand::{HirFileId, InFile};

View file

@ -6,7 +6,7 @@
use std::sync::Arc; use std::sync::Arc;
use either::Either; use either::Either;
use ra_syntax::ast; use syntax::ast;
use crate::{ use crate::{
db::DefDatabase, db::DefDatabase,

View file

@ -14,7 +14,7 @@
use arena::{Idx, RawId}; use arena::{Idx, RawId};
use hir_expand::name::Name; use hir_expand::name::Name;
use ra_syntax::ast::RangeOp; use syntax::ast::RangeOp;
use crate::{ use crate::{
builtin_type::{BuiltinFloat, BuiltinInt}, builtin_type::{BuiltinFloat, BuiltinInt},
@ -197,7 +197,7 @@ pub enum ArithOp {
BitAnd, BitAnd,
} }
pub use ra_syntax::ast::PrefixOp as UnaryOp; pub use syntax::ast::PrefixOp as UnaryOp;
#[derive(Debug, Clone, Eq, PartialEq)] #[derive(Debug, Clone, Eq, PartialEq)]
pub enum Array { pub enum Array {
ElementList(Vec<ExprId>), ElementList(Vec<ExprId>),

View file

@ -294,7 +294,7 @@ fn find_local_import_locations(
mod tests { mod tests {
use hir_expand::hygiene::Hygiene; use hir_expand::hygiene::Hygiene;
use ra_db::fixture::WithFixture; use ra_db::fixture::WithFixture;
use ra_syntax::ast::AstNode; use syntax::ast::AstNode;
use test_utils::mark; use test_utils::mark;
use crate::test_db::TestDB; use crate::test_db::TestDB;
@ -307,12 +307,9 @@ mod tests {
fn check_found_path(ra_fixture: &str, path: &str) { fn check_found_path(ra_fixture: &str, path: &str) {
let (db, pos) = TestDB::with_position(ra_fixture); let (db, pos) = TestDB::with_position(ra_fixture);
let module = db.module_for_file(pos.file_id); let module = db.module_for_file(pos.file_id);
let parsed_path_file = ra_syntax::SourceFile::parse(&format!("use {};", path)); let parsed_path_file = syntax::SourceFile::parse(&format!("use {};", path));
let ast_path = parsed_path_file let ast_path =
.syntax_node() parsed_path_file.syntax_node().descendants().find_map(syntax::ast::Path::cast).unwrap();
.descendants()
.find_map(ra_syntax::ast::Path::cast)
.unwrap();
let mod_path = ModPath::from_src(ast_path, &Hygiene::new_unhygienic()).unwrap(); let mod_path = ModPath::from_src(ast_path, &Hygiene::new_unhygienic()).unwrap();
let crate_def_map = db.crate_def_map(module.krate); let crate_def_map = db.crate_def_map(module.krate);
@ -441,12 +438,12 @@ mod tests {
// already in scope. // already in scope.
check_found_path( check_found_path(
r#" 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 mod ast {
pub enum ModuleItem { pub enum ModuleItem {
A, B, C, A, B, C,
@ -458,18 +455,18 @@ mod tests {
check_found_path( check_found_path(
r#" 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 mod ast {
pub enum ModuleItem { pub enum ModuleItem {
A, B, C, A, B, C,
} }
} }
"#, "#,
"ra_syntax::ast::ModuleItem", "syntax::ast::ModuleItem",
); );
} }

View file

@ -11,7 +11,7 @@ use hir_expand::{
InFile, InFile,
}; };
use ra_db::FileId; use ra_db::FileId;
use ra_syntax::ast::{self, GenericParamsOwner, NameOwner, TypeBoundsOwner}; use syntax::ast::{self, GenericParamsOwner, NameOwner, TypeBoundsOwner};
use crate::{ use crate::{
body::LowerCtx, body::LowerCtx,

View file

@ -5,9 +5,9 @@ use std::{cmp::Ordering, fmt, hash::BuildHasherDefault, sync::Arc};
use fst::{self, Streamer}; use fst::{self, Streamer};
use indexmap::{map::Entry, IndexMap}; use indexmap::{map::Entry, IndexMap};
use ra_db::CrateId; use ra_db::CrateId;
use ra_syntax::SmolStr;
use rustc_hash::{FxHashMap, FxHasher}; use rustc_hash::{FxHashMap, FxHasher};
use smallvec::SmallVec; use smallvec::SmallVec;
use syntax::SmolStr;
use crate::{ use crate::{
db::DefDatabase, db::DefDatabase,

View file

@ -22,9 +22,9 @@ use hir_expand::{
name::{name, AsName, Name}, name::{name, AsName, Name},
HirFileId, InFile, HirFileId, InFile,
}; };
use ra_syntax::{ast, match_ast};
use rustc_hash::FxHashMap; use rustc_hash::FxHashMap;
use smallvec::SmallVec; use smallvec::SmallVec;
use syntax::{ast, match_ast};
use test_utils::mark; use test_utils::mark;
use crate::{ use crate::{

View file

@ -4,11 +4,11 @@ use std::{collections::hash_map::Entry, mem, sync::Arc};
use arena::map::ArenaMap; use arena::map::ArenaMap;
use hir_expand::{ast_id_map::AstIdMap, hygiene::Hygiene, HirFileId}; use hir_expand::{ast_id_map::AstIdMap, hygiene::Hygiene, HirFileId};
use ra_syntax::{ use smallvec::SmallVec;
use syntax::{
ast::{self, ModuleItemOwner}, ast::{self, ModuleItemOwner},
SyntaxNode, SyntaxNode,
}; };
use smallvec::SmallVec;
use crate::{ use crate::{
attr::Attrs, attr::Attrs,

View file

@ -1,10 +1,10 @@
use expect::{expect, Expect}; use expect::{expect, Expect};
use hir_expand::{db::AstDatabase, HirFileId, InFile}; use hir_expand::{db::AstDatabase, HirFileId, InFile};
use ra_db::fixture::WithFixture; use ra_db::fixture::WithFixture;
use ra_syntax::{ast, AstNode};
use rustc_hash::FxHashSet; use rustc_hash::FxHashSet;
use std::sync::Arc; use std::sync::Arc;
use stdx::format_to; use stdx::format_to;
use syntax::{ast, AstNode};
use crate::{db::DefDatabase, test_db::TestDB}; use crate::{db::DefDatabase, test_db::TestDB};
@ -228,31 +228,31 @@ fn smoke() {
top-level items: top-level items:
#[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("attr_on_use"))] }, input: None }]) }] #[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 }]) }] #[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 }]) }] #[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 }]) }] #[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 }]) }] > #[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 }]) }] > #[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 }]) }] > #[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 }]) }] > #[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 }]) }] #[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 }]) }] #[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 }]) }] #[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 }]) }] #[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 }]) }] #[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 } inner attrs: Attrs { entries: None }
top-level items: 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) } 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::<ra_syntax::ast::generated::nodes::Fn>(1) } > 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: inner items:
for AST FileAstId::<ra_syntax::ast::generated::nodes::Item>(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::<ra_syntax::ast::generated::nodes::Fn>(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: 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 }]) }] #[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 }]) }] #[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: top-level items:
#[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("trait_attr"))] }, input: None }]) }] #[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 }]) }] > #[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 }]) }] > #[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: top-level items:
#[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("impl_attr"))] }, input: None }]) }] #[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 }]) }] > #[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 }]) }] > #[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 } inner attrs: Attrs { entries: None }
top-level items: 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: 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 }]) }] #[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 } inner attrs: Attrs { entries: None }
top-level items: 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) } 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::<ra_syntax::ast::generated::nodes::MacroCall>(1) } > 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) }
"#]], "#]],
); );
} }

View file

@ -3,8 +3,8 @@
use std::marker::PhantomData; use std::marker::PhantomData;
use hir_expand::{InFile, MacroDefId}; use hir_expand::{InFile, MacroDefId};
use ra_syntax::{ast, AstNode, AstPtr};
use rustc_hash::FxHashMap; use rustc_hash::FxHashMap;
use syntax::{ast, AstNode, AstPtr};
use crate::{ use crate::{
dyn_map::{DynMap, Policy}, dyn_map::{DynMap, Policy},

View file

@ -4,8 +4,8 @@
//! features, such as Fn family of traits. //! features, such as Fn family of traits.
use std::sync::Arc; use std::sync::Arc;
use ra_syntax::SmolStr;
use rustc_hash::FxHashMap; use rustc_hash::FxHashMap;
use syntax::SmolStr;
use crate::{ use crate::{
db::DefDatabase, AdtId, AttrDefId, CrateId, EnumId, FunctionId, ImplId, ModuleDefId, ModuleId, db::DefDatabase, AdtId, AttrDefId, CrateId, EnumId, FunctionId, ImplId, ModuleDefId, ModuleId,

View file

@ -58,7 +58,7 @@ use hir_expand::{
MacroCallId, MacroCallKind, MacroDefId, MacroDefKind, MacroCallId, MacroCallKind, MacroDefId, MacroDefKind,
}; };
use ra_db::{impl_intern_key, salsa, CrateId}; use ra_db::{impl_intern_key, salsa, CrateId};
use ra_syntax::ast; use syntax::ast;
use crate::builtin_type::BuiltinType; use crate::builtin_type::BuiltinType;
use item_tree::{ use item_tree::{

View file

@ -59,9 +59,9 @@ use std::sync::Arc;
use arena::Arena; use arena::Arena;
use hir_expand::{diagnostics::DiagnosticSink, name::Name, InFile}; use hir_expand::{diagnostics::DiagnosticSink, name::Name, InFile};
use ra_db::{CrateId, Edition, FileId}; use ra_db::{CrateId, Edition, FileId};
use ra_syntax::ast;
use rustc_hash::FxHashMap; use rustc_hash::FxHashMap;
use stdx::format_to; use stdx::format_to;
use syntax::ast;
use crate::{ use crate::{
db::DefDatabase, db::DefDatabase,
@ -288,7 +288,7 @@ pub enum ModuleSource {
mod diagnostics { mod diagnostics {
use hir_expand::diagnostics::DiagnosticSink; use hir_expand::diagnostics::DiagnosticSink;
use ra_syntax::{ast, AstPtr}; use syntax::{ast, AstPtr};
use crate::{db::DefDatabase, diagnostics::UnresolvedModule, nameres::LocalModuleId, AstId}; use crate::{db::DefDatabase, diagnostics::UnresolvedModule, nameres::LocalModuleId, AstId};

View file

@ -13,8 +13,8 @@ use hir_expand::{
}; };
use ra_cfg::CfgOptions; use ra_cfg::CfgOptions;
use ra_db::{CrateId, FileId, ProcMacroId}; use ra_db::{CrateId, FileId, ProcMacroId};
use ra_syntax::ast;
use rustc_hash::FxHashMap; use rustc_hash::FxHashMap;
use syntax::ast;
use test_utils::mark; use test_utils::mark;
use crate::{ use crate::{

View file

@ -1,7 +1,7 @@
//! This module resolves `mod foo;` declaration to file. //! This module resolves `mod foo;` declaration to file.
use hir_expand::name::Name; use hir_expand::name::Name;
use ra_db::FileId; use ra_db::FileId;
use ra_syntax::SmolStr; use syntax::SmolStr;
use crate::{db::DefDatabase, HirFileId}; use crate::{db::DefDatabase, HirFileId};

View file

@ -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", candidate: "bar.rs",
}, },

View file

@ -13,7 +13,7 @@ use hir_expand::{
name::{AsName, Name}, name::{AsName, Name},
}; };
use ra_db::CrateId; use ra_db::CrateId;
use ra_syntax::ast; use syntax::ast;
use crate::{ use crate::{
type_ref::{TypeBound, TypeRef}, type_ref::{TypeBound, TypeRef},

View file

@ -9,7 +9,7 @@ use hir_expand::{
hygiene::Hygiene, hygiene::Hygiene,
name::{name, AsName}, name::{name, AsName},
}; };
use ra_syntax::ast::{self, AstNode, TypeBoundsOwner}; use syntax::ast::{self, AstNode, TypeBoundsOwner};
use super::AssociatedTypeBinding; use super::AssociatedTypeBinding;
use crate::{ use crate::{

View file

@ -5,7 +5,7 @@ use std::iter;
use either::Either; use either::Either;
use hir_expand::{hygiene::Hygiene, name::AsName}; use hir_expand::{hygiene::Hygiene, name::AsName};
use ra_syntax::ast::{self, NameOwner}; use syntax::ast::{self, NameOwner};
use test_utils::mark; use test_utils::mark;
use crate::path::{ImportAlias, ModPath, PathKind}; use crate::path::{ImportAlias, ModPath, PathKind};

View file

@ -1,6 +1,6 @@
//! HIR for references to types. Paths in these are not yet resolved. They can //! HIR for references to types. Paths in these are not yet resolved. They can
//! be directly created from an ast::TypeRef, without further queries. //! 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}; use crate::{body::LowerCtx, path::Path};

View file

@ -1,7 +1,7 @@
//! Defines hir-level representation of visibility (e.g. `pub` and `pub(crate)`). //! Defines hir-level representation of visibility (e.g. `pub` and `pub(crate)`).
use hir_expand::{hygiene::Hygiene, InFile}; use hir_expand::{hygiene::Hygiene, InFile};
use ra_syntax::ast; use syntax::ast;
use crate::{ use crate::{
db::DefDatabase, db::DefDatabase,

View file

@ -15,7 +15,7 @@ rustc-hash = "1.0.0"
arena = { path = "../arena" } arena = { path = "../arena" }
ra_db = { path = "../ra_db" } ra_db = { path = "../ra_db" }
ra_syntax = { path = "../ra_syntax" } syntax = { path = "../syntax" }
parser = { path = "../parser" } parser = { path = "../parser" }
profile = { path = "../profile" } profile = { path = "../profile" }
tt = { path = "../tt" } tt = { path = "../tt" }

View file

@ -13,7 +13,7 @@ use std::{
}; };
use arena::{Arena, Idx}; 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. /// `AstId` points to an AST node in a specific file.
pub struct FileAstId<N: AstNode> { pub struct FileAstId<N: AstNode> {

View file

@ -3,7 +3,7 @@
use log::debug; use log::debug;
use parser::FragmentKind; use parser::FragmentKind;
use ra_syntax::{ use syntax::{
ast::{self, AstNode, GenericParamsOwner, ModuleItemOwner, NameOwner}, ast::{self, AstNode, GenericParamsOwner, ModuleItemOwner, NameOwner},
match_ast, match_ast,
}; };

View file

@ -8,7 +8,7 @@ use either::Either;
use mbe::parse_to_token_tree; use mbe::parse_to_token_tree;
use parser::FragmentKind; use parser::FragmentKind;
use ra_db::FileId; use ra_db::FileId;
use ra_syntax::ast::{self, AstToken, HasStringValue}; use syntax::ast::{self, AstToken, HasStringValue};
macro_rules! register_builtin { macro_rules! register_builtin {
( LAZY: $(($name:ident, $kind: ident) => $expand:ident),* , EAGER: $(($e_name:ident, $e_kind: ident) => $e_expand:ident),* ) => { ( LAZY: $(($name:ident, $kind: ident) => $expand:ident),* , EAGER: $(($e_name:ident, $e_kind: ident) => $e_expand:ident),* ) => {
@ -427,8 +427,8 @@ mod tests {
MacroCallLoc, MacroCallLoc,
}; };
use ra_db::{fixture::WithFixture, SourceDatabase}; use ra_db::{fixture::WithFixture, SourceDatabase};
use ra_syntax::ast::NameOwner;
use std::sync::Arc; use std::sync::Arc;
use syntax::ast::NameOwner;
fn expand_builtin_macro(ra_fixture: &str) -> String { fn expand_builtin_macro(ra_fixture: &str) -> String {
let (db, file_id) = TestDB::with_single_file(&ra_fixture); let (db, file_id) = TestDB::with_single_file(&ra_fixture);

View file

@ -5,7 +5,7 @@ use std::sync::Arc;
use mbe::{ExpandResult, MacroRules}; use mbe::{ExpandResult, MacroRules};
use parser::FragmentKind; use parser::FragmentKind;
use ra_db::{salsa, SourceDatabase}; 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::{ use crate::{
ast_id_map::AstIdMap, BuiltinDeriveExpander, BuiltinFnLikeExpander, EagerCallLoc, EagerMacroId, ast_id_map::AstIdMap, BuiltinDeriveExpander, BuiltinFnLikeExpander, EagerCallLoc, EagerMacroId,
@ -92,9 +92,9 @@ pub trait AstDatabase: SourceDatabase {
pub fn expand_hypothetical( pub fn expand_hypothetical(
db: &dyn AstDatabase, db: &dyn AstDatabase,
actual_macro_call: MacroCallId, actual_macro_call: MacroCallId,
hypothetical_args: &ra_syntax::ast::TokenTree, hypothetical_args: &syntax::ast::TokenTree,
token_to_map: ra_syntax::SyntaxToken, token_to_map: syntax::SyntaxToken,
) -> Option<(SyntaxNode, ra_syntax::SyntaxToken)> { ) -> Option<(SyntaxNode, syntax::SyntaxToken)> {
let macro_file = MacroFile { macro_call_id: actual_macro_call }; 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 (tt, tmap_1) = mbe::syntax_node_to_token_tree(hypothetical_args.syntax()).unwrap();
let range = 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))))?; 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 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 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)) Some((node.syntax_node(), token))
} }

View file

@ -16,7 +16,7 @@
use std::{any::Any, fmt}; use std::{any::Any, fmt};
use ra_syntax::SyntaxNodePtr; use syntax::SyntaxNodePtr;
use crate::InFile; use crate::InFile;

View file

@ -27,8 +27,8 @@ use crate::{
use parser::FragmentKind; use parser::FragmentKind;
use ra_db::CrateId; use ra_db::CrateId;
use ra_syntax::{algo::SyntaxRewriter, SyntaxNode};
use std::sync::Arc; use std::sync::Arc;
use syntax::{algo::SyntaxRewriter, SyntaxNode};
pub fn expand_eager_macro( pub fn expand_eager_macro(
db: &dyn AstDatabase, db: &dyn AstDatabase,

Some files were not shown because too many files have changed in this diff Show more