@@ -4,12 +4,9 @@ use std::mem;
4
4
use log:: trace;
5
5
6
6
use rustc_middle:: mir;
7
- use rustc_middle:: ty:: {
8
- self ,
9
- layout:: { self , LayoutOf , Size , TyAndLayout } ,
10
- List , TyCtxt ,
11
- } ;
7
+ use rustc_middle:: ty:: { self , List , TyCtxt , layout:: TyAndLayout } ;
12
8
use rustc_hir:: def_id:: { DefId , CRATE_DEF_INDEX } ;
9
+ use rustc_target:: abi:: { LayoutOf , Size , FieldsShape , Variants } ;
13
10
14
11
use rand:: RngCore ;
15
12
@@ -298,7 +295,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
298
295
// walking this value, we have to make sure it is not a
299
296
// `Variants::Multiple`.
300
297
match v. layout . variants {
301
- layout :: Variants :: Multiple { .. } => {
298
+ Variants :: Multiple { .. } => {
302
299
// A multi-variant enum, or generator, or so.
303
300
// Treat this like a union: without reading from memory,
304
301
// we cannot determine the variant we are in. Reading from
@@ -308,7 +305,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
308
305
// `UnsafeCell` action.
309
306
( self . unsafe_cell_action ) ( v)
310
307
}
311
- layout :: Variants :: Single { .. } => {
308
+ Variants :: Single { .. } => {
312
309
// Proceed further, try to find where exactly that `UnsafeCell`
313
310
// is hiding.
314
311
self . walk_value ( v)
@@ -324,19 +321,19 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
324
321
fields : impl Iterator < Item = InterpResult < ' tcx , MPlaceTy < ' tcx , Tag > > > ,
325
322
) -> InterpResult < ' tcx > {
326
323
match place. layout . fields {
327
- layout :: FieldsShape :: Array { .. } => {
324
+ FieldsShape :: Array { .. } => {
328
325
// For the array layout, we know the iterator will yield sorted elements so
329
326
// we can avoid the allocation.
330
327
self . walk_aggregate ( place, fields)
331
328
}
332
- layout :: FieldsShape :: Arbitrary { .. } => {
329
+ FieldsShape :: Arbitrary { .. } => {
333
330
// Gather the subplaces and sort them before visiting.
334
331
let mut places =
335
332
fields. collect :: < InterpResult < ' tcx , Vec < MPlaceTy < ' tcx , Tag > > > > ( ) ?;
336
333
places. sort_by_key ( |place| place. ptr . assert_ptr ( ) . offset ) ;
337
334
self . walk_aggregate ( place, places. into_iter ( ) . map ( Ok ) )
338
335
}
339
- layout :: FieldsShape :: Union { .. } => {
336
+ FieldsShape :: Union { .. } => {
340
337
// Uh, what?
341
338
bug ! ( "a union is not an aggregate we should ever visit" )
342
339
}
0 commit comments