Skip to content

Commit 0cb46a9

Browse files
jonas-schievinkJonas Schievink
authored andcommitted
Use body.block_scopes to validate inner items
1 parent c12f7be commit 0cb46a9

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

crates/hir_ty/src/diagnostics/decl_check.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,14 @@ impl<'a, 'b> DeclValidator<'a, 'b> {
9999
let body = self.db.body(func.into());
100100

101101
// Recursively validate inner scope items, such as static variables and constants.
102-
for (item_id, _) in body.item_scope.values() {
103-
let mut validator = DeclValidator::new(self.db, self.krate, self.sink);
104-
validator.validate_item(item_id);
102+
let db = self.db;
103+
for block_def_map in body.block_scopes.iter().filter_map(|block| db.block_def_map(*block)) {
104+
for (_, module) in block_def_map.modules() {
105+
for (def_id, _) in module.scope.values() {
106+
let mut validator = DeclValidator::new(self.db, self.krate, self.sink);
107+
validator.validate_item(def_id);
108+
}
109+
}
105110
}
106111

107112
// Check whether non-snake case identifiers are allowed for this function.

0 commit comments

Comments
 (0)