aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/code_model.rs
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2019-11-01 19:03:05 +0000
committerGitHub <[email protected]>2019-11-01 19:03:05 +0000
commit9db97820f4c1c38110175f4efda2702356a4199a (patch)
treef560ab731b9da35902d3da720e19731b51ab62df /crates/ra_hir/src/code_model.rs
parented5212e1ac71e959d802a9a7ad28d06c8b18e022 (diff)
parent895238088417b292e35705e72182ff8cc3ab6f63 (diff)
Merge #2151
2151: Resolve (and complete) trait calls like `Vec::default()` r=flodiebold a=flodiebold Similar to rustc, we do this using the same code as the method call resolution, just without doing autoderef (and considering more potential candidates). (Btw, we currently don't complete methods with `self` in path notation, even though they'd be legal to use, so maybe we should -- on the other hand, that will usually not be the most interesting completions...) Co-authored-by: Florian Diebold <[email protected]>
Diffstat (limited to 'crates/ra_hir/src/code_model.rs')
-rw-r--r--crates/ra_hir/src/code_model.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/crates/ra_hir/src/code_model.rs b/crates/ra_hir/src/code_model.rs
index ae6ef7606..c97ea18a2 100644
--- a/crates/ra_hir/src/code_model.rs
+++ b/crates/ra_hir/src/code_model.rs
@@ -1053,4 +1053,13 @@ impl AssocItem {
1053 AssocItem::TypeAlias(t) => t.module(db), 1053 AssocItem::TypeAlias(t) => t.module(db),
1054 } 1054 }
1055 } 1055 }
1056
1057 pub fn container(self, db: &impl DefDatabase) -> Container {
1058 match self {
1059 AssocItem::Function(f) => f.container(db),
1060 AssocItem::Const(c) => c.container(db),
1061 AssocItem::TypeAlias(t) => t.container(db),
1062 }
1063 .expect("AssocItem without container")
1064 }
1056} 1065}