@@ -61,7 +61,6 @@ impl<'tcx> InterpCx<'tcx, CompileTimeMachine<'tcx>> {
6161 // Fill all fields of the `TypeInfo` struct.
6262 for ( idx, field) in ty_struct. fields . iter_enumerated ( ) {
6363 let field_dest = self . project_field ( dest, idx) ?;
64- let ptr_bit_width = || self . tcx . data_layout . pointer_size ( ) . bits ( ) ;
6564 match field. name {
6665 sym:: kind => {
6766 let variant_index = match ty. kind ( ) {
@@ -115,33 +114,19 @@ impl<'tcx> InterpCx<'tcx, CompileTimeMachine<'tcx>> {
115114 self . project_downcast_named ( & field_dest, sym:: Char ) ?;
116115 variant
117116 }
118- ty:: Int ( int_ty ) => {
119- let ( variant, variant_place ) =
117+ ty:: Int ( _ ) => {
118+ let ( variant, _variant_place ) =
120119 self . project_downcast_named ( & field_dest, sym:: Int ) ?;
121- let place = self . project_field ( & variant_place, FieldIdx :: ZERO ) ?;
122- self . write_int_type_info (
123- place,
124- int_ty. bit_width ( ) . unwrap_or_else ( /* isize */ ptr_bit_width) ,
125- true ,
126- ) ?;
127120 variant
128121 }
129- ty:: Uint ( uint_ty ) => {
130- let ( variant, variant_place ) =
122+ ty:: Uint ( _ ) => {
123+ let ( variant, _variant_place ) =
131124 self . project_downcast_named ( & field_dest, sym:: Int ) ?;
132- let place = self . project_field ( & variant_place, FieldIdx :: ZERO ) ?;
133- self . write_int_type_info (
134- place,
135- uint_ty. bit_width ( ) . unwrap_or_else ( /* usize */ ptr_bit_width) ,
136- false ,
137- ) ?;
138125 variant
139126 }
140- ty:: Float ( float_ty ) => {
141- let ( variant, variant_place ) =
127+ ty:: Float ( _ ) => {
128+ let ( variant, _variant_place ) =
142129 self . project_downcast_named ( & field_dest, sym:: Float ) ?;
143- let place = self . project_field ( & variant_place, FieldIdx :: ZERO ) ?;
144- self . write_float_type_info ( place, float_ty. bit_width ( ) ) ?;
145130 variant
146131 }
147132 ty:: Str => {
@@ -316,48 +301,6 @@ impl<'tcx> InterpCx<'tcx, CompileTimeMachine<'tcx>> {
316301 interp_ok ( ( ) )
317302 }
318303
319- fn write_int_type_info (
320- & mut self ,
321- place : impl Writeable < ' tcx , CtfeProvenance > ,
322- bit_width : u64 ,
323- signed : bool ,
324- ) -> InterpResult < ' tcx > {
325- for ( field_idx, field) in
326- place. layout ( ) . ty . ty_adt_def ( ) . unwrap ( ) . non_enum_variant ( ) . fields . iter_enumerated ( )
327- {
328- let field_place = self . project_field ( & place, field_idx) ?;
329- match field. name {
330- sym:: bits => self . write_scalar (
331- Scalar :: from_u32 ( bit_width. try_into ( ) . expect ( "bit_width overflowed" ) ) ,
332- & field_place,
333- ) ?,
334- sym:: signed => self . write_scalar ( Scalar :: from_bool ( signed) , & field_place) ?,
335- other => span_bug ! ( self . tcx. def_span( field. did) , "unimplemented field {other}" ) ,
336- }
337- }
338- interp_ok ( ( ) )
339- }
340-
341- fn write_float_type_info (
342- & mut self ,
343- place : impl Writeable < ' tcx , CtfeProvenance > ,
344- bit_width : u64 ,
345- ) -> InterpResult < ' tcx > {
346- for ( field_idx, field) in
347- place. layout ( ) . ty . ty_adt_def ( ) . unwrap ( ) . non_enum_variant ( ) . fields . iter_enumerated ( )
348- {
349- let field_place = self . project_field ( & place, field_idx) ?;
350- match field. name {
351- sym:: bits => self . write_scalar (
352- Scalar :: from_u32 ( bit_width. try_into ( ) . expect ( "bit_width overflowed" ) ) ,
353- & field_place,
354- ) ?,
355- other => span_bug ! ( self . tcx. def_span( field. did) , "unimplemented field {other}" ) ,
356- }
357- }
358- interp_ok ( ( ) )
359- }
360-
361304 pub ( crate ) fn write_reference_type_info (
362305 & mut self ,
363306 place : impl Writeable < ' tcx , CtfeProvenance > ,
0 commit comments