Revert "More minimal changes"
This reverts commit fe0dedcb06947317d41a8570b7fff7f8690dcbff.
This commit is contained in:
parent
53deccf069
commit
cc75f0e5da
12 changed files with 103 additions and 82 deletions
|
@ -70,8 +70,9 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
|||
&this.thir[cond],
|
||||
Some(condition_scope),
|
||||
condition_scope,
|
||||
then_expr.span,
|
||||
then_expr.span
|
||||
));
|
||||
|
||||
this.expr_into_dest(destination, then_blk, then_expr)
|
||||
});
|
||||
then_block.and(else_block)
|
||||
|
@ -97,7 +98,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
|||
ExprKind::Let { expr, ref pat } => {
|
||||
let scope = this.local_scope();
|
||||
let (true_block, false_block) = this.in_if_then_scope(scope, |this| {
|
||||
this.lower_let_expr(block, &this.thir[expr], pat, scope, expr_span)
|
||||
this.lower_let_expr(block, &this.thir[expr], pat, scope, None, expr_span)
|
||||
});
|
||||
|
||||
this.cfg.push_assign_constant(
|
||||
|
|
|
@ -41,7 +41,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
|||
expr: &Expr<'tcx>,
|
||||
temp_scope_override: Option<region::Scope>,
|
||||
break_scope: region::Scope,
|
||||
variable_scope_span: Span,
|
||||
variable_span: Span,
|
||||
) -> BlockAnd<()> {
|
||||
let this = self;
|
||||
let expr_span = expr.span;
|
||||
|
@ -53,7 +53,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
|||
&this.thir[lhs],
|
||||
temp_scope_override,
|
||||
break_scope,
|
||||
variable_scope_span,
|
||||
variable_span,
|
||||
));
|
||||
|
||||
let rhs_then_block = unpack!(this.then_else_break(
|
||||
|
@ -61,7 +61,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
|||
&this.thir[rhs],
|
||||
temp_scope_override,
|
||||
break_scope,
|
||||
variable_scope_span,
|
||||
variable_span,
|
||||
));
|
||||
|
||||
rhs_then_block.unit()
|
||||
|
@ -74,12 +74,22 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
|||
&this.thir[value],
|
||||
temp_scope_override,
|
||||
break_scope,
|
||||
variable_scope_span,
|
||||
variable_span,
|
||||
)
|
||||
})
|
||||
}
|
||||
ExprKind::Let { expr, ref pat } => {
|
||||
this.lower_let_expr(block, &this.thir[expr], pat, break_scope, variable_scope_span)
|
||||
let variable_scope =
|
||||
this.new_source_scope(variable_span, LintLevel::Inherited, None);
|
||||
this.source_scope = variable_scope;
|
||||
this.lower_let_expr(
|
||||
block,
|
||||
&this.thir[expr],
|
||||
pat,
|
||||
break_scope,
|
||||
Some(variable_scope),
|
||||
variable_span,
|
||||
)
|
||||
}
|
||||
_ => {
|
||||
let temp_scope = temp_scope_override.unwrap_or_else(|| this.local_scope());
|
||||
|
@ -1773,6 +1783,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
|||
expr: &Expr<'tcx>,
|
||||
pat: &Pat<'tcx>,
|
||||
else_target: region::Scope,
|
||||
source_scope: Option<SourceScope>,
|
||||
span: Span,
|
||||
) -> BlockAnd<()> {
|
||||
let expr_span = expr.span;
|
||||
|
@ -1798,12 +1809,13 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
|||
let otherwise_post_guard_block = otherwise_candidate.pre_binding_block.unwrap();
|
||||
self.break_for_else(otherwise_post_guard_block, else_target, self.source_info(expr_span));
|
||||
|
||||
let scope =
|
||||
self.declare_bindings(None, pat.span.to(span), pat, ArmHasGuard(false), opt_expr_place);
|
||||
|
||||
if let Some(scope) = scope {
|
||||
self.source_scope = scope;
|
||||
}
|
||||
self.declare_bindings(
|
||||
source_scope,
|
||||
pat.span.to(span),
|
||||
pat,
|
||||
ArmHasGuard(false),
|
||||
opt_expr_place,
|
||||
);
|
||||
|
||||
let post_guard_block = self.bind_pattern(
|
||||
self.source_info(pat.span),
|
||||
|
@ -1981,7 +1993,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
|||
Guard::IfLet(ref pat, scrutinee) => {
|
||||
let s = &this.thir[scrutinee];
|
||||
guard_span = s.span;
|
||||
this.lower_let_expr(block, s, pat, match_scope, arm_span)
|
||||
this.lower_let_expr(block, s, pat, match_scope, None, arm_span)
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue