Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir_def/src/body/scope.rs')
-rw-r--r--crates/hir_def/src/body/scope.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/crates/hir_def/src/body/scope.rs b/crates/hir_def/src/body/scope.rs
index 5d9dd73a12..8a48ad9199 100644
--- a/crates/hir_def/src/body/scope.rs
+++ b/crates/hir_def/src/body/scope.rs
@@ -149,11 +149,15 @@ fn compute_block_scopes(
) {
for stmt in statements {
match stmt {
- Statement::Let { pat, initializer, .. } => {
+ Statement::Let { pat, initializer, else_branch, .. } => {
if let Some(expr) = initializer {
scopes.set_scope(*expr, scope);
compute_expr_scopes(*expr, body, scopes, scope);
}
+ if let Some(expr) = else_branch {
+ scopes.set_scope(*expr, scope);
+ compute_expr_scopes(*expr, body, scopes, scope);
+ }
scope = scopes.new_scope(scope);
scopes.add_bindings(body, scope, *pat);
}