Skip to content

Commit 679b90c

Browse files
committed
Propagate temporary lifetime extension into if and match.
1 parent cce6a6e commit 679b90c

File tree

1 file changed

+13
-0
lines changed
  • compiler/rustc_hir_analysis/src/check

1 file changed

+13
-0
lines changed

compiler/rustc_hir_analysis/src/check/region.rs

+13
Original file line numberDiff line numberDiff line change
@@ -689,6 +689,8 @@ fn resolve_local<'tcx>(
689689
/// | [ ..., E&, ... ]
690690
/// | ( ..., E&, ... )
691691
/// | {...; E&}
692+
/// | if _ { ...; E& } else { ...; E& }
693+
/// | match _ { ..., _ => E&, ... }
692694
/// | box E&
693695
/// | E& as ...
694696
/// | ( E& )
@@ -727,6 +729,17 @@ fn resolve_local<'tcx>(
727729
record_rvalue_scope_if_borrow_expr(visitor, subexpr, blk_id);
728730
}
729731
}
732+
hir::ExprKind::If(_, then_block, else_block) => {
733+
record_rvalue_scope_if_borrow_expr(visitor, then_block, blk_id);
734+
if let Some(else_block) = else_block {
735+
record_rvalue_scope_if_borrow_expr(visitor, else_block, blk_id);
736+
}
737+
}
738+
hir::ExprKind::Match(_, arms, _) => {
739+
for arm in arms {
740+
record_rvalue_scope_if_borrow_expr(visitor, arm.body, blk_id);
741+
}
742+
}
730743
hir::ExprKind::Call(..) | hir::ExprKind::MethodCall(..) => {
731744
// FIXME(@dingxiangfei2009): choose call arguments here
732745
// for candidacy for extended parameter rule application

0 commit comments

Comments
 (0)