Use invalid local id for zeroth node parent.
This commit is contained in:
parent
6b7995195a
commit
c5628a5e65
3 changed files with 11 additions and 2 deletions
|
@ -47,7 +47,10 @@ pub(super) fn index_hir<'hir>(
|
|||
bodies: &IndexVec<ItemLocalId, Option<&'hir Body<'hir>>>,
|
||||
) -> (IndexVec<ItemLocalId, Option<ParentedNode<'hir>>>, FxHashMap<LocalDefId, ItemLocalId>) {
|
||||
let mut nodes = IndexVec::new();
|
||||
nodes.push(Some(ParentedNode { parent: ItemLocalId::new(0), node: item.into() }));
|
||||
// This node's parent should never be accessed: the owner's parent is computed by the
|
||||
// hir_owner_parent query. Make it invalid (= ItemLocalId::MAX) to force an ICE whenever it is
|
||||
// used.
|
||||
nodes.push(Some(ParentedNode { parent: ItemLocalId::INVALID, node: item.into() }));
|
||||
let mut collector = NodeCollector {
|
||||
source_map: sess.source_map(),
|
||||
definitions,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue