11use  std:: borrow:: Cow ; 
22
33use  libc:: c_uint; 
4- use  rustc_abi:: { Align ,  Endian ,  Size ,  TagEncoding ,  VariantIdx ,  Variants } ; 
4+ use  rustc_abi:: { Align ,  Endian ,  FieldIdx ,   Size ,  TagEncoding ,  VariantIdx ,  Variants } ; 
55use  rustc_codegen_ssa:: debuginfo:: type_names:: compute_debuginfo_type_name; 
66use  rustc_codegen_ssa:: debuginfo:: { tag_base_type,  wants_c_like_enum_debuginfo} ; 
77use  rustc_codegen_ssa:: traits:: { ConstCodegenMethods ,  MiscCodegenMethods } ; 
@@ -401,7 +401,7 @@ fn build_union_fields_for_enum<'ll, 'tcx>(
401401    enum_type_and_layout :  TyAndLayout < ' tcx > , 
402402    enum_type_di_node :  & ' ll  DIType , 
403403    variant_indices :  impl  Iterator < Item  = VariantIdx >  + Clone , 
404-     tag_field :  usize , 
404+     tag_field :  FieldIdx , 
405405    untagged_variant_index :  Option < VariantIdx > , 
406406)  -> SmallVec < & ' ll  DIType >  { 
407407    let  tag_base_type = tag_base_type ( cx. tcx ,  enum_type_and_layout) ; 
@@ -805,7 +805,7 @@ fn build_union_fields_for_direct_tag_enum_or_coroutine<'ll, 'tcx>(
805805    variant_field_infos :  & [ VariantFieldInfo < ' ll > ] , 
806806    discr_type_di_node :  & ' ll  DIType , 
807807    tag_base_type :  Ty < ' tcx > , 
808-     tag_field :  usize , 
808+     tag_field :  FieldIdx , 
809809    untagged_variant_index :  Option < VariantIdx > , 
810810    di_flags :  DIFlags , 
811811)  -> SmallVec < & ' ll  DIType >  { 
@@ -858,7 +858,7 @@ fn build_union_fields_for_direct_tag_enum_or_coroutine<'ll, 'tcx>(
858858    } ) ) ; 
859859
860860    assert_eq ! ( 
861-         cx. size_and_align_of( enum_type_and_layout. field( cx,  tag_field) . ty) , 
861+         cx. size_and_align_of( enum_type_and_layout. field( cx,  tag_field. as_usize ( ) ) . ty) , 
862862        cx. size_and_align_of( self :: tag_base_type( cx. tcx,  enum_type_and_layout) ) 
863863    ) ; 
864864
@@ -875,7 +875,7 @@ fn build_union_fields_for_direct_tag_enum_or_coroutine<'ll, 'tcx>(
875875            Endian :: Big  => ( 8 ,  0 ) , 
876876        } ; 
877877
878-         let  tag_field_offset = enum_type_and_layout. fields . offset ( tag_field) . bytes ( ) ; 
878+         let  tag_field_offset = enum_type_and_layout. fields . offset ( tag_field. as_usize ( ) ) . bytes ( ) ; 
879879        let  lo_offset = Size :: from_bytes ( tag_field_offset + lo_offset) ; 
880880        let  hi_offset = Size :: from_bytes ( tag_field_offset + hi_offset) ; 
881881
@@ -905,8 +905,8 @@ fn build_union_fields_for_direct_tag_enum_or_coroutine<'ll, 'tcx>(
905905            cx, 
906906            enum_type_di_node, 
907907            TAG_FIELD_NAME , 
908-             enum_type_and_layout. field ( cx,  tag_field) , 
909-             enum_type_and_layout. fields . offset ( tag_field) , 
908+             enum_type_and_layout. field ( cx,  tag_field. as_usize ( ) ) , 
909+             enum_type_and_layout. fields . offset ( tag_field. as_usize ( ) ) , 
910910            di_flags, 
911911            tag_base_type_di_node, 
912912            None , 
0 commit comments