aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_def
diff options
context:
space:
mode:
authorJonas Schievink <[email protected]>2021-03-09 17:18:35 +0000
committerJonas Schievink <[email protected]>2021-03-09 17:27:23 +0000
commit12f6bdcfd9fe1393887b3be0d0329fcf11492e75 (patch)
tree88a83002c062b99d7a5dbbc61814c5b051b0c8b6 /crates/hir_def
parent6be4f30cae93479c19dfe313ab13b8ffd3f7a27f (diff)
Check ancestor maps when computing traits in scope
Diffstat (limited to 'crates/hir_def')
-rw-r--r--crates/hir_def/src/resolver.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/crates/hir_def/src/resolver.rs b/crates/hir_def/src/resolver.rs
index 77ff21739..28b184f7c 100644
--- a/crates/hir_def/src/resolver.rs
+++ b/crates/hir_def/src/resolver.rs
@@ -342,6 +342,16 @@ impl Resolver {
342 traits.extend(prelude_def_map[prelude.local_id].scope.traits()); 342 traits.extend(prelude_def_map[prelude.local_id].scope.traits());
343 } 343 }
344 traits.extend(m.def_map[m.module_id].scope.traits()); 344 traits.extend(m.def_map[m.module_id].scope.traits());
345
346 // Add all traits that are in scope because of the containing DefMaps
347 m.def_map.with_ancestor_maps(db, m.module_id, &mut |def_map, module| {
348 if let Some(prelude) = def_map.prelude() {
349 let prelude_def_map = prelude.def_map(db);
350 traits.extend(prelude_def_map[prelude.local_id].scope.traits());
351 }
352 traits.extend(def_map[module].scope.traits());
353 None::<()>
354 });
345 } 355 }
346 } 356 }
347 traits 357 traits