aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_def
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir_def')
-rw-r--r--crates/ra_hir_def/src/body/lower.rs2
-rw-r--r--crates/ra_hir_def/src/item_tree.rs4
-rw-r--r--crates/ra_hir_def/src/item_tree/lower.rs6
-rw-r--r--crates/ra_hir_def/src/item_tree/tests.rs4
-rw-r--r--crates/ra_hir_def/src/path.rs2
5 files changed, 9 insertions, 9 deletions
diff --git a/crates/ra_hir_def/src/body/lower.rs b/crates/ra_hir_def/src/body/lower.rs
index bfd574c5d..5c57d8bde 100644
--- a/crates/ra_hir_def/src/body/lower.rs
+++ b/crates/ra_hir_def/src/body/lower.rs
@@ -670,7 +670,7 @@ impl ExprCollector<'_> {
670 } 670 }
671 ast::Item::ExternBlock(_) => return None, // FIXME: collect from extern blocks 671 ast::Item::ExternBlock(_) => return None, // FIXME: collect from extern blocks
672 ast::Item::ImplDef(_) 672 ast::Item::ImplDef(_)
673 | ast::Item::UseItem(_) 673 | ast::Item::Use(_)
674 | ast::Item::ExternCrate(_) 674 | ast::Item::ExternCrate(_)
675 | ast::Item::Module(_) 675 | ast::Item::Module(_)
676 | ast::Item::MacroCall(_) => return None, 676 | ast::Item::MacroCall(_) => return None,
diff --git a/crates/ra_hir_def/src/item_tree.rs b/crates/ra_hir_def/src/item_tree.rs
index 4db7b2793..0bab9c6d8 100644
--- a/crates/ra_hir_def/src/item_tree.rs
+++ b/crates/ra_hir_def/src/item_tree.rs
@@ -411,7 +411,7 @@ macro_rules! mod_items {
411} 411}
412 412
413mod_items! { 413mod_items! {
414 Import in imports -> ast::UseItem, 414 Import in imports -> ast::Use,
415 ExternCrate in extern_crates -> ast::ExternCrate, 415 ExternCrate in extern_crates -> ast::ExternCrate,
416 Function in functions -> ast::FnDef, 416 Function in functions -> ast::FnDef,
417 Struct in structs -> ast::StructDef, 417 Struct in structs -> ast::StructDef,
@@ -482,7 +482,7 @@ pub struct Import {
482 pub is_prelude: bool, 482 pub is_prelude: bool,
483 /// AST ID of the `use` or `extern crate` item this import was derived from. Note that many 483 /// AST ID of the `use` or `extern crate` item this import was derived from. Note that many
484 /// `Import`s can map to the same `use` item. 484 /// `Import`s can map to the same `use` item.
485 pub ast_id: FileAstId<ast::UseItem>, 485 pub ast_id: FileAstId<ast::Use>,
486} 486}
487 487
488#[derive(Debug, Clone, Eq, PartialEq)] 488#[derive(Debug, Clone, Eq, PartialEq)]
diff --git a/crates/ra_hir_def/src/item_tree/lower.rs b/crates/ra_hir_def/src/item_tree/lower.rs
index 8a36de311..8bd0362dc 100644
--- a/crates/ra_hir_def/src/item_tree/lower.rs
+++ b/crates/ra_hir_def/src/item_tree/lower.rs
@@ -95,7 +95,7 @@ impl Ctx {
95 ast::Item::TraitDef(_) | ast::Item::ImplDef(_) | ast::Item::ExternBlock(_) => {} 95 ast::Item::TraitDef(_) | ast::Item::ImplDef(_) | ast::Item::ExternBlock(_) => {}
96 96
97 // These don't have inner items. 97 // These don't have inner items.
98 ast::Item::Module(_) | ast::Item::ExternCrate(_) | ast::Item::UseItem(_) => {} 98 ast::Item::Module(_) | ast::Item::ExternCrate(_) | ast::Item::Use(_) => {}
99 }; 99 };
100 100
101 let attrs = Attrs::new(item, &self.hygiene); 101 let attrs = Attrs::new(item, &self.hygiene);
@@ -110,7 +110,7 @@ impl Ctx {
110 ast::Item::Module(ast) => self.lower_module(ast).map(Into::into), 110 ast::Item::Module(ast) => self.lower_module(ast).map(Into::into),
111 ast::Item::TraitDef(ast) => self.lower_trait(ast).map(Into::into), 111 ast::Item::TraitDef(ast) => self.lower_trait(ast).map(Into::into),
112 ast::Item::ImplDef(ast) => self.lower_impl(ast).map(Into::into), 112 ast::Item::ImplDef(ast) => self.lower_impl(ast).map(Into::into),
113 ast::Item::UseItem(ast) => Some(ModItems( 113 ast::Item::Use(ast) => Some(ModItems(
114 self.lower_use(ast).into_iter().map(Into::into).collect::<SmallVec<_>>(), 114 self.lower_use(ast).into_iter().map(Into::into).collect::<SmallVec<_>>(),
115 )), 115 )),
116 ast::Item::ExternCrate(ast) => self.lower_extern_crate(ast).map(Into::into), 116 ast::Item::ExternCrate(ast) => self.lower_extern_crate(ast).map(Into::into),
@@ -469,7 +469,7 @@ impl Ctx {
469 Some(id(self.data().impls.alloc(res))) 469 Some(id(self.data().impls.alloc(res)))
470 } 470 }
471 471
472 fn lower_use(&mut self, use_item: &ast::UseItem) -> Vec<FileItemTreeId<Import>> { 472 fn lower_use(&mut self, use_item: &ast::Use) -> Vec<FileItemTreeId<Import>> {
473 // FIXME: cfg_attr 473 // FIXME: cfg_attr
474 let is_prelude = use_item.has_atom_attr("prelude_import"); 474 let is_prelude = use_item.has_atom_attr("prelude_import");
475 let visibility = self.lower_visibility(use_item); 475 let visibility = self.lower_visibility(use_item);
diff --git a/crates/ra_hir_def/src/item_tree/tests.rs b/crates/ra_hir_def/src/item_tree/tests.rs
index 68be1cb40..3f2e29d9e 100644
--- a/crates/ra_hir_def/src/item_tree/tests.rs
+++ b/crates/ra_hir_def/src/item_tree/tests.rs
@@ -228,9 +228,9 @@ fn smoke() {
228 228
229 top-level items: 229 top-level items:
230 #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("attr_on_use"))] }, input: None }]) }] 230 #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("attr_on_use"))] }, input: None }]) }]
231 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::UseItem>(0) } 231 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) }
232 #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("attr_on_use"))] }, input: None }]) }] 232 #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("attr_on_use"))] }, input: None }]) }]
233 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::UseItem>(0) } 233 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) }
234 #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("ext_crate"))] }, input: None }]) }] 234 #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("ext_crate"))] }, input: None }]) }]
235 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) } 235 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) }
236 #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("on_trait"))] }, input: None }]) }] 236 #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("on_trait"))] }, input: None }]) }]
diff --git a/crates/ra_hir_def/src/path.rs b/crates/ra_hir_def/src/path.rs
index 190d6d98d..68b9f89c3 100644
--- a/crates/ra_hir_def/src/path.rs
+++ b/crates/ra_hir_def/src/path.rs
@@ -67,7 +67,7 @@ impl ModPath {
67 67
68 /// Calls `cb` with all paths, represented by this use item. 68 /// Calls `cb` with all paths, represented by this use item.
69 pub(crate) fn expand_use_item( 69 pub(crate) fn expand_use_item(
70 item_src: InFile<ast::UseItem>, 70 item_src: InFile<ast::Use>,
71 hygiene: &Hygiene, 71 hygiene: &Hygiene,
72 mut cb: impl FnMut(ModPath, &ast::UseTree, /* is_glob */ bool, Option<ImportAlias>), 72 mut cb: impl FnMut(ModPath, &ast::UseTree, /* is_glob */ bool, Option<ImportAlias>),
73 ) { 73 ) {