@@ -13,6 +13,7 @@ use rustc_data_structures::indexed_vec::Idx;
13
13
use hair:: cx:: Cx ;
14
14
use hair:: cx:: block;
15
15
use hair:: cx:: to_ref:: ToRef ;
16
+ use hair:: util:: UserAnnotatedTyHelpers ;
16
17
use rustc:: hir:: def:: { Def , CtorKind } ;
17
18
use rustc:: mir:: interpret:: GlobalId ;
18
19
use rustc:: ty:: { self , AdtKind , Ty } ;
@@ -475,7 +476,7 @@ fn make_mirror_unadjusted<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>,
475
476
adt_def : adt,
476
477
variant_index : 0 ,
477
478
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) ,
479
480
fields : field_refs ( cx, fields) ,
480
481
base : base. as_ref ( ) . map ( |base| {
481
482
FruInfo {
@@ -501,7 +502,7 @@ fn make_mirror_unadjusted<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>,
501
502
adt_def : adt,
502
503
variant_index : index,
503
504
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) ,
505
506
fields : field_refs ( cx, fields) ,
506
507
base : None ,
507
508
}
@@ -788,7 +789,7 @@ fn user_annotated_ty_for_def(
788
789
Def :: StructCtor ( _def_id, CtorKind :: Const ) |
789
790
Def :: VariantCtor ( _def_id, CtorKind :: Const ) =>
790
791
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) ,
792
793
sty => bug ! ( "unexpected sty: {:?}" , sty) ,
793
794
} ,
794
795
@@ -804,7 +805,7 @@ fn user_annotated_ty_for_def(
804
805
} ) )
805
806
}
806
807
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)
808
809
}
809
810
_ => {
810
811
bug ! ( "unexpected sty: {:?}" , sty)
@@ -816,19 +817,6 @@ fn user_annotated_ty_for_def(
816
817
}
817
818
}
818
819
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
-
832
820
fn method_callee < ' a , ' gcx , ' tcx > (
833
821
cx : & mut Cx < ' a , ' gcx , ' tcx > ,
834
822
expr : & hir:: Expr ,
@@ -943,7 +931,7 @@ fn convert_path_expr<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>,
943
931
adt_def,
944
932
variant_index : adt_def. variant_index_with_id ( def_id) ,
945
933
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) ,
947
935
fields : vec ! [ ] ,
948
936
base : None ,
949
937
}
0 commit comments