Skip to content

Commit d6c737a

Browse files
Take into account ExprKind::Scope when calculating span of temporary
1 parent 5f38c83 commit d6c737a

File tree

1 file changed

+6
-6
lines changed
  • compiler/rustc_mir_build/src/build/expr

1 file changed

+6
-6
lines changed

compiler/rustc_mir_build/src/build/expr/stmt.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -141,12 +141,12 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
141141
if let ExprKind::Block { body } = &expr.kind {
142142
if let Some(tail_expr) = &body.expr {
143143
let mut expr = &*tail_expr;
144-
while let ExprKind::Block { body: subblock } = &expr.kind {
145-
if let Some(subtail_expr) = &subblock.expr {
146-
expr = subtail_expr
147-
} else {
148-
break;
149-
}
144+
while let ExprKind::Block {
145+
body: Block { expr: Some(nested_expr), .. },
146+
}
147+
| ExprKind::Scope { value: nested_expr, .. } = &expr.kind
148+
{
149+
expr = nested_expr;
150150
}
151151
this.block_context.push(BlockFrame::TailExpr {
152152
tail_result_is_ignored: true,

0 commit comments

Comments
 (0)