@@ -13,6 +13,7 @@ use rustc_data_structures::indexed_vec::Idx;
1313use hair:: cx:: Cx ;
1414use hair:: cx:: block;
1515use hair:: cx:: to_ref:: ToRef ;
16+ use hair:: util:: UserAnnotatedTyHelpers ;
1617use rustc:: hir:: def:: { Def , CtorKind } ;
1718use rustc:: mir:: interpret:: GlobalId ;
1819use rustc:: ty:: { self , AdtKind , Ty } ;
@@ -475,7 +476,7 @@ fn make_mirror_unadjusted<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>,
475476 adt_def : adt,
476477 variant_index : 0 ,
477478 substs,
478- user_ty : user_annotated_ty_for_adt ( cx , expr. hir_id , adt) ,
479+ user_ty : cx . user_annotated_ty_for_adt ( expr. hir_id , adt) ,
479480 fields : field_refs ( cx, fields) ,
480481 base : base. as_ref ( ) . map ( |base| {
481482 FruInfo {
@@ -501,7 +502,7 @@ fn make_mirror_unadjusted<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>,
501502 adt_def : adt,
502503 variant_index : index,
503504 substs,
504- user_ty : user_annotated_ty_for_adt ( cx , expr. hir_id , adt) ,
505+ user_ty : cx . user_annotated_ty_for_adt ( expr. hir_id , adt) ,
505506 fields : field_refs ( cx, fields) ,
506507 base : None ,
507508 }
@@ -788,7 +789,7 @@ fn user_annotated_ty_for_def(
788789 Def :: StructCtor ( _def_id, CtorKind :: Const ) |
789790 Def :: VariantCtor ( _def_id, CtorKind :: Const ) =>
790791 match & cx. tables ( ) . node_id_to_type ( hir_id) . sty {
791- ty:: Adt ( adt_def, _) => user_annotated_ty_for_adt ( cx , hir_id, adt_def) ,
792+ ty:: Adt ( adt_def, _) => cx . user_annotated_ty_for_adt ( hir_id, adt_def) ,
792793 sty => bug ! ( "unexpected sty: {:?}" , sty) ,
793794 } ,
794795
@@ -804,7 +805,7 @@ fn user_annotated_ty_for_def(
804805 } ) )
805806 }
806807 ty:: Adt ( ref adt_def, _) => {
807- user_annotated_ty_for_adt ( cx , hir_id, adt_def)
808+ cx . user_annotated_ty_for_adt ( hir_id, adt_def)
808809 }
809810 _ => {
810811 bug ! ( "unexpected sty: {:?}" , sty)
@@ -816,19 +817,6 @@ fn user_annotated_ty_for_def(
816817 }
817818}
818819
819- fn user_annotated_ty_for_adt (
820- cx : & mut Cx < ' a , ' gcx , ' tcx > ,
821- hir_id : hir:: HirId ,
822- adt_def : & ' tcx AdtDef ,
823- ) -> Option < CanonicalTy < ' tcx > > {
824- let user_substs = cx. tables ( ) . user_substs ( hir_id) ?;
825- Some ( user_substs. unchecked_map ( |user_substs| {
826- // Here, we just pair an `AdtDef` with the
827- // `user_substs`, so no new types etc are introduced.
828- cx. tcx ( ) . mk_adt ( adt_def, user_substs)
829- } ) )
830- }
831-
832820fn method_callee < ' a , ' gcx , ' tcx > (
833821 cx : & mut Cx < ' a , ' gcx , ' tcx > ,
834822 expr : & hir:: Expr ,
@@ -943,7 +931,7 @@ fn convert_path_expr<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>,
943931 adt_def,
944932 variant_index : adt_def. variant_index_with_id ( def_id) ,
945933 substs,
946- user_ty : user_annotated_ty_for_adt ( cx , expr. hir_id , adt_def) ,
934+ user_ty : cx . user_annotated_ty_for_adt ( expr. hir_id , adt_def) ,
947935 fields : vec ! [ ] ,
948936 base : None ,
949937 }
0 commit comments