Don't consider Let
exprs terminating scopes
This commit is contained in:
parent
bf286a82e2
commit
3041bc9e71
4 changed files with 24 additions and 8 deletions
|
@ -252,9 +252,13 @@ fn resolve_expr<'tcx>(visitor: &mut RegionResolutionVisitor<'tcx>, expr: &'tcx h
|
|||
) => {
|
||||
// For shortcircuiting operators, mark the RHS as a terminating
|
||||
// scope since it only executes conditionally.
|
||||
terminating(r.hir_id.local_id);
|
||||
}
|
||||
|
||||
// `Let` expressions (in a let-chain) shouldn't be terminating, as their temporaries
|
||||
// should live beyond the immediate expression
|
||||
if !matches!(r.kind, hir::ExprKind::Let(_)) {
|
||||
terminating(r.hir_id.local_id);
|
||||
}
|
||||
}
|
||||
hir::ExprKind::If(_, ref then, Some(ref otherwise)) => {
|
||||
terminating(then.hir_id.local_id);
|
||||
terminating(otherwise.hir_id.local_id);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue