@@ -11,7 +11,7 @@ use rand::rngs::StdRng;
11
11
use syntax:: attr;
12
12
use syntax:: symbol:: sym;
13
13
use rustc:: hir:: def_id:: DefId ;
14
- use rustc:: ty:: { self , layout:: { Size , LayoutOf } , query :: TyCtxtAt } ;
14
+ use rustc:: ty:: { self , layout:: { Size , LayoutOf } , TyCtxt } ;
15
15
use rustc:: mir;
16
16
17
17
use crate :: * ;
@@ -232,8 +232,8 @@ impl<'mir, 'tcx> Machine<'mir, 'tcx> for Evaluator<'tcx> {
232
232
}
233
233
234
234
fn find_foreign_static (
235
+ tcx : TyCtxt < ' tcx > ,
235
236
def_id : DefId ,
236
- tcx : TyCtxtAt < ' tcx > ,
237
237
) -> InterpResult < ' tcx , Cow < ' tcx , Allocation > > {
238
238
let attrs = tcx. get_attrs ( def_id) ;
239
239
let link_name = match attr:: first_attr_value_str_by_name ( & attrs, sym:: link_name) {
@@ -263,20 +263,20 @@ impl<'mir, 'tcx> Machine<'mir, 'tcx> for Evaluator<'tcx> {
263
263
}
264
264
265
265
fn tag_allocation < ' b > (
266
+ memory_extra : & MemoryExtra ,
266
267
id : AllocId ,
267
268
alloc : Cow < ' b , Allocation > ,
268
269
kind : Option < MemoryKind < Self :: MemoryKinds > > ,
269
- memory : & Memory < ' mir , ' tcx , Self > ,
270
270
) -> ( Cow < ' b , Allocation < Self :: PointerTag , Self :: AllocExtra > > , Self :: PointerTag ) {
271
271
let kind = kind. expect ( "we set our STATIC_KIND so this cannot be None" ) ;
272
272
let alloc = alloc. into_owned ( ) ;
273
- let ( stacks, base_tag) = if !memory . extra . validate {
273
+ let ( stacks, base_tag) = if !memory_extra . validate {
274
274
( None , Tag :: Untagged )
275
275
} else {
276
276
let ( stacks, base_tag) = Stacks :: new_allocation (
277
277
id,
278
278
Size :: from_bytes ( alloc. bytes . len ( ) as u64 ) ,
279
- Rc :: clone ( & memory . extra . stacked_borrows ) ,
279
+ Rc :: clone ( & memory_extra . stacked_borrows ) ,
280
280
kind,
281
281
) ;
282
282
( Some ( stacks) , base_tag)
@@ -285,18 +285,18 @@ impl<'mir, 'tcx> Machine<'mir, 'tcx> for Evaluator<'tcx> {
285
285
assert ! ( alloc. relocations. is_empty( ) , "Only statics can come initialized with inner pointers" ) ;
286
286
// Now we can rely on the inner pointers being static, too.
287
287
}
288
- let mut memory_extra = memory . extra . stacked_borrows . borrow_mut ( ) ;
288
+ let mut stacked_borrows = memory_extra . stacked_borrows . borrow_mut ( ) ;
289
289
let alloc: Allocation < Tag , Self :: AllocExtra > = Allocation {
290
290
bytes : alloc. bytes ,
291
291
relocations : Relocations :: from_presorted (
292
292
alloc. relocations . iter ( )
293
293
// The allocations in the relocations (pointers stored *inside* this allocation)
294
294
// all get the base pointer tag.
295
295
. map ( |& ( offset, ( ( ) , alloc) ) | {
296
- let tag = if !memory . extra . validate {
296
+ let tag = if !memory_extra . validate {
297
297
Tag :: Untagged
298
298
} else {
299
- memory_extra . static_base_ptr ( alloc)
299
+ stacked_borrows . static_base_ptr ( alloc)
300
300
} ;
301
301
( offset, ( tag, alloc) )
302
302
} )
@@ -314,13 +314,13 @@ impl<'mir, 'tcx> Machine<'mir, 'tcx> for Evaluator<'tcx> {
314
314
315
315
#[ inline( always) ]
316
316
fn tag_static_base_pointer (
317
+ memory_extra : & MemoryExtra ,
317
318
id : AllocId ,
318
- memory : & Memory < ' mir , ' tcx , Self > ,
319
319
) -> Self :: PointerTag {
320
- if !memory . extra . validate {
320
+ if !memory_extra . validate {
321
321
Tag :: Untagged
322
322
} else {
323
- memory . extra . stacked_borrows . borrow_mut ( ) . static_base_ptr ( id)
323
+ memory_extra . stacked_borrows . borrow_mut ( ) . static_base_ptr ( id)
324
324
}
325
325
}
326
326
@@ -354,8 +354,8 @@ impl<'mir, 'tcx> Machine<'mir, 'tcx> for Evaluator<'tcx> {
354
354
}
355
355
356
356
fn int_to_ptr (
357
- int : u64 ,
358
357
memory : & Memory < ' mir , ' tcx , Self > ,
358
+ int : u64 ,
359
359
) -> InterpResult < ' tcx , Pointer < Self :: PointerTag > > {
360
360
if int == 0 {
361
361
err ! ( InvalidNullPointerUsage )
@@ -367,8 +367,8 @@ impl<'mir, 'tcx> Machine<'mir, 'tcx> for Evaluator<'tcx> {
367
367
}
368
368
369
369
fn ptr_to_int (
370
- ptr : Pointer < Self :: PointerTag > ,
371
370
memory : & Memory < ' mir , ' tcx , Self > ,
371
+ ptr : Pointer < Self :: PointerTag > ,
372
372
) -> InterpResult < ' tcx , u64 > {
373
373
if memory. extra . rng . is_none ( ) {
374
374
err ! ( ReadPointerAsBytes )
0 commit comments