From 0cb46a9e8d20a5f843e3a7fa6387779d1ff68c3b Mon Sep 17 00:00:00 2001 From: Jonas Schievink Date: Fri, 5 Mar 2021 14:15:26 +0100 Subject: Use `body.block_scopes` to validate inner items --- crates/hir_ty/src/diagnostics/decl_check.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'crates/hir_ty') diff --git a/crates/hir_ty/src/diagnostics/decl_check.rs b/crates/hir_ty/src/diagnostics/decl_check.rs index e230f9765..3605ca581 100644 --- a/crates/hir_ty/src/diagnostics/decl_check.rs +++ b/crates/hir_ty/src/diagnostics/decl_check.rs @@ -99,9 +99,14 @@ impl<'a, 'b> DeclValidator<'a, 'b> { let body = self.db.body(func.into()); // Recursively validate inner scope items, such as static variables and constants. - for (item_id, _) in body.item_scope.values() { - let mut validator = DeclValidator::new(self.db, self.krate, self.sink); - validator.validate_item(item_id); + let db = self.db; + for block_def_map in body.block_scopes.iter().filter_map(|block| db.block_def_map(*block)) { + for (_, module) in block_def_map.modules() { + for (def_id, _) in module.scope.values() { + let mut validator = DeclValidator::new(self.db, self.krate, self.sink); + validator.validate_item(def_id); + } + } } // Check whether non-snake case identifiers are allowed for this function. -- cgit v1.2.3