Use chalk_ir::OpaqueTyId

This commit is contained in:
Florian Diebold 2021-03-13 20:05:47 +01:00
parent 1bf6b7360c
commit b035c314b4
7 changed files with 53 additions and 63 deletions

View file

@ -21,8 +21,8 @@ use crate::{
to_assoc_type_id,
traits::{chalk::from_chalk, FnTrait, InEnvironment},
utils::{generics, variant_data, Generics},
AdtId, Binders, CallableDefId, FnPointer, FnSig, Interner, Obligation, OpaqueTyId, Rawness,
Scalar, Substs, TraitRef, Ty, TyKind,
AdtId, Binders, CallableDefId, FnPointer, FnSig, Interner, Obligation, Rawness, Scalar, Substs,
TraitRef, Ty, TyKind,
};
use super::{
@ -179,7 +179,8 @@ impl<'a> InferenceContext<'a> {
// Use the first type parameter as the output type of future.
// existenail type AsyncBlockImplTrait<InnerType>: Future<Output = InnerType>
let inner_ty = self.infer_expr(*body, &Expectation::none());
let opaque_ty_id = OpaqueTyId::AsyncBlockTypeImplTrait(self.owner, *body);
let impl_trait_id = crate::ImplTraitId::AsyncBlockTypeImplTrait(self.owner, *body);
let opaque_ty_id = self.db.intern_impl_trait_id(impl_trait_id).into();
TyKind::OpaqueType(opaque_ty_id, Substs::single(inner_ty)).intern(&Interner)
}
Expr::Loop { body, label } => {