@@ -145,27 +145,28 @@ fn compute_block_scopes(
145
145
tail : Option < ExprId > ,
146
146
body : & Body ,
147
147
scopes : & mut ExprScopes ,
148
- mut scope : ScopeId ,
148
+ scope : & mut ScopeId ,
149
149
) {
150
150
for stmt in statements {
151
151
match stmt {
152
152
Statement :: Let { pat, initializer, else_branch, .. } => {
153
153
if let Some ( expr) = initializer {
154
- compute_expr_scopes ( * expr, body, scopes, & mut scope) ;
154
+ compute_expr_scopes ( * expr, body, scopes, scope) ;
155
155
}
156
156
if let Some ( expr) = else_branch {
157
- compute_expr_scopes ( * expr, body, scopes, & mut scope) ;
157
+ compute_expr_scopes ( * expr, body, scopes, scope) ;
158
158
}
159
- scope = scopes. new_scope ( scope) ;
160
- scopes. add_bindings ( body, scope, * pat) ;
159
+
160
+ * scope = scopes. new_scope ( * scope) ;
161
+ scopes. add_bindings ( body, * scope, * pat) ;
161
162
}
162
163
Statement :: Expr { expr, .. } => {
163
- compute_expr_scopes ( * expr, body, scopes, & mut scope) ;
164
+ compute_expr_scopes ( * expr, body, scopes, scope) ;
164
165
}
165
166
}
166
167
}
167
168
if let Some ( expr) = tail {
168
- compute_expr_scopes ( expr, body, scopes, & mut scope) ;
169
+ compute_expr_scopes ( expr, body, scopes, scope) ;
169
170
}
170
171
}
171
172
@@ -176,14 +177,14 @@ fn compute_expr_scopes(expr: ExprId, body: &Body, scopes: &mut ExprScopes, scope
176
177
scopes. set_scope ( expr, * scope) ;
177
178
match & body[ expr] {
178
179
Expr :: MacroStmts { statements, tail } => {
179
- compute_block_scopes ( statements, * tail, body, scopes, * scope) ;
180
+ compute_block_scopes ( statements, * tail, body, scopes, scope) ;
180
181
}
181
182
Expr :: Block { statements, tail, id, label } => {
182
- let scope = scopes. new_block_scope ( * scope, * id, make_label ( label) ) ;
183
+ let mut scope = scopes. new_block_scope ( * scope, * id, make_label ( label) ) ;
183
184
// Overwrite the old scope for the block expr, so that every block scope can be found
184
185
// via the block itself (important for blocks that only contain items, no expressions).
185
186
scopes. set_scope ( expr, scope) ;
186
- compute_block_scopes ( statements, * tail, body, scopes, scope) ;
187
+ compute_block_scopes ( statements, * tail, body, scopes, & mut scope) ;
187
188
}
188
189
Expr :: For { iterable, pat, body : body_expr, label } => {
189
190
compute_expr_scopes ( * iterable, body, scopes, scope) ;
0 commit comments