@@ -21,8 +21,8 @@ use crate::{
21
21
to_assoc_type_id,
22
22
traits:: { chalk:: from_chalk, FnTrait , InEnvironment } ,
23
23
utils:: { generics, variant_data, Generics } ,
24
- AdtId , Binders , CallableDefId , FnPointer , FnSig , Interner , Obligation , Rawness , Scalar , Substs ,
25
- TraitRef , Ty , TyKind ,
24
+ AdtId , Binders , CallableDefId , FnPointer , FnSig , Interner , Obligation , Rawness , Scalar ,
25
+ Substitution , TraitRef , Ty , TyKind ,
26
26
} ;
27
27
28
28
use super :: {
@@ -77,7 +77,7 @@ impl<'a> InferenceContext<'a> {
77
77
return None ;
78
78
}
79
79
80
- let mut param_builder = Substs :: builder ( num_args) ;
80
+ let mut param_builder = Substitution :: builder ( num_args) ;
81
81
let mut arg_tys = vec ! [ ] ;
82
82
for _ in 0 ..num_args {
83
83
let arg = self . table . new_type_var ( ) ;
@@ -87,7 +87,7 @@ impl<'a> InferenceContext<'a> {
87
87
let parameters = param_builder. build ( ) ;
88
88
let arg_ty = TyKind :: Tuple ( num_args, parameters) . intern ( & Interner ) ;
89
89
let substs =
90
- Substs :: build_for_generics ( & generic_params) . push ( ty. clone ( ) ) . push ( arg_ty) . build ( ) ;
90
+ Substitution :: build_for_generics ( & generic_params) . push ( ty. clone ( ) ) . push ( arg_ty) . build ( ) ;
91
91
92
92
let trait_env = Arc :: clone ( & self . trait_env ) ;
93
93
let implements_fn_trait =
@@ -181,7 +181,7 @@ impl<'a> InferenceContext<'a> {
181
181
let inner_ty = self . infer_expr ( * body, & Expectation :: none ( ) ) ;
182
182
let impl_trait_id = crate :: ImplTraitId :: AsyncBlockTypeImplTrait ( self . owner , * body) ;
183
183
let opaque_ty_id = self . db . intern_impl_trait_id ( impl_trait_id) . into ( ) ;
184
- TyKind :: OpaqueType ( opaque_ty_id, Substs :: single ( inner_ty) ) . intern ( & Interner )
184
+ TyKind :: OpaqueType ( opaque_ty_id, Substitution :: single ( inner_ty) ) . intern ( & Interner )
185
185
}
186
186
Expr :: Loop { body, label } => {
187
187
self . breakables . push ( BreakableContext {
@@ -262,12 +262,12 @@ impl<'a> InferenceContext<'a> {
262
262
let sig_ty = TyKind :: Function ( FnPointer {
263
263
num_args : sig_tys. len ( ) - 1 ,
264
264
sig : FnSig { abi : ( ) , safety : chalk_ir:: Safety :: Safe , variadic : false } ,
265
- substs : Substs ( sig_tys. clone ( ) . into ( ) ) ,
265
+ substs : Substitution ( sig_tys. clone ( ) . into ( ) ) ,
266
266
} )
267
267
. intern ( & Interner ) ;
268
268
let closure_id = self . db . intern_closure ( ( self . owner , tgt_expr) ) . into ( ) ;
269
269
let closure_ty =
270
- TyKind :: Closure ( closure_id, Substs :: single ( sig_ty) ) . intern ( & Interner ) ;
270
+ TyKind :: Closure ( closure_id, Substitution :: single ( sig_ty) ) . intern ( & Interner ) ;
271
271
272
272
// Eagerly try to relate the closure type with the expected
273
273
// type, otherwise we often won't have enough information to
@@ -402,7 +402,7 @@ impl<'a> InferenceContext<'a> {
402
402
403
403
self . unify ( & ty, & expected. ty ) ;
404
404
405
- let substs = ty. substs ( ) . cloned ( ) . unwrap_or_else ( Substs :: empty) ;
405
+ let substs = ty. substs ( ) . cloned ( ) . unwrap_or_else ( Substitution :: empty) ;
406
406
let field_types = def_id. map ( |it| self . db . field_types ( it) ) . unwrap_or_default ( ) ;
407
407
let variant_data = def_id. map ( |it| variant_data ( self . db . upcast ( ) , it) ) ;
408
408
for field in fields. iter ( ) {
@@ -511,7 +511,8 @@ impl<'a> InferenceContext<'a> {
511
511
Expr :: Box { expr } => {
512
512
let inner_ty = self . infer_expr_inner ( * expr, & Expectation :: none ( ) ) ;
513
513
if let Some ( box_) = self . resolve_boxed_box ( ) {
514
- let mut sb = Substs :: builder ( generics ( self . db . upcast ( ) , box_. into ( ) ) . len ( ) ) ;
514
+ let mut sb =
515
+ Substitution :: builder ( generics ( self . db . upcast ( ) , box_. into ( ) ) . len ( ) ) ;
515
516
sb = sb. push ( inner_ty) ;
516
517
match self . db . generic_defaults ( box_. into ( ) ) . as_ref ( ) {
517
518
[ _, alloc_ty, ..] if !alloc_ty. value . is_unknown ( ) => {
@@ -610,31 +611,31 @@ impl<'a> InferenceContext<'a> {
610
611
let rhs_ty = rhs. map ( |e| self . infer_expr ( e, & rhs_expect) ) ;
611
612
match ( range_type, lhs_ty, rhs_ty) {
612
613
( RangeOp :: Exclusive , None , None ) => match self . resolve_range_full ( ) {
613
- Some ( adt) => Ty :: adt_ty ( adt, Substs :: empty ( ) ) ,
614
+ Some ( adt) => Ty :: adt_ty ( adt, Substitution :: empty ( ) ) ,
614
615
None => self . err_ty ( ) ,
615
616
} ,
616
617
( RangeOp :: Exclusive , None , Some ( ty) ) => match self . resolve_range_to ( ) {
617
- Some ( adt) => Ty :: adt_ty ( adt, Substs :: single ( ty) ) ,
618
+ Some ( adt) => Ty :: adt_ty ( adt, Substitution :: single ( ty) ) ,
618
619
None => self . err_ty ( ) ,
619
620
} ,
620
621
( RangeOp :: Inclusive , None , Some ( ty) ) => {
621
622
match self . resolve_range_to_inclusive ( ) {
622
- Some ( adt) => Ty :: adt_ty ( adt, Substs :: single ( ty) ) ,
623
+ Some ( adt) => Ty :: adt_ty ( adt, Substitution :: single ( ty) ) ,
623
624
None => self . err_ty ( ) ,
624
625
}
625
626
}
626
627
( RangeOp :: Exclusive , Some ( _) , Some ( ty) ) => match self . resolve_range ( ) {
627
- Some ( adt) => Ty :: adt_ty ( adt, Substs :: single ( ty) ) ,
628
+ Some ( adt) => Ty :: adt_ty ( adt, Substitution :: single ( ty) ) ,
628
629
None => self . err_ty ( ) ,
629
630
} ,
630
631
( RangeOp :: Inclusive , Some ( _) , Some ( ty) ) => {
631
632
match self . resolve_range_inclusive ( ) {
632
- Some ( adt) => Ty :: adt_ty ( adt, Substs :: single ( ty) ) ,
633
+ Some ( adt) => Ty :: adt_ty ( adt, Substitution :: single ( ty) ) ,
633
634
None => self . err_ty ( ) ,
634
635
}
635
636
}
636
637
( RangeOp :: Exclusive , Some ( ty) , None ) => match self . resolve_range_from ( ) {
637
- Some ( adt) => Ty :: adt_ty ( adt, Substs :: single ( ty) ) ,
638
+ Some ( adt) => Ty :: adt_ty ( adt, Substitution :: single ( ty) ) ,
638
639
None => self . err_ty ( ) ,
639
640
} ,
640
641
( RangeOp :: Inclusive , _, None ) => self . err_ty ( ) ,
@@ -681,7 +682,7 @@ impl<'a> InferenceContext<'a> {
681
682
self . infer_expr_coerce ( * expr, & Expectation :: has_type ( ty. clone ( ) ) ) ;
682
683
}
683
684
684
- TyKind :: Tuple ( tys. len ( ) , Substs ( tys. into ( ) ) ) . intern ( & Interner )
685
+ TyKind :: Tuple ( tys. len ( ) , Substitution ( tys. into ( ) ) ) . intern ( & Interner )
685
686
}
686
687
Expr :: Array ( array) => {
687
688
let elem_ty = match expected. ty . interned ( & Interner ) {
@@ -887,7 +888,7 @@ impl<'a> InferenceContext<'a> {
887
888
def_generics : Option < Generics > ,
888
889
generic_args : Option < & GenericArgs > ,
889
890
receiver_ty : & Ty ,
890
- ) -> Substs {
891
+ ) -> Substitution {
891
892
let ( parent_params, self_params, type_params, impl_trait_params) =
892
893
def_generics. as_ref ( ) . map_or ( ( 0 , 0 , 0 , 0 ) , |g| g. provenance_split ( ) ) ;
893
894
assert_eq ! ( self_params, 0 ) ; // method shouldn't have another Self param
@@ -926,7 +927,7 @@ impl<'a> InferenceContext<'a> {
926
927
substs. push ( self . err_ty ( ) ) ;
927
928
}
928
929
assert_eq ! ( substs. len( ) , total_len) ;
929
- Substs ( substs. into ( ) )
930
+ Substitution ( substs. into ( ) )
930
931
}
931
932
932
933
fn register_obligations_for_call ( & mut self , callable_ty : & Ty ) {
0 commit comments