aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_ty/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/hir_ty/src/lib.rs')
-rw-r--r--crates/hir_ty/src/lib.rs16
1 files changed, 9 insertions, 7 deletions
diff --git a/crates/hir_ty/src/lib.rs b/crates/hir_ty/src/lib.rs
index d1c018283..d6ff968f0 100644
--- a/crates/hir_ty/src/lib.rs
+++ b/crates/hir_ty/src/lib.rs
@@ -54,6 +54,7 @@ pub type ForeignDefId = chalk_ir::ForeignDefId<Interner>;
54pub type AssocTypeId = chalk_ir::AssocTypeId<Interner>; 54pub type AssocTypeId = chalk_ir::AssocTypeId<Interner>;
55pub type FnDefId = chalk_ir::FnDefId<Interner>; 55pub type FnDefId = chalk_ir::FnDefId<Interner>;
56pub type ClosureId = chalk_ir::ClosureId<Interner>; 56pub type ClosureId = chalk_ir::ClosureId<Interner>;
57pub type OpaqueTyId = chalk_ir::OpaqueTyId<Interner>;
57pub type PlaceholderIndex = chalk_ir::PlaceholderIndex; 58pub type PlaceholderIndex = chalk_ir::PlaceholderIndex;
58 59
59#[derive(Clone, PartialEq, Eq, Debug, Hash)] 60#[derive(Clone, PartialEq, Eq, Debug, Hash)]
@@ -875,8 +876,8 @@ impl Ty {
875 pub fn impl_trait_bounds(&self, db: &dyn HirDatabase) -> Option<Vec<GenericPredicate>> { 876 pub fn impl_trait_bounds(&self, db: &dyn HirDatabase) -> Option<Vec<GenericPredicate>> {
876 match self.interned(&Interner) { 877 match self.interned(&Interner) {
877 TyKind::OpaqueType(opaque_ty_id, ..) => { 878 TyKind::OpaqueType(opaque_ty_id, ..) => {
878 match opaque_ty_id { 879 match db.lookup_intern_impl_trait_id((*opaque_ty_id).into()) {
879 OpaqueTyId::AsyncBlockTypeImplTrait(def, _expr) => { 880 ImplTraitId::AsyncBlockTypeImplTrait(def, _expr) => {
880 let krate = def.module(db.upcast()).krate(); 881 let krate = def.module(db.upcast()).krate();
881 if let Some(future_trait) = db 882 if let Some(future_trait) = db
882 .lang_item(krate, "future_trait".into()) 883 .lang_item(krate, "future_trait".into())
@@ -894,12 +895,13 @@ impl Ty {
894 None 895 None
895 } 896 }
896 } 897 }
897 OpaqueTyId::ReturnTypeImplTrait(..) => None, 898 ImplTraitId::ReturnTypeImplTrait(..) => None,
898 } 899 }
899 } 900 }
900 TyKind::Alias(AliasTy::Opaque(opaque_ty)) => { 901 TyKind::Alias(AliasTy::Opaque(opaque_ty)) => {
901 let predicates = match opaque_ty.opaque_ty_id { 902 let predicates = match db.lookup_intern_impl_trait_id(opaque_ty.opaque_ty_id.into())
902 OpaqueTyId::ReturnTypeImplTrait(func, idx) => { 903 {
904 ImplTraitId::ReturnTypeImplTrait(func, idx) => {
903 db.return_type_impl_traits(func).map(|it| { 905 db.return_type_impl_traits(func).map(|it| {
904 let data = (*it) 906 let data = (*it)
905 .as_ref() 907 .as_ref()
@@ -908,7 +910,7 @@ impl Ty {
908 }) 910 })
909 } 911 }
910 // It always has an parameter for Future::Output type. 912 // It always has an parameter for Future::Output type.
911 OpaqueTyId::AsyncBlockTypeImplTrait(..) => unreachable!(), 913 ImplTraitId::AsyncBlockTypeImplTrait(..) => unreachable!(),
912 }; 914 };
913 915
914 predicates.map(|it| it.value) 916 predicates.map(|it| it.value)
@@ -1123,7 +1125,7 @@ impl<T: TypeWalk> TypeWalk for Vec<T> {
1123} 1125}
1124 1126
1125#[derive(Copy, Clone, PartialEq, Eq, Debug, Hash)] 1127#[derive(Copy, Clone, PartialEq, Eq, Debug, Hash)]
1126pub enum OpaqueTyId { 1128pub enum ImplTraitId {
1127 ReturnTypeImplTrait(hir_def::FunctionId, u16), 1129 ReturnTypeImplTrait(hir_def::FunctionId, u16),
1128 AsyncBlockTypeImplTrait(hir_def::DefWithBodyId, ExprId), 1130 AsyncBlockTypeImplTrait(hir_def::DefWithBodyId, ExprId),
1129} 1131}