Limit from_anon_const
to AnonConst
s.
This commit is contained in:
parent
9bcd9fe674
commit
124ab20d4b
1 changed files with 4 additions and 1 deletions
|
@ -2409,7 +2409,10 @@ impl<'tcx> Const<'tcx> {
|
|||
|
||||
let hir_id = tcx.hir().local_def_id_to_hir_id(def_id);
|
||||
|
||||
let body_id = tcx.hir().body_owned_by(hir_id);
|
||||
let body_id = match tcx.hir().get(hir_id) {
|
||||
hir::Node::AnonConst(ac) => ac.body,
|
||||
_ => span_bug!(tcx.def_span(def_id.to_def_id()), "from_anon_const can only process anonymous constants"),
|
||||
};
|
||||
|
||||
let expr = &tcx.hir().body(body_id).value;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue