@@ -911,7 +911,7 @@ impl<'tcx> TyCtxt<'tcx> {
911
911
|| self . extern_crate ( key) . is_some_and ( |e| e. is_direct ( ) )
912
912
}
913
913
914
- /// Expand any [weak alias types][weak ] contained within the given `value`.
914
+ /// Expand any [free alias types][free ] contained within the given `value`.
915
915
///
916
916
/// This should be used over other normalization routines in situations where
917
917
/// it's important not to normalize other alias types and where the predicates
@@ -926,19 +926,19 @@ impl<'tcx> TyCtxt<'tcx> {
926
926
/// <div class="warning">
927
927
/// This delays a bug on overflow! Therefore you need to be certain that the
928
928
/// contained types get fully normalized at a later stage. Note that even on
929
- /// overflow all well-behaved weak alias types get expanded correctly, so the
929
+ /// overflow all well-behaved free alias types get expanded correctly, so the
930
930
/// result is still useful.
931
931
/// </div>
932
932
///
933
- /// [weak ]: ty::Weak
934
- pub fn expand_weak_alias_tys < T : TypeFoldable < TyCtxt < ' tcx > > > ( self , value : T ) -> T {
935
- value. fold_with ( & mut WeakAliasTypeExpander { tcx : self , depth : 0 } )
933
+ /// [free ]: ty::Free
934
+ pub fn expand_free_alias_tys < T : TypeFoldable < TyCtxt < ' tcx > > > ( self , value : T ) -> T {
935
+ value. fold_with ( & mut FreeAliasTypeExpander { tcx : self , depth : 0 } )
936
936
}
937
937
938
- /// Peel off all [weak alias types] in this type until there are none left.
938
+ /// Peel off all [free alias types] in this type until there are none left.
939
939
///
940
- /// This only expands weak alias types in “head” / outermost positions. It can
941
- /// be used over [expand_weak_alias_tys ] as an optimization in situations where
940
+ /// This only expands free alias types in “head” / outermost positions. It can
941
+ /// be used over [expand_free_alias_tys ] as an optimization in situations where
942
942
/// one only really cares about the *kind* of the final aliased type but not
943
943
/// the types the other constituent types alias.
944
944
///
@@ -947,17 +947,17 @@ impl<'tcx> TyCtxt<'tcx> {
947
947
/// type gets fully normalized at a later stage.
948
948
/// </div>
949
949
///
950
- /// [weak ]: ty::Weak
951
- /// [expand_weak_alias_tys ]: Self::expand_weak_alias_tys
952
- pub fn peel_off_weak_alias_tys ( self , mut ty : Ty < ' tcx > ) -> Ty < ' tcx > {
953
- let ty:: Alias ( ty:: Weak , _) = ty. kind ( ) else { return ty } ;
950
+ /// [free ]: ty::Free
951
+ /// [expand_free_alias_tys ]: Self::expand_free_alias_tys
952
+ pub fn peel_off_free_alias_tys ( self , mut ty : Ty < ' tcx > ) -> Ty < ' tcx > {
953
+ let ty:: Alias ( ty:: Free , _) = ty. kind ( ) else { return ty } ;
954
954
955
955
let limit = self . recursion_limit ( ) ;
956
956
let mut depth = 0 ;
957
957
958
- while let ty:: Alias ( ty:: Weak , alias) = ty. kind ( ) {
958
+ while let ty:: Alias ( ty:: Free , alias) = ty. kind ( ) {
959
959
if !limit. value_within_limit ( depth) {
960
- let guar = self . dcx ( ) . delayed_bug ( "overflow expanding weak alias type" ) ;
960
+ let guar = self . dcx ( ) . delayed_bug ( "overflow expanding free alias type" ) ;
961
961
return Ty :: new_error ( self , guar) ;
962
962
}
963
963
@@ -985,7 +985,7 @@ impl<'tcx> TyCtxt<'tcx> {
985
985
}
986
986
ty:: AliasTermKind :: OpaqueTy => Some ( self . variances_of ( def_id) ) ,
987
987
ty:: AliasTermKind :: InherentTy
988
- | ty:: AliasTermKind :: WeakTy
988
+ | ty:: AliasTermKind :: FreeTy
989
989
| ty:: AliasTermKind :: UnevaluatedConst
990
990
| ty:: AliasTermKind :: ProjectionConst => None ,
991
991
}
@@ -1078,25 +1078,25 @@ impl<'tcx> TypeFolder<TyCtxt<'tcx>> for OpaqueTypeExpander<'tcx> {
1078
1078
}
1079
1079
}
1080
1080
1081
- struct WeakAliasTypeExpander < ' tcx > {
1081
+ struct FreeAliasTypeExpander < ' tcx > {
1082
1082
tcx : TyCtxt < ' tcx > ,
1083
1083
depth : usize ,
1084
1084
}
1085
1085
1086
- impl < ' tcx > TypeFolder < TyCtxt < ' tcx > > for WeakAliasTypeExpander < ' tcx > {
1086
+ impl < ' tcx > TypeFolder < TyCtxt < ' tcx > > for FreeAliasTypeExpander < ' tcx > {
1087
1087
fn cx ( & self ) -> TyCtxt < ' tcx > {
1088
1088
self . tcx
1089
1089
}
1090
1090
1091
1091
fn fold_ty ( & mut self , ty : Ty < ' tcx > ) -> Ty < ' tcx > {
1092
- if !ty. has_type_flags ( ty:: TypeFlags :: HAS_TY_WEAK ) {
1092
+ if !ty. has_type_flags ( ty:: TypeFlags :: HAS_TY_FREE_ALIAS ) {
1093
1093
return ty;
1094
1094
}
1095
- let ty:: Alias ( ty:: Weak , alias) = ty. kind ( ) else {
1095
+ let ty:: Alias ( ty:: Free , alias) = ty. kind ( ) else {
1096
1096
return ty. super_fold_with ( self ) ;
1097
1097
} ;
1098
1098
if !self . tcx . recursion_limit ( ) . value_within_limit ( self . depth ) {
1099
- let guar = self . tcx . dcx ( ) . delayed_bug ( "overflow expanding weak alias type" ) ;
1099
+ let guar = self . tcx . dcx ( ) . delayed_bug ( "overflow expanding free alias type" ) ;
1100
1100
return Ty :: new_error ( self . tcx , guar) ;
1101
1101
}
1102
1102
@@ -1107,7 +1107,7 @@ impl<'tcx> TypeFolder<TyCtxt<'tcx>> for WeakAliasTypeExpander<'tcx> {
1107
1107
}
1108
1108
1109
1109
fn fold_const ( & mut self , ct : ty:: Const < ' tcx > ) -> ty:: Const < ' tcx > {
1110
- if !ct. has_type_flags ( ty:: TypeFlags :: HAS_TY_WEAK ) {
1110
+ if !ct. has_type_flags ( ty:: TypeFlags :: HAS_TY_FREE_ALIAS ) {
1111
1111
return ct;
1112
1112
}
1113
1113
ct. super_fold_with ( self )
0 commit comments