@@ -145,27 +145,28 @@ fn compute_block_scopes(
145145 tail : Option < ExprId > ,
146146 body : & Body ,
147147 scopes : & mut ExprScopes ,
148- mut scope : ScopeId ,
148+ scope : & mut ScopeId ,
149149) {
150150 for stmt in statements {
151151 match stmt {
152152 Statement :: Let { pat, initializer, else_branch, .. } => {
153153 if let Some ( expr) = initializer {
154- compute_expr_scopes ( * expr, body, scopes, & mut scope) ;
154+ compute_expr_scopes ( * expr, body, scopes, scope) ;
155155 }
156156 if let Some ( expr) = else_branch {
157- compute_expr_scopes ( * expr, body, scopes, & mut scope) ;
157+ compute_expr_scopes ( * expr, body, scopes, scope) ;
158158 }
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) ;
161162 }
162163 Statement :: Expr { expr, .. } => {
163- compute_expr_scopes ( * expr, body, scopes, & mut scope) ;
164+ compute_expr_scopes ( * expr, body, scopes, scope) ;
164165 }
165166 }
166167 }
167168 if let Some ( expr) = tail {
168- compute_expr_scopes ( expr, body, scopes, & mut scope) ;
169+ compute_expr_scopes ( expr, body, scopes, scope) ;
169170 }
170171}
171172
@@ -176,14 +177,14 @@ fn compute_expr_scopes(expr: ExprId, body: &Body, scopes: &mut ExprScopes, scope
176177 scopes. set_scope ( expr, * scope) ;
177178 match & body[ expr] {
178179 Expr :: MacroStmts { statements, tail } => {
179- compute_block_scopes ( statements, * tail, body, scopes, * scope) ;
180+ compute_block_scopes ( statements, * tail, body, scopes, scope) ;
180181 }
181182 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) ) ;
183184 // Overwrite the old scope for the block expr, so that every block scope can be found
184185 // via the block itself (important for blocks that only contain items, no expressions).
185186 scopes. set_scope ( expr, scope) ;
186- compute_block_scopes ( statements, * tail, body, scopes, scope) ;
187+ compute_block_scopes ( statements, * tail, body, scopes, & mut scope) ;
187188 }
188189 Expr :: For { iterable, pat, body : body_expr, label } => {
189190 compute_expr_scopes ( * iterable, body, scopes, scope) ;
0 commit comments