@@ -37,9 +37,6 @@ struct ThenElseArgs {
37
37
/// Used as the temp scope for lowering `expr`. If absent (for match guards),
38
38
/// `self.local_scope()` is used.
39
39
temp_scope_override : Option < region:: Scope > ,
40
- /// Scope to pass to [`Builder::break_for_else`]. Must match the scope used
41
- /// by the enclosing call to [`Builder::in_if_then_scope`].
42
- break_scope : region:: Scope ,
43
40
variable_source_info : SourceInfo ,
44
41
/// Forwarded to [`Builder::lower_let_expr`] when lowering [`ExprKind::Let`].
45
42
/// When false (for match guards), `let` bindings won't be declared.
@@ -58,19 +55,13 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
58
55
block : BasicBlock ,
59
56
expr_id : ExprId ,
60
57
temp_scope_override : Option < region:: Scope > ,
61
- break_scope : region:: Scope ,
62
58
variable_source_info : SourceInfo ,
63
59
declare_let_bindings : bool ,
64
60
) -> BlockAnd < ( ) > {
65
61
self . then_else_break_inner (
66
62
block,
67
63
expr_id,
68
- ThenElseArgs {
69
- temp_scope_override,
70
- break_scope,
71
- variable_source_info,
72
- declare_let_bindings,
73
- } ,
64
+ ThenElseArgs { temp_scope_override, variable_source_info, declare_let_bindings } ,
74
65
)
75
66
}
76
67
@@ -97,11 +88,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
97
88
this. then_else_break_inner (
98
89
block,
99
90
lhs,
100
- ThenElseArgs {
101
- break_scope : local_scope,
102
- declare_let_bindings : true ,
103
- ..args
104
- } ,
91
+ ThenElseArgs { declare_let_bindings : true , ..args } ,
105
92
)
106
93
} ) ;
107
94
let rhs_success_block = unpack ! ( this. then_else_break_inner(
@@ -130,14 +117,10 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
130
117
this. then_else_break_inner (
131
118
block,
132
119
arg,
133
- ThenElseArgs {
134
- break_scope : local_scope,
135
- declare_let_bindings : true ,
136
- ..args
137
- } ,
120
+ ThenElseArgs { declare_let_bindings : true , ..args } ,
138
121
)
139
122
} ) ;
140
- this. break_for_else ( success_block, args. break_scope , args . variable_source_info ) ;
123
+ this. break_for_else ( success_block, args. variable_source_info ) ;
141
124
failure_block. unit ( )
142
125
}
143
126
ExprKind :: Scope { region_scope, lint_level, value } => {
@@ -151,7 +134,6 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
151
134
block,
152
135
expr,
153
136
pat,
154
- args. break_scope ,
155
137
Some ( args. variable_source_info . scope ) ,
156
138
args. variable_source_info . span ,
157
139
args. declare_let_bindings ,
@@ -170,7 +152,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
170
152
171
153
let source_info = this. source_info ( expr_span) ;
172
154
this. cfg . terminate ( block, source_info, term) ;
173
- this. break_for_else ( else_block, args . break_scope , source_info) ;
155
+ this. break_for_else ( else_block, source_info) ;
174
156
175
157
then_block. unit ( )
176
158
}
@@ -1911,7 +1893,6 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
1911
1893
mut block : BasicBlock ,
1912
1894
expr_id : ExprId ,
1913
1895
pat : & Pat < ' tcx > ,
1914
- else_target : region:: Scope ,
1915
1896
source_scope : Option < SourceScope > ,
1916
1897
span : Span ,
1917
1898
declare_bindings : bool ,
@@ -1933,7 +1914,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
1933
1914
let expr_place = expr_place_builder. try_to_place ( self ) ;
1934
1915
let opt_expr_place = expr_place. as_ref ( ) . map ( |place| ( Some ( place) , expr_span) ) ;
1935
1916
let otherwise_post_guard_block = otherwise_candidate. pre_binding_block . unwrap ( ) ;
1936
- self . break_for_else ( otherwise_post_guard_block, else_target , self . source_info ( expr_span) ) ;
1917
+ self . break_for_else ( otherwise_post_guard_block, self . source_info ( expr_span) ) ;
1937
1918
1938
1919
if declare_bindings {
1939
1920
self . declare_bindings ( source_scope, pat. span . to ( span) , pat, None , opt_expr_place) ;
@@ -2110,7 +2091,6 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
2110
2091
block,
2111
2092
guard,
2112
2093
None , // Use `self.local_scope()` as the temp scope
2113
- match_scope,
2114
2094
this. source_info ( arm. span ) ,
2115
2095
false , // For guards, `let` bindings are declared separately
2116
2096
)
@@ -2443,7 +2423,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
2443
2423
None ,
2444
2424
true ,
2445
2425
) ;
2446
- this. break_for_else ( failure, * let_else_scope , this. source_info ( initializer_span) ) ;
2426
+ this. break_for_else ( failure, this. source_info ( initializer_span) ) ;
2447
2427
matching. unit ( )
2448
2428
} ) ;
2449
2429
matching. and ( failure)
0 commit comments