Fix drop handling for if let
expressions
MIR lowering for `if let` expressions is now more complicated now that `if let` exists in HIR. This PR adds a scope for the variables bound in an `if let` expression and then uses an approach similar to how we handle loops to ensure that we reliably drop the correct variables.
This commit is contained in:
parent
50171c310c
commit
ff8c0ef0e4
56 changed files with 543 additions and 483 deletions
|
@ -1187,6 +1187,7 @@ pub struct Arm<'hir> {
|
|||
#[derive(Debug, HashStable_Generic)]
|
||||
pub enum Guard<'hir> {
|
||||
If(&'hir Expr<'hir>),
|
||||
// FIXME use ExprKind::Let for this.
|
||||
IfLet(&'hir Pat<'hir>, &'hir Expr<'hir>),
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue