Fix infinite recursion when computing diagnostics for inner items

This commit is contained in:
Jonas Schievink 2021-03-18 20:15:06 +01:00
parent d0805c6444
commit ebd4c8c5df

View File

@ -102,7 +102,7 @@ fn validate_func(&mut self, func: FunctionId) {
let db = self.db; let db = self.db;
for block_def_map in body.block_scopes.iter().filter_map(|block| db.block_def_map(*block)) { 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 (_, 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); let mut validator = DeclValidator::new(self.db, self.krate, self.sink);
validator.validate_item(def_id); validator.validate_item(def_id);
} }
@ -902,4 +902,17 @@ fn ignores_extern_items() {
"#, "#,
); );
} }
#[test]
fn infinite_loop_inner_items() {
check_diagnostics(
r#"
fn qualify() {
mod foo {
use super::*;
}
}
"#,
)
}
} }