From 1d74ef1d989b3d37f3f08d32e88670ee0f1f7ab6 Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Tue, 8 Jun 2021 16:50:10 +0200 Subject: Don't complete values in type position --- crates/hir/src/lib.rs | 12 ++++++++++++ crates/hir/src/semantics.rs | 3 ++- 2 files changed, 14 insertions(+), 1 deletion(-) (limited to 'crates/hir') diff --git a/crates/hir/src/lib.rs b/crates/hir/src/lib.rs index c2b68a853..589641760 100644 --- a/crates/hir/src/lib.rs +++ b/crates/hir/src/lib.rs @@ -2496,6 +2496,18 @@ impl ScopeDef { items } + + pub fn is_value_def(&self) -> bool { + matches!( + self, + ScopeDef::ModuleDef(ModuleDef::Function(_)) + | ScopeDef::ModuleDef(ModuleDef::Variant(_)) + | ScopeDef::ModuleDef(ModuleDef::Const(_)) + | ScopeDef::ModuleDef(ModuleDef::Static(_)) + | ScopeDef::GenericParam(GenericParam::ConstParam(_)) + | ScopeDef::Local(_) + ) + } } impl From for ScopeDef { diff --git a/crates/hir/src/semantics.rs b/crates/hir/src/semantics.rs index 2d08a7704..827e23e2b 100644 --- a/crates/hir/src/semantics.rs +++ b/crates/hir/src/semantics.rs @@ -35,8 +35,9 @@ pub enum PathResolution { Def(ModuleDef), /// A local binding (only value namespace) Local(Local), - /// A generic parameter + /// A type parameter TypeParam(TypeParam), + /// A const parameter ConstParam(ConstParam), SelfType(Impl), Macro(MacroDef), -- cgit v1.2.3