1
Fork 0

progress, stuff compiles now

This commit is contained in:
lcnr 2021-03-01 12:50:09 +01:00 committed by kadmin
parent 8ef81388e2
commit b0feb5be2f
25 changed files with 108 additions and 76 deletions

View file

@ -395,6 +395,10 @@ impl<'a, 'hir> Visitor<'hir> for NodeCollector<'a, 'hir> {
}
}
fn visit_const_param_default(&mut self, param: HirId, ct: &'hir AnonConst) {
self.with_parent(param, |this| intravisit::walk_const_param_default(this, ct))
}
fn visit_trait_item(&mut self, ti: &'hir TraitItem<'hir>) {
self.with_dep_node_owner(ti.def_id, ti, |this, hash| {
this.insert_with_hash(ti.span, ti.hir_id(), Node::TraitItem(ti), hash);

View file

@ -44,7 +44,11 @@ impl<'tcx> Const<'tcx> {
let hir_id = tcx.hir().local_def_id_to_hir_id(def.did);
let body_id = match tcx.hir().get(hir_id) {
hir::Node::AnonConst(ac) => ac.body,
hir::Node::AnonConst(ac)
| hir::Node::GenericParam(hir::GenericParam {
kind: hir::GenericParamKind::Const { ty: _, default: Some(ac) },
..
}) => ac.body,
_ => span_bug!(
tcx.def_span(def.did.to_def_id()),
"from_anon_const can only process anonymous constants"