aboutsummaryrefslogtreecommitdiff
path: root/crates/hir
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2021-06-11 18:33:34 +0100
committerGitHub <[email protected]>2021-06-11 18:33:34 +0100
commit21d441623574e5d5ffa2d8f1add7582c7231e109 (patch)
tree032d077edef18ae5cda7ae3c30bec8980a46de05 /crates/hir
parent6ac3e666b7c62a9097d10c52636cfe75e7851806 (diff)
parent48f65b3b157a5b974be6252dd8fc9ffc158d4217 (diff)
Merge #9218
9218: Item search now respects trait impl items r=Veykril a=Veykril Fixes #2977 Co-authored-by: Lukas Wirth <[email protected]>
Diffstat (limited to 'crates/hir')
-rw-r--r--crates/hir/src/lib.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/crates/hir/src/lib.rs b/crates/hir/src/lib.rs
index b9c1dc44d..0bb3767c1 100644
--- a/crates/hir/src/lib.rs
+++ b/crates/hir/src/lib.rs
@@ -1451,6 +1451,20 @@ impl AssocItem {
1451 _ => None, 1451 _ => None,
1452 } 1452 }
1453 } 1453 }
1454
1455 pub fn containing_trait_impl(self, db: &dyn HirDatabase) -> Option<Trait> {
1456 match self.container(db) {
1457 AssocItemContainer::Impl(i) => i.trait_(db),
1458 _ => None,
1459 }
1460 }
1461
1462 pub fn containing_trait_or_trait_impl(self, db: &dyn HirDatabase) -> Option<Trait> {
1463 match self.container(db) {
1464 AssocItemContainer::Trait(t) => Some(t),
1465 AssocItemContainer::Impl(i) => i.trait_(db),
1466 }
1467 }
1454} 1468}
1455 1469
1456impl HasVisibility for AssocItem { 1470impl HasVisibility for AssocItem {