diff options
author | uHOOCCOOHu <[email protected]> | 2019-09-11 19:01:07 +0100 |
---|---|---|
committer | uHOOCCOOHu <[email protected]> | 2019-09-15 12:40:32 +0100 |
commit | 4926bed42680d329f906be93450bec6b2ba0e99b (patch) | |
tree | 455c0bc9d839a18fffda6d018bf41d1c58ebfa52 /crates/ra_hir/src/source_binder.rs | |
parent | 2d79a1ad83cc39075c7c9e3230973013c8c58b17 (diff) |
Support path starting with a type
Diffstat (limited to 'crates/ra_hir/src/source_binder.rs')
-rw-r--r-- | crates/ra_hir/src/source_binder.rs | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/crates/ra_hir/src/source_binder.rs b/crates/ra_hir/src/source_binder.rs index cff55b640..59053cda3 100644 --- a/crates/ra_hir/src/source_binder.rs +++ b/crates/ra_hir/src/source_binder.rs | |||
@@ -26,7 +26,7 @@ use crate::{ | |||
26 | }, | 26 | }, |
27 | ids::LocationCtx, | 27 | ids::LocationCtx, |
28 | name, | 28 | name, |
29 | path::{PathKind, PathSegment}, | 29 | path::PathKind, |
30 | resolve::{ScopeDef, TypeNs, ValueNs}, | 30 | resolve::{ScopeDef, TypeNs, ValueNs}, |
31 | ty::method_resolution::implements_trait, | 31 | ty::method_resolution::implements_trait, |
32 | AsName, AstId, Const, Crate, DefWithBody, Either, Enum, Function, HasBody, HirFileId, MacroDef, | 32 | AsName, AstId, Const, Crate, DefWithBody, Either, Enum, Function, HasBody, HirFileId, MacroDef, |
@@ -433,14 +433,10 @@ impl SourceAnalyzer { | |||
433 | /// Checks that particular type `ty` implements `std::future::Future`. | 433 | /// Checks that particular type `ty` implements `std::future::Future`. |
434 | /// This function is used in `.await` syntax completion. | 434 | /// This function is used in `.await` syntax completion. |
435 | pub fn impls_future(&self, db: &impl HirDatabase, ty: Ty) -> bool { | 435 | pub fn impls_future(&self, db: &impl HirDatabase, ty: Ty) -> bool { |
436 | let std_future_path = Path { | 436 | let std_future_path = Path::from_simple_segments( |
437 | kind: PathKind::Abs, | 437 | PathKind::Abs, |
438 | segments: vec![ | 438 | vec![name::STD, name::FUTURE_MOD, name::FUTURE_TYPE], |
439 | PathSegment { name: name::STD, args_and_bindings: None }, | 439 | ); |
440 | PathSegment { name: name::FUTURE_MOD, args_and_bindings: None }, | ||
441 | PathSegment { name: name::FUTURE_TYPE, args_and_bindings: None }, | ||
442 | ], | ||
443 | }; | ||
444 | 440 | ||
445 | let std_future_trait = match self.resolver.resolve_known_trait(db, &std_future_path) { | 441 | let std_future_trait = match self.resolver.resolve_known_trait(db, &std_future_path) { |
446 | Some(it) => it, | 442 | Some(it) => it, |