mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-03 20:23:59 +00:00
Shortcut block_def_map
if there's no inner items
This previously didn't work, but apparently only because of the wonky test setup
This commit is contained in:
parent
80ae583dc0
commit
b4aa860cac
@ -201,8 +201,10 @@ impl DefMap {
|
|||||||
let block: BlockLoc = db.lookup_intern_block(block_id);
|
let block: BlockLoc = db.lookup_intern_block(block_id);
|
||||||
let parent = block.module.def_map(db);
|
let parent = block.module.def_map(db);
|
||||||
|
|
||||||
// FIXME: It would be good to just return the parent map when the block has no items, but
|
let item_tree = db.item_tree(block.ast_id.file_id);
|
||||||
// we rely on `def_map.block` in a few places, which is `Some` for the inner `DefMap`.
|
if item_tree.inner_items_of_block(block.ast_id.value).is_empty() {
|
||||||
|
return parent.clone();
|
||||||
|
}
|
||||||
|
|
||||||
let block_info =
|
let block_info =
|
||||||
BlockInfo { block: block_id, parent, parent_module: block.module.local_id };
|
BlockInfo { block: block_id, parent, parent_module: block.module.local_id };
|
||||||
|
Loading…
Reference in New Issue
Block a user