aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_ty/src/lower.rs
diff options
context:
space:
mode:
authorFlorian Diebold <[email protected]>2021-04-03 20:29:49 +0100
committerFlorian Diebold <[email protected]>2021-04-04 12:16:38 +0100
commit620769f32276bb7e8c580eae2c91ee535a06d9f8 (patch)
tree3d4541f18206d9ad538f8255e00d4632058d9af5 /crates/hir_ty/src/lower.rs
parente6f007d9a8e676c4af5731001b211ca7a52bce16 (diff)
Add TyBuilder::adt
Diffstat (limited to 'crates/hir_ty/src/lower.rs')
-rw-r--r--crates/hir_ty/src/lower.rs9
1 files changed, 5 insertions, 4 deletions
diff --git a/crates/hir_ty/src/lower.rs b/crates/hir_ty/src/lower.rs
index e60d7c730..5e2024f0a 100644
--- a/crates/hir_ty/src/lower.rs
+++ b/crates/hir_ty/src/lower.rs
@@ -36,7 +36,7 @@ use crate::{
36 AliasEq, AliasTy, Binders, BoundVar, CallableSig, DebruijnIndex, DynTy, FnPointer, FnSig, 36 AliasEq, AliasTy, Binders, BoundVar, CallableSig, DebruijnIndex, DynTy, FnPointer, FnSig,
37 ImplTraitId, OpaqueTy, PolyFnSig, ProjectionTy, QuantifiedWhereClause, QuantifiedWhereClauses, 37 ImplTraitId, OpaqueTy, PolyFnSig, ProjectionTy, QuantifiedWhereClause, QuantifiedWhereClauses,
38 ReturnTypeImplTrait, ReturnTypeImplTraits, Substitution, TraitEnvironment, TraitRef, Ty, 38 ReturnTypeImplTrait, ReturnTypeImplTraits, Substitution, TraitEnvironment, TraitRef, Ty,
39 TyKind, TypeWalk, WhereClause, 39 TyBuilder, TyKind, TypeWalk, WhereClause,
40}; 40};
41 41
42#[derive(Debug)] 42#[derive(Debug)]
@@ -1141,9 +1141,10 @@ fn type_for_enum_variant_constructor(db: &dyn HirDatabase, def: EnumVariantId) -
1141} 1141}
1142 1142
1143fn type_for_adt(db: &dyn HirDatabase, adt: AdtId) -> Binders<Ty> { 1143fn type_for_adt(db: &dyn HirDatabase, adt: AdtId) -> Binders<Ty> {
1144 let generics = generics(db.upcast(), adt.into()); 1144 let b = TyBuilder::adt(db, adt);
1145 let substs = Substitution::bound_vars(&generics, DebruijnIndex::INNERMOST); 1145 let num_binders = b.remaining();
1146 Binders::new(substs.len(&Interner), Ty::adt_ty(adt, substs)) 1146 let ty = b.fill_with_bound_vars(DebruijnIndex::INNERMOST, 0).build();
1147 Binders::new(num_binders, ty)
1147} 1148}
1148 1149
1149fn type_for_type_alias(db: &dyn HirDatabase, t: TypeAliasId) -> Binders<Ty> { 1150fn type_for_type_alias(db: &dyn HirDatabase, t: TypeAliasId) -> Binders<Ty> {