@@ -194,6 +194,16 @@ fn compute_expr_scopes(expr: ExprId, body: &Body, scopes: &mut ExprScopes, scope
194
194
scopes. set_scope ( expr, scope) ;
195
195
compute_block_scopes ( statements, * tail, body, scopes, & mut scope) ;
196
196
}
197
+ Expr :: Unsafe { id, statements, tail }
198
+ | Expr :: Async { id, statements, tail }
199
+ | Expr :: Const { id, statements, tail }
200
+ | Expr :: TryBlock { id, statements, tail } => {
201
+ let mut scope = scopes. new_block_scope ( * scope, * id, None ) ;
202
+ // Overwrite the old scope for the block expr, so that every block scope can be found
203
+ // via the block itself (important for blocks that only contain items, no expressions).
204
+ scopes. set_scope ( expr, scope) ;
205
+ compute_block_scopes ( statements, * tail, body, scopes, & mut scope) ;
206
+ }
197
207
Expr :: For { iterable, pat, body : body_expr, label } => {
198
208
compute_expr_scopes ( * iterable, body, scopes, scope) ;
199
209
let mut scope = scopes. new_labeled_scope ( * scope, make_label ( label) ) ;
0 commit comments