Substitution::single -> from1

This commit is contained in:
Florian Diebold 2021-04-05 21:17:35 +02:00
parent 788533d380
commit 2f5a77658b
4 changed files with 17 additions and 14 deletions

View file

@ -180,7 +180,8 @@ impl<'a> InferenceContext<'a> {
let inner_ty = self.infer_expr(*body, &Expectation::none());
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, Substitution::single(inner_ty)).intern(&Interner)
TyKind::OpaqueType(opaque_ty_id, Substitution::from1(&Interner, inner_ty))
.intern(&Interner)
}
Expr::Loop { body, label } => {
self.breakables.push(BreakableContext {
@ -266,7 +267,8 @@ impl<'a> InferenceContext<'a> {
.intern(&Interner);
let closure_id = self.db.intern_closure((self.owner, tgt_expr)).into();
let closure_ty =
TyKind::Closure(closure_id, Substitution::single(sig_ty)).intern(&Interner);
TyKind::Closure(closure_id, Substitution::from1(&Interner, sig_ty))
.intern(&Interner);
// Eagerly try to relate the closure type with the expected
// type, otherwise we often won't have enough information to