about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2024-04-11 12:41:03 -0400
committerMichael Goulet <michael@errs.io>2024-05-20 19:56:48 -0400
commit5915850071da4dc48ce9b9a4469c522d75cd6f6c (patch)
tree0f98b7cdbb2f322d59df9e613cf56ed282e17c5e
parentffdf277618cc6b40e7c6d62981dcd2c22ff416d6 (diff)
downloadrust-5915850071da4dc48ce9b9a4469c522d75cd6f6c.tar.gz
rust-5915850071da4dc48ce9b9a4469c522d75cd6f6c.zip
No need to pass parent of block for BlockTailExpression
-rw-r--r--compiler/rustc_hir_typeck/src/coercion.rs3
1 files changed, 1 insertions, 2 deletions
diff --git a/compiler/rustc_hir_typeck/src/coercion.rs b/compiler/rustc_hir_typeck/src/coercion.rs
index 8a6a33304e6..4896781683c 100644
--- a/compiler/rustc_hir_typeck/src/coercion.rs
+++ b/compiler/rustc_hir_typeck/src/coercion.rs
@@ -1591,14 +1591,13 @@ impl<'tcx, 'exprs, E: AsCoercionSite> CoerceMany<'tcx, 'exprs, E> {
                         err.span_label(cause.span, "return type is not `()`");
                     }
                     ObligationCauseCode::BlockTailExpression(blk_id, ..) => {
-                        let parent_id = fcx.tcx.parent_hir_id(blk_id);
                         err = self.report_return_mismatched_types(
                             cause,
                             expected,
                             found,
                             coercion_error,
                             fcx,
-                            parent_id,
+                            blk_id,
                             expression,
                             Some(blk_id),
                         );