aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/nameres/raw.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir/src/nameres/raw.rs')
-rw-r--r--crates/ra_hir/src/nameres/raw.rs12
1 files changed, 10 insertions, 2 deletions
diff --git a/crates/ra_hir/src/nameres/raw.rs b/crates/ra_hir/src/nameres/raw.rs
index 7963736e0..c646d3d00 100644
--- a/crates/ra_hir/src/nameres/raw.rs
+++ b/crates/ra_hir/src/nameres/raw.rs
@@ -134,12 +134,14 @@ pub(super) enum ModuleData {
134 name: Name, 134 name: Name,
135 ast_id: FileAstId<ast::Module>, 135 ast_id: FileAstId<ast::Module>,
136 attr_path: Option<SmolStr>, 136 attr_path: Option<SmolStr>,
137 is_macro_use: bool,
137 }, 138 },
138 Definition { 139 Definition {
139 name: Name, 140 name: Name,
140 ast_id: FileAstId<ast::Module>, 141 ast_id: FileAstId<ast::Module>,
141 items: Vec<RawItem>, 142 items: Vec<RawItem>,
142 attr_path: Option<SmolStr>, 143 attr_path: Option<SmolStr>,
144 is_macro_use: bool,
143 }, 145 },
144} 146}
145 147
@@ -267,10 +269,15 @@ impl RawItemsCollector {
267 }; 269 };
268 270
269 let ast_id = self.source_ast_id_map.ast_id(&module); 271 let ast_id = self.source_ast_id_map.ast_id(&module);
272 let is_macro_use = module.has_atom_attr("macro_use");
270 if module.has_semi() { 273 if module.has_semi() {
271 let attr_path = extract_mod_path_attribute(&module); 274 let attr_path = extract_mod_path_attribute(&module);
272 let item = 275 let item = self.raw_items.modules.alloc(ModuleData::Declaration {
273 self.raw_items.modules.alloc(ModuleData::Declaration { name, ast_id, attr_path }); 276 name,
277 ast_id,
278 attr_path,
279 is_macro_use,
280 });
274 self.push_item(current_module, RawItem::Module(item)); 281 self.push_item(current_module, RawItem::Module(item));
275 return; 282 return;
276 } 283 }
@@ -282,6 +289,7 @@ impl RawItemsCollector {
282 ast_id, 289 ast_id,
283 items: Vec::new(), 290 items: Vec::new(),
284 attr_path, 291 attr_path,
292 is_macro_use,
285 }); 293 });
286 self.process_module(Some(item), item_list); 294 self.process_module(Some(item), item_list);
287 self.push_item(current_module, RawItem::Module(item)); 295 self.push_item(current_module, RawItem::Module(item));