@@ -194,6 +194,16 @@ fn compute_expr_scopes(expr: ExprId, body: &Body, scopes: &mut ExprScopes, scope
194194 scopes. set_scope ( expr, scope) ;
195195 compute_block_scopes ( statements, * tail, body, scopes, & mut scope) ;
196196 }
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+ }
197207 Expr :: For { iterable, pat, body : body_expr, label } => {
198208 compute_expr_scopes ( * iterable, body, scopes, scope) ;
199209 let mut scope = scopes. new_labeled_scope ( * scope, make_label ( label) ) ;
0 commit comments