Skip to content

Commit

Permalink
Take into account ExprKind::Scope when calculating span of temporary
Browse files Browse the repository at this point in the history
  • Loading branch information
LeSeulArtichaut committed Mar 9, 2021
1 parent 5f38c83 commit d6c737a
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions compiler/rustc_mir_build/src/build/expr/stmt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,12 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
if let ExprKind::Block { body } = &expr.kind {
if let Some(tail_expr) = &body.expr {
let mut expr = &*tail_expr;
while let ExprKind::Block { body: subblock } = &expr.kind {
if let Some(subtail_expr) = &subblock.expr {
expr = subtail_expr
} else {
break;
}
while let ExprKind::Block {
body: Block { expr: Some(nested_expr), .. },
}
| ExprKind::Scope { value: nested_expr, .. } = &expr.kind
{
expr = nested_expr;
}
this.block_context.push(BlockFrame::TailExpr {
tail_result_is_ignored: true,
Expand Down

0 comments on commit d6c737a

Please sign in to comment.