Rollup merge of #122719 - oli-obk:nested_static_feed_hir, r=fee1-dead
Ensure nested statics have a HIR node to prevent various queries from ICEing fixes https://github.com/rust-lang/miri/issues/3389
This commit is contained in:
commit
671a2f7d67
12 changed files with 45 additions and 49 deletions
|
@ -914,7 +914,7 @@ impl<'hir> Map<'hir> {
|
|||
Node::Crate(item) => item.spans.inner_span,
|
||||
Node::WhereBoundPredicate(pred) => pred.span,
|
||||
Node::ArrayLenInfer(inf) => inf.span,
|
||||
Node::AssocOpaqueTy(..) => unreachable!(),
|
||||
Node::Synthetic => unreachable!(),
|
||||
Node::Err(span) => *span,
|
||||
}
|
||||
}
|
||||
|
@ -1179,7 +1179,7 @@ fn hir_id_to_string(map: Map<'_>, id: HirId) -> String {
|
|||
Node::Crate(..) => String::from("(root_crate)"),
|
||||
Node::WhereBoundPredicate(_) => node_str("where bound predicate"),
|
||||
Node::ArrayLenInfer(_) => node_str("array len infer"),
|
||||
Node::AssocOpaqueTy(..) => unreachable!(),
|
||||
Node::Synthetic => unreachable!(),
|
||||
Node::Err(_) => node_str("error"),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -596,6 +596,27 @@ impl<'tcx> TyCtxtFeed<'tcx, LocalDefId> {
|
|||
pub fn feed_owner_id(&self) -> TyCtxtFeed<'tcx, hir::OwnerId> {
|
||||
TyCtxtFeed { tcx: self.tcx, key: hir::OwnerId { def_id: self.key } }
|
||||
}
|
||||
|
||||
// Fills in all the important parts needed by HIR queries
|
||||
pub fn feed_hir(&self) {
|
||||
self.local_def_id_to_hir_id(HirId::make_owner(self.def_id()));
|
||||
|
||||
let node = hir::OwnerNode::Synthetic;
|
||||
let bodies = Default::default();
|
||||
let attrs = hir::AttributeMap::EMPTY;
|
||||
|
||||
let (opt_hash_including_bodies, _) = self.tcx.hash_owner_nodes(node, &bodies, &attrs.map);
|
||||
let node = node.into();
|
||||
self.opt_hir_owner_nodes(Some(self.tcx.arena.alloc(hir::OwnerNodes {
|
||||
opt_hash_including_bodies,
|
||||
nodes: IndexVec::from_elem_n(
|
||||
hir::ParentedNode { parent: hir::ItemLocalId::INVALID, node },
|
||||
1,
|
||||
),
|
||||
bodies,
|
||||
})));
|
||||
self.feed_owner_id().hir_attrs(attrs);
|
||||
}
|
||||
}
|
||||
|
||||
/// The central data structure of the compiler. It stores references
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue