1
Fork 0

Check for body owner fallibly

This commit is contained in:
Michael Goulet 2023-04-11 16:52:20 +00:00
parent 3c2e2dd5c5
commit 1178c49a1b
3 changed files with 45 additions and 1 deletions

View file

@ -2380,8 +2380,8 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
}
if let Some(ty::subst::GenericArgKind::Type(_)) = subst.map(|subst| subst.unpack())
&& let Some(body_id) = self.tcx.hir().maybe_body_owned_by(obligation.cause.body_id)
{
let body_id = self.tcx.hir().body_owned_by(obligation.cause.body_id);
let mut expr_finder = FindExprBySpan::new(span);
expr_finder.visit_expr(&self.tcx.hir().body(body_id).value);