@@ -1099,19 +1099,16 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
10991099
11001100 let is_linux = matches ! ( & * this. tcx. sess. target. os, "linux" ) ;
11011101
1102- let dirent64_layout = if is_linux {
1103- this. libc_ty_layout ( "dirent64" )
1104- } else {
1105- this. libc_ty_layout ( "dirent" )
1106- } ;
1107- let fields = & dirent64_layout. fields ;
1108- let last_field = ( * fields) . count ( ) . strict_sub ( 1 ) ;
1109- let d_name_offset = ( * fields) . offset ( last_field) . bytes ( ) ;
1102+ let dirent_type = if is_linux { "dirent64" } else { "dirent" } ;
1103+ let dirent_layout = this. libc_ty_layout ( dirent_type) ;
1104+ let fields = & dirent_layout. fields ;
1105+ let last_field = fields. count ( ) . strict_sub ( 1 ) ;
1106+ let d_name_offset = fields. offset ( last_field) . bytes ( ) ;
11101107 let size = d_name_offset. strict_add ( name_len) ;
11111108
11121109 let entry = this. allocate_ptr (
11131110 Size :: from_bytes ( size) ,
1114- dirent64_layout . align . abi ,
1111+ dirent_layout . align . abi ,
11151112 MiriMemoryKind :: Runtime . into ( ) ,
11161113 ) ?;
11171114 let entry: Pointer = entry. into ( ) ;
@@ -1126,13 +1123,12 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
11261123 let file_type = this. file_type_to_d_type ( dir_entry. file_type ( ) ) ?;
11271124 this. write_int_fields_named (
11281125 & [ ( "d_ino" , ino. into ( ) ) , ( "d_off" , 0 ) , ( "d_reclen" , size. into ( ) ) ] ,
1129- & this. ptr_to_mplace ( entry, dirent64_layout ) ,
1126+ & this. ptr_to_mplace ( entry, dirent_layout ) ,
11301127 ) ?;
11311128
1132- if let Some ( d_type) = this. try_project_field_named (
1133- & this. ptr_to_mplace ( entry, dirent64_layout) ,
1134- "d_type" ,
1135- ) ? {
1129+ if let Some ( d_type) = this
1130+ . try_project_field_named ( & this. ptr_to_mplace ( entry, dirent_layout) , "d_type" ) ?
1131+ {
11361132 this. write_int ( file_type, & d_type) ?;
11371133 }
11381134
0 commit comments