about summary refs log tree commit diff
path: root/compiler/rustc_trait_selection/src
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2023-04-11 16:52:20 +0000
committerMichael Goulet <michael@errs.io>2023-04-11 16:52:40 +0000
commit1178c49a1bc76c7ca242cede37855cb5468b290c (patch)
tree2dcd71d32d38c20a1ed479588b4c4886d82b0530 /compiler/rustc_trait_selection/src
parent3c2e2dd5c516acc60ababd12e5dba684d71c2315 (diff)
downloadrust-1178c49a1bc76c7ca242cede37855cb5468b290c.tar.gz
rust-1178c49a1bc76c7ca242cede37855cb5468b290c.zip
Check for body owner fallibly
Diffstat (limited to 'compiler/rustc_trait_selection/src')
-rw-r--r--compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs
index 6ebf056f0e8..d7e0fe592b0 100644
--- a/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs
+++ b/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs
@@ -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);