diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-04-04 02:04:44 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2021-04-04 02:04:44 +0100 |
commit | 4c8ee9a53190917f9171a3272c8061d926c2fcbe (patch) | |
tree | 90bb5a1a7917695ae540ff8c2056b7b9c29ddcfd /crates/hir_ty | |
parent | 6b43a518e6d12868ddd749c8ebead343ba823f5b (diff) | |
parent | d8bf9bef800969304440fd2a2a324606a342eaa2 (diff) |
Merge #8322
8322: Access a body's block def maps via a method r=jonas-schievink a=jonas-schievink
bors r+
Co-authored-by: Jonas Schievink <[email protected]>
Diffstat (limited to 'crates/hir_ty')
-rw-r--r-- | crates/hir_ty/src/diagnostics/decl_check.rs | 3 | ||||
-rw-r--r-- | crates/hir_ty/src/tests.rs | 2 |
2 files changed, 2 insertions, 3 deletions
diff --git a/crates/hir_ty/src/diagnostics/decl_check.rs b/crates/hir_ty/src/diagnostics/decl_check.rs index 207c7cb82..1c9f9ede7 100644 --- a/crates/hir_ty/src/diagnostics/decl_check.rs +++ b/crates/hir_ty/src/diagnostics/decl_check.rs | |||
@@ -99,8 +99,7 @@ impl<'a, 'b> DeclValidator<'a, 'b> { | |||
99 | let body = self.db.body(func.into()); | 99 | let body = self.db.body(func.into()); |
100 | 100 | ||
101 | // Recursively validate inner scope items, such as static variables and constants. | 101 | // Recursively validate inner scope items, such as static variables and constants. |
102 | let db = self.db; | 102 | for (_, block_def_map) in body.blocks(self.db.upcast()) { |
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() { | 103 | for (_, module) in block_def_map.modules() { |
105 | for def_id in module.scope.declarations() { | 104 | for def_id in module.scope.declarations() { |
106 | let mut validator = DeclValidator::new(self.db, self.krate, self.sink); | 105 | let mut validator = DeclValidator::new(self.db, self.krate, self.sink); |
diff --git a/crates/hir_ty/src/tests.rs b/crates/hir_ty/src/tests.rs index ad283c1e0..ccfb88c52 100644 --- a/crates/hir_ty/src/tests.rs +++ b/crates/hir_ty/src/tests.rs | |||
@@ -288,7 +288,7 @@ fn visit_module( | |||
288 | } | 288 | } |
289 | 289 | ||
290 | fn visit_body(db: &TestDB, body: &Body, cb: &mut dyn FnMut(DefWithBodyId)) { | 290 | fn visit_body(db: &TestDB, body: &Body, cb: &mut dyn FnMut(DefWithBodyId)) { |
291 | for def_map in body.block_scopes.iter().filter_map(|block| db.block_def_map(*block)) { | 291 | for (_, def_map) in body.blocks(db) { |
292 | for (mod_id, _) in def_map.modules() { | 292 | for (mod_id, _) in def_map.modules() { |
293 | visit_module(db, &def_map, mod_id, cb); | 293 | visit_module(db, &def_map, mod_id, cb); |
294 | } | 294 | } |