@@ -476,7 +476,7 @@ fn make_mirror_unadjusted<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>,
476476 adt_def : adt,
477477 variant_index : 0 ,
478478 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) ,
480480 fields : field_refs ( cx, fields) ,
481481 base : base. as_ref ( ) . map ( |base| {
482482 FruInfo {
@@ -502,7 +502,7 @@ fn make_mirror_unadjusted<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>,
502502 adt_def : adt,
503503 variant_index : index,
504504 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) ,
506506 fields : field_refs ( cx, fields) ,
507507 base : None ,
508508 }
@@ -788,30 +788,12 @@ fn user_annotated_ty_for_def(
788788 // user.
789789 Def :: StructCtor ( _def_id, CtorKind :: Const ) |
790790 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) ,
795792
796793 // `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+
815797 _ =>
816798 bug ! ( "user_annotated_ty_for_def: unexpected def {:?} at {:?}" , def, hir_id)
817799 }
@@ -931,7 +913,7 @@ fn convert_path_expr<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>,
931913 adt_def,
932914 variant_index : adt_def. variant_index_with_id ( def_id) ,
933915 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) ,
935917 fields : vec ! [ ] ,
936918 base : None ,
937919 }
0 commit comments