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) ; 
@@ -806,7 +806,7 @@ fn build_union_fields_for_direct_tag_enum_or_coroutine<'ll, 'tcx>(
806806    variant_field_infos :  & [ VariantFieldInfo < ' ll > ] , 
807807    discr_type_di_node :  & ' ll  DIType , 
808808    tag_base_type :  Ty < ' tcx > , 
809-     tag_field :  usize , 
809+     tag_field :  FieldIdx , 
810810    untagged_variant_index :  Option < VariantIdx > , 
811811    di_flags :  DIFlags , 
812812)  -> SmallVec < & ' ll  DIType >  { 
@@ -859,7 +859,7 @@ fn build_union_fields_for_direct_tag_enum_or_coroutine<'ll, 'tcx>(
859859    } ) ) ; 
860860
861861    assert_eq ! ( 
862-         cx. size_and_align_of( enum_type_and_layout. field( cx,  tag_field) . ty) , 
862+         cx. size_and_align_of( enum_type_and_layout. field( cx,  tag_field. as_usize ( ) ) . ty) , 
863863        cx. size_and_align_of( self :: tag_base_type( cx. tcx,  enum_type_and_layout) ) 
864864    ) ; 
865865
@@ -876,7 +876,7 @@ fn build_union_fields_for_direct_tag_enum_or_coroutine<'ll, 'tcx>(
876876            Endian :: Big  => ( 8 ,  0 ) , 
877877        } ; 
878878
879-         let  tag_field_offset = enum_type_and_layout. fields . offset ( tag_field) . bytes ( ) ; 
879+         let  tag_field_offset = enum_type_and_layout. fields . offset ( tag_field. as_usize ( ) ) . bytes ( ) ; 
880880        let  lo_offset = Size :: from_bytes ( tag_field_offset + lo_offset) ; 
881881        let  hi_offset = Size :: from_bytes ( tag_field_offset + hi_offset) ; 
882882
@@ -906,8 +906,8 @@ fn build_union_fields_for_direct_tag_enum_or_coroutine<'ll, 'tcx>(
906906            cx, 
907907            enum_type_di_node, 
908908            TAG_FIELD_NAME , 
909-             enum_type_and_layout. field ( cx,  tag_field) , 
910-             enum_type_and_layout. fields . offset ( tag_field) , 
909+             enum_type_and_layout. field ( cx,  tag_field. as_usize ( ) ) , 
910+             enum_type_and_layout. fields . offset ( tag_field. as_usize ( ) ) , 
911911            di_flags, 
912912            tag_base_type_di_node, 
913913            None , 
0 commit comments