@@ -476,7 +476,7 @@ fn make_mirror_unadjusted<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>,
476
476
adt_def : adt,
477
477
variant_index : 0 ,
478
478
substs,
479
- user_ty : cx. user_annotated_ty_for_adt ( expr. hir_id , adt) ,
479
+ user_ty : cx. user_substs_applied_to_adt ( expr. hir_id , adt) ,
480
480
fields : field_refs ( cx, fields) ,
481
481
base : base. as_ref ( ) . map ( |base| {
482
482
FruInfo {
@@ -502,7 +502,7 @@ fn make_mirror_unadjusted<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>,
502
502
adt_def : adt,
503
503
variant_index : index,
504
504
substs,
505
- user_ty : cx. user_annotated_ty_for_adt ( expr. hir_id , adt) ,
505
+ user_ty : cx. user_substs_applied_to_adt ( expr. hir_id , adt) ,
506
506
fields : field_refs ( cx, fields) ,
507
507
base : None ,
508
508
}
@@ -788,30 +788,12 @@ fn user_annotated_ty_for_def(
788
788
// user.
789
789
Def :: StructCtor ( _def_id, CtorKind :: Const ) |
790
790
Def :: VariantCtor ( _def_id, CtorKind :: Const ) =>
791
- match & cx. tables ( ) . node_id_to_type ( hir_id) . sty {
792
- ty:: Adt ( adt_def, _) => cx. user_annotated_ty_for_adt ( hir_id, adt_def) ,
793
- sty => bug ! ( "unexpected sty: {:?}" , sty) ,
794
- } ,
791
+ cx. user_substs_applied_to_ty_of_hir_id ( hir_id) ,
795
792
796
793
// `Self` is used in expression as a tuple struct constructor or an unit struct constructor
797
- Def :: SelfCtor ( _) => {
798
- let sty = & cx. tables ( ) . node_id_to_type ( hir_id) . sty ;
799
- match sty {
800
- ty:: FnDef ( ref def_id, _) => {
801
- Some ( cx. tables ( ) . user_substs ( hir_id) ?. unchecked_map ( |user_substs| {
802
- // Here, we just pair a `DefId` with the
803
- // `user_substs`, so no new types etc are introduced.
804
- cx. tcx ( ) . mk_fn_def ( * def_id, user_substs)
805
- } ) )
806
- }
807
- ty:: Adt ( ref adt_def, _) => {
808
- cx. user_annotated_ty_for_adt ( hir_id, adt_def)
809
- }
810
- _ => {
811
- bug ! ( "unexpected sty: {:?}" , sty)
812
- }
813
- }
814
- }
794
+ Def :: SelfCtor ( _) =>
795
+ cx. user_substs_applied_to_ty_of_hir_id ( hir_id) ,
796
+
815
797
_ =>
816
798
bug ! ( "user_annotated_ty_for_def: unexpected def {:?} at {:?}" , def, hir_id)
817
799
}
@@ -931,7 +913,7 @@ fn convert_path_expr<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>,
931
913
adt_def,
932
914
variant_index : adt_def. variant_index_with_id ( def_id) ,
933
915
substs,
934
- user_ty : cx. user_annotated_ty_for_adt ( expr. hir_id , adt_def) ,
916
+ user_ty : cx. user_substs_applied_to_adt ( expr. hir_id , adt_def) ,
935
917
fields : vec ! [ ] ,
936
918
base : None ,
937
919
}
0 commit comments