Fix scoping for let-else.
This commit is contained in:
parent
e20fabb0d0
commit
73c52bc4dc
@ -221,27 +221,37 @@ fn ast_block_stmts(
|
|||||||
|
|
||||||
let init = &this.thir[*initializer];
|
let init = &this.thir[*initializer];
|
||||||
let initializer_span = init.span;
|
let initializer_span = init.span;
|
||||||
this.declare_bindings(
|
|
||||||
visibility_scope,
|
|
||||||
remainder_span,
|
|
||||||
pattern,
|
|
||||||
ArmHasGuard(false),
|
|
||||||
Some((None, initializer_span)),
|
|
||||||
);
|
|
||||||
this.visit_primary_bindings(
|
|
||||||
pattern,
|
|
||||||
UserTypeProjections::none(),
|
|
||||||
&mut |this, _, _, _, node, span, _, _| {
|
|
||||||
this.storage_live_binding(block, node, span, OutsideGuard, true);
|
|
||||||
this.schedule_drop_for_binding(node, span, OutsideGuard);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
let failure = unpack!(
|
let failure = unpack!(
|
||||||
block = this.in_opt_scope(
|
block = this.in_opt_scope(
|
||||||
opt_destruction_scope.map(|de| (de, source_info)),
|
opt_destruction_scope.map(|de| (de, source_info)),
|
||||||
|this| {
|
|this| {
|
||||||
let scope = (*init_scope, source_info);
|
let scope = (*init_scope, source_info);
|
||||||
this.in_scope(scope, *lint_level, |this| {
|
this.in_scope(scope, *lint_level, |this| {
|
||||||
|
this.declare_bindings(
|
||||||
|
visibility_scope,
|
||||||
|
remainder_span,
|
||||||
|
pattern,
|
||||||
|
ArmHasGuard(false),
|
||||||
|
Some((None, initializer_span)),
|
||||||
|
);
|
||||||
|
this.visit_primary_bindings(
|
||||||
|
pattern,
|
||||||
|
UserTypeProjections::none(),
|
||||||
|
&mut |this, _, _, _, node, span, _, _| {
|
||||||
|
this.storage_live_binding(
|
||||||
|
block,
|
||||||
|
node,
|
||||||
|
span,
|
||||||
|
OutsideGuard,
|
||||||
|
true,
|
||||||
|
);
|
||||||
|
this.schedule_drop_for_binding(
|
||||||
|
node,
|
||||||
|
span,
|
||||||
|
OutsideGuard,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
this.ast_let_else(
|
this.ast_let_else(
|
||||||
block,
|
block,
|
||||||
init,
|
init,
|
||||||
@ -306,7 +316,8 @@ fn ast_block_stmts(
|
|||||||
ArmHasGuard(false),
|
ArmHasGuard(false),
|
||||||
Some((None, initializer_span)),
|
Some((None, initializer_span)),
|
||||||
);
|
);
|
||||||
this.expr_into_pattern(block, &pattern, init) // irrefutable pattern
|
this.expr_into_pattern(block, &pattern, init)
|
||||||
|
// irrefutable pattern
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user