From ebd4c8c5dfd07b27f0cd083bc34b619ede3a6678 Mon Sep 17 00:00:00 2001 From: Jonas Schievink Date: Thu, 18 Mar 2021 20:15:06 +0100 Subject: Fix infinite recursion when computing diagnostics for inner items --- crates/hir_ty/src/diagnostics/decl_check.rs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/crates/hir_ty/src/diagnostics/decl_check.rs b/crates/hir_ty/src/diagnostics/decl_check.rs index bfe239793..33a0f4d7d 100644 --- a/crates/hir_ty/src/diagnostics/decl_check.rs +++ b/crates/hir_ty/src/diagnostics/decl_check.rs @@ -102,7 +102,7 @@ impl<'a, 'b> DeclValidator<'a, 'b> { 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() { + for def_id in module.scope.declarations() { let mut validator = DeclValidator::new(self.db, self.krate, self.sink); validator.validate_item(def_id); } @@ -902,4 +902,17 @@ extern { "#, ); } + + #[test] + fn infinite_loop_inner_items() { + check_diagnostics( + r#" +fn qualify() { + mod foo { + use super::*; + } +} + "#, + ) + } } -- cgit v1.2.3