3
3
use chalk_ir:: {
4
4
AdtId , DebruijnIndex , Scalar ,
5
5
cast:: { Cast , CastTo , Caster } ,
6
- fold:: TypeFoldable ,
7
- interner:: HasInterner ,
8
6
} ;
9
7
use hir_def:: { GenericDefId , GenericParamId , TraitId , TypeAliasId , builtin_type:: BuiltinType } ;
10
8
use smallvec:: SmallVec ;
11
9
12
10
use crate :: {
13
- Binders , BoundVar , CallableSig , GenericArg , GenericArgData , Interner , ProjectionTy ,
14
- Substitution , TraitRef , Ty , TyDefId , TyExt , TyKind , consteval:: unknown_const_as_generic,
15
- db:: HirDatabase , error_lifetime, generics:: generics, infer:: unify:: InferenceTable , primitive,
16
- to_assoc_type_id, to_chalk_trait_id,
11
+ BoundVar , CallableSig , GenericArg , GenericArgData , Interner , ProjectionTy , Substitution ,
12
+ TraitRef , Ty , TyDefId , TyExt , TyKind ,
13
+ consteval:: unknown_const_as_generic,
14
+ db:: HirDatabase ,
15
+ error_lifetime,
16
+ generics:: generics,
17
+ infer:: unify:: InferenceTable ,
18
+ next_solver:: { DbInterner , EarlyBinder , mapping:: ChalkToNextSolver } ,
19
+ primitive, to_assoc_type_id, to_chalk_trait_id,
17
20
} ;
18
21
19
22
#[ derive( Debug , Clone , PartialEq , Eq ) ]
@@ -345,19 +348,20 @@ impl TyBuilder<TypeAliasId> {
345
348
}
346
349
}
347
350
348
- impl < T : HasInterner < Interner = Interner > + TypeFoldable < Interner > > TyBuilder < Binders < T > > {
349
- pub fn build ( self ) -> T {
351
+ impl < ' db , T : rustc_type_ir :: TypeFoldable < DbInterner < ' db > > > TyBuilder < EarlyBinder < ' db , T > > {
352
+ pub fn build ( self , interner : DbInterner < ' db > ) -> T {
350
353
let ( b, subst) = self . build_internal ( ) ;
351
- b. substitute ( Interner , & subst)
354
+ let args: crate :: next_solver:: GenericArgs < ' db > = subst. to_nextsolver ( interner) ;
355
+ b. instantiate ( interner, args)
352
356
}
353
357
}
354
358
355
- impl TyBuilder < Binders < Ty > > {
359
+ impl < ' db > TyBuilder < EarlyBinder < ' db , crate :: next_solver :: Ty < ' db > > > {
356
360
pub fn def_ty (
357
- db : & dyn HirDatabase ,
361
+ db : & ' db dyn HirDatabase ,
358
362
def : TyDefId ,
359
363
parent_subst : Option < Substitution > ,
360
- ) -> TyBuilder < Binders < Ty > > {
364
+ ) -> TyBuilder < EarlyBinder < ' db , crate :: next_solver :: Ty < ' db > > > {
361
365
let poly_ty = db. ty ( def) ;
362
366
let id: GenericDefId = match def {
363
367
TyDefId :: BuiltinType ( _) => {
@@ -370,7 +374,10 @@ impl TyBuilder<Binders<Ty>> {
370
374
TyBuilder :: subst_for_def ( db, id, parent_subst) . with_data ( poly_ty)
371
375
}
372
376
373
- pub fn impl_self_ty ( db : & dyn HirDatabase , def : hir_def:: ImplId ) -> TyBuilder < Binders < Ty > > {
377
+ pub fn impl_self_ty (
378
+ db : & ' db dyn HirDatabase ,
379
+ def : hir_def:: ImplId ,
380
+ ) -> TyBuilder < EarlyBinder < ' db , crate :: next_solver:: Ty < ' db > > > {
374
381
TyBuilder :: subst_for_def ( db, def, None ) . with_data ( db. impl_self_ty ( def) )
375
382
}
376
383
}
0 commit comments