From 251ef93ac3bbb138a2eedf6090f2f56f1a15d898 Mon Sep 17 00:00:00 2001 From: oxalica Date: Thu, 10 Sep 2020 20:01:23 +0800 Subject: Implement async blocks --- crates/hir/src/code_model.rs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'crates/hir/src') diff --git a/crates/hir/src/code_model.rs b/crates/hir/src/code_model.rs index c2fc819e7..613b35afd 100644 --- a/crates/hir/src/code_model.rs +++ b/crates/hir/src/code_model.rs @@ -1283,6 +1283,8 @@ impl Type { /// Checks that particular type `ty` implements `std::future::Future`. /// This function is used in `.await` syntax completion. pub fn impls_future(&self, db: &dyn HirDatabase) -> bool { + // No special case for the type of async block, since Chalk can figure it out. + let krate = self.krate; let std_future_trait = -- cgit v1.2.3 From 529c369c9bc15a73e7a03260eca84ccef99ac281 Mon Sep 17 00:00:00 2001 From: oxalica Date: Sat, 12 Sep 2020 01:03:28 +0800 Subject: Fix type walking about type of async block --- crates/hir/src/code_model.rs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'crates/hir/src') diff --git a/crates/hir/src/code_model.rs b/crates/hir/src/code_model.rs index 613b35afd..7a9747fc7 100644 --- a/crates/hir/src/code_model.rs +++ b/crates/hir/src/code_model.rs @@ -1602,6 +1602,11 @@ impl Type { cb(type_.derived(ty.clone())); } } + TypeCtor::OpaqueType(..) => { + if let Some(bounds) = ty.impl_trait_bounds(db) { + walk_bounds(db, &type_.derived(ty.clone()), &bounds, cb); + } + } _ => (), } -- cgit v1.2.3