Skip to content

Commit 7186628

Browse files
committed
add fn enclosing_body_owner to hir
1 parent 9d34bf5 commit 7186628

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/librustc_typeck/collect/type_of.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ pub(super) fn const_param_of(tcx: TyCtxt<'_>, def_id: DefId) -> Option<DefId> {
3535
ExprKind::MethodCall(segment, ..) | ExprKind::Path(QPath::TypeRelative(_, segment)),
3636
..
3737
}) => {
38-
let body_owner = tcx.hir().get_parent_did(parent_node_id);
38+
let body_owner = tcx.hir().local_def_id(tcx.hir().enclosing_body_owner(hir_id));
3939
let tables = tcx.typeck_tables_of(body_owner.to_def_id());
4040
// This may fail in case the method/path does not actually exist.
4141
// As there is no relevant param for `def_id`, we simply return
@@ -74,7 +74,7 @@ pub(super) fn const_param_of(tcx: TyCtxt<'_>, def_id: DefId) -> Option<DefId> {
7474
| ExprKind::Struct(&QPath::Resolved(_, path), ..),
7575
..
7676
}) => {
77-
let body_owner = tcx.hir().get_parent_did(parent_node_id);
77+
let body_owner = tcx.hir().local_def_id(tcx.hir().enclosing_body_owner(hir_id));
7878
let _tables = tcx.typeck_tables_of(body_owner.to_def_id());
7979
&*path
8080
}

0 commit comments

Comments
 (0)