@@ -10,6 +10,9 @@ use rustc_hir::def::{CtorOf, DefKind, Res};
10
10
use rustc_hir:: def_id:: DefId ;
11
11
use rustc_hir:: lang_items:: LangItem ;
12
12
use rustc_hir:: { ExprKind , GenericArg , Node , QPath } ;
13
+ use rustc_hir_analysis:: astconv:: generics:: {
14
+ check_generic_arg_count_for_call, create_substs_for_generic_args,
15
+ } ;
13
16
use rustc_hir_analysis:: astconv:: {
14
17
AstConv , CreateSubstsForGenericArgsCtxt , ExplicitLateBound , GenericArgCountMismatch ,
15
18
GenericArgCountResult , IsMethodCall , PathSeg ,
@@ -374,7 +377,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
374
377
}
375
378
376
379
pub fn to_ty ( & self , ast_t : & hir:: Ty < ' _ > ) -> RawTy < ' tcx > {
377
- let t = < dyn AstConv < ' _ > > :: ast_ty_to_ty ( self , ast_t) ;
380
+ let t = self . astconv ( ) . ast_ty_to_ty ( ast_t) ;
378
381
self . register_wf_obligation ( t. into ( ) , ast_t. span , traits:: WellFormed ( None ) ) ;
379
382
self . handle_raw_ty ( ast_t. span , t)
380
383
}
@@ -777,7 +780,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
777
780
// to be object-safe.
778
781
// We manually call `register_wf_obligation` in the success path
779
782
// below.
780
- let ty = < dyn AstConv < ' _ > > :: ast_ty_to_ty_in_path ( self , qself) ;
783
+ let ty = self . astconv ( ) . ast_ty_to_ty_in_path ( qself) ;
781
784
( self . handle_raw_ty ( span, ty) , qself, segment)
782
785
}
783
786
QPath :: LangItem ( ..) => {
@@ -975,8 +978,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
975
978
976
979
let path_segs = match res {
977
980
Res :: Local ( _) | Res :: SelfCtor ( _) => vec ! [ ] ,
978
- Res :: Def ( kind, def_id) => <dyn AstConv < ' _ > >:: def_ids_for_value_path_segments (
979
- self ,
981
+ Res :: Def ( kind, def_id) => self . astconv ( ) . def_ids_for_value_path_segments (
980
982
segments,
981
983
self_ty. map ( |ty| ty. raw ) ,
982
984
kind,
@@ -1027,8 +1029,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
1027
1029
// errors if type parameters are provided in an inappropriate place.
1028
1030
1029
1031
let generic_segs: FxHashSet < _ > = path_segs. iter ( ) . map ( |PathSeg ( _, index) | index) . collect ( ) ;
1030
- let generics_has_err = <dyn AstConv < ' _ > >:: prohibit_generics (
1031
- self ,
1032
+ let generics_has_err = self . astconv ( ) . prohibit_generics (
1032
1033
segments. iter ( ) . enumerate ( ) . filter_map ( |( index, seg) | {
1033
1034
if !generic_segs. contains ( & index) || is_alias_variant_ctor {
1034
1035
Some ( seg)
@@ -1069,7 +1070,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
1069
1070
// parameter internally, but we don't allow users to specify the
1070
1071
// parameter's value explicitly, so we have to do some error-
1071
1072
// checking here.
1072
- let arg_count = < dyn AstConv < ' _ > > :: check_generic_arg_count_for_call (
1073
+ let arg_count = check_generic_arg_count_for_call (
1073
1074
tcx,
1074
1075
span,
1075
1076
def_id,
@@ -1177,7 +1178,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
1177
1178
) -> ty:: GenericArg < ' tcx > {
1178
1179
match ( & param. kind , arg) {
1179
1180
( GenericParamDefKind :: Lifetime , GenericArg :: Lifetime ( lt) ) => {
1180
- < dyn AstConv < ' _ > > :: ast_region_to_region ( self . fcx , lt, Some ( param) ) . into ( )
1181
+ self . fcx . astconv ( ) . ast_region_to_region ( lt, Some ( param) ) . into ( )
1181
1182
}
1182
1183
( GenericParamDefKind :: Type { .. } , GenericArg :: Type ( ty) ) => {
1183
1184
self . fcx . to_ty ( ty) . raw . into ( )
@@ -1235,7 +1236,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
1235
1236
}
1236
1237
1237
1238
let substs_raw = self_ctor_substs. unwrap_or_else ( || {
1238
- < dyn AstConv < ' _ > > :: create_substs_for_generic_args (
1239
+ create_substs_for_generic_args (
1239
1240
tcx,
1240
1241
def_id,
1241
1242
& [ ] ,
0 commit comments