mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-29 10:13:54 +00:00
hir_def: ignore ast::Type in file_item_tree query
This commit is contained in:
parent
28ef7c20d7
commit
14918a3870
@ -104,6 +104,11 @@ impl ItemTree {
|
||||
// items and expanded during block DefMap computation
|
||||
return Default::default();
|
||||
},
|
||||
ast::Type(_ty) => {
|
||||
// FIXME: This occurs because macros in type position are treated as inner
|
||||
// items and expanded during block DefMap computation
|
||||
return Default::default();
|
||||
},
|
||||
ast::Expr(e) => {
|
||||
// Macros can expand to expressions. We return an empty item tree in this case, but
|
||||
// still need to collect inner items.
|
||||
|
@ -189,16 +189,12 @@ impl Ctx {
|
||||
block_stack.push(self.source_ast_id_map.ast_id(&block));
|
||||
},
|
||||
ast::Item(item) => {
|
||||
// FIXME: This triggers for macro calls in expression/pattern
|
||||
if let Some(SyntaxKind::MACRO_TYPE) = node.parent().map(|p| p.kind()) {
|
||||
// Ignore macros at type position
|
||||
} else {
|
||||
let mod_items = self.lower_mod_item(&item, true);
|
||||
let current_block = block_stack.last();
|
||||
if let (Some(mod_items), Some(block)) = (mod_items, current_block) {
|
||||
if !mod_items.0.is_empty() {
|
||||
self.data().inner_items.entry(*block).or_default().extend(mod_items.0.iter().copied());
|
||||
}
|
||||
// FIXME: This triggers for macro calls in expression/pattern/type position
|
||||
let mod_items = self.lower_mod_item(&item, true);
|
||||
let current_block = block_stack.last();
|
||||
if let (Some(mod_items), Some(block)) = (mod_items, current_block) {
|
||||
if !mod_items.0.is_empty() {
|
||||
self.data().inner_items.entry(*block).or_default().extend(mod_items.0.iter().copied());
|
||||
}
|
||||
}
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user