@@ -10,6 +10,9 @@ use rustc_hir::def::{CtorOf, DefKind, Res};
1010use rustc_hir:: def_id:: DefId ;
1111use rustc_hir:: lang_items:: LangItem ;
1212use 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+ } ;
1316use rustc_hir_analysis:: astconv:: {
1417 AstConv , CreateSubstsForGenericArgsCtxt , ExplicitLateBound , GenericArgCountMismatch ,
1518 GenericArgCountResult , IsMethodCall , PathSeg ,
@@ -374,7 +377,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
374377 }
375378
376379 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) ;
378381 self . register_wf_obligation ( t. into ( ) , ast_t. span , traits:: WellFormed ( None ) ) ;
379382 self . handle_raw_ty ( ast_t. span , t)
380383 }
@@ -777,7 +780,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
777780 // to be object-safe.
778781 // We manually call `register_wf_obligation` in the success path
779782 // 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) ;
781784 ( self . handle_raw_ty ( span, ty) , qself, segment)
782785 }
783786 QPath :: LangItem ( ..) => {
@@ -975,8 +978,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
975978
976979 let path_segs = match res {
977980 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 (
980982 segments,
981983 self_ty. map ( |ty| ty. raw ) ,
982984 kind,
@@ -1027,8 +1029,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
10271029 // errors if type parameters are provided in an inappropriate place.
10281030
10291031 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 (
10321033 segments. iter ( ) . enumerate ( ) . filter_map ( |( index, seg) | {
10331034 if !generic_segs. contains ( & index) || is_alias_variant_ctor {
10341035 Some ( seg)
@@ -1069,7 +1070,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
10691070 // parameter internally, but we don't allow users to specify the
10701071 // parameter's value explicitly, so we have to do some error-
10711072 // checking here.
1072- let arg_count = < dyn AstConv < ' _ > > :: check_generic_arg_count_for_call (
1073+ let arg_count = check_generic_arg_count_for_call (
10731074 tcx,
10741075 span,
10751076 def_id,
@@ -1177,7 +1178,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
11771178 ) -> ty:: GenericArg < ' tcx > {
11781179 match ( & param. kind , arg) {
11791180 ( 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 ( )
11811182 }
11821183 ( GenericParamDefKind :: Type { .. } , GenericArg :: Type ( ty) ) => {
11831184 self . fcx . to_ty ( ty) . raw . into ( )
@@ -1235,7 +1236,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
12351236 }
12361237
12371238 let substs_raw = self_ctor_substs. unwrap_or_else ( || {
1238- < dyn AstConv < ' _ > > :: create_substs_for_generic_args (
1239+ create_substs_for_generic_args (
12391240 tcx,
12401241 def_id,
12411242 & [ ] ,
0 commit comments