@@ -11,7 +11,7 @@ use rand::rngs::StdRng;
1111use syntax:: attr;
1212use syntax:: symbol:: sym;
1313use rustc:: hir:: def_id:: DefId ;
14- use rustc:: ty:: { self , layout:: { Size , LayoutOf } , query :: TyCtxtAt } ;
14+ use rustc:: ty:: { self , layout:: { Size , LayoutOf } , TyCtxt } ;
1515use rustc:: mir;
1616
1717use crate :: * ;
@@ -232,8 +232,8 @@ impl<'mir, 'tcx> Machine<'mir, 'tcx> for Evaluator<'tcx> {
232232 }
233233
234234 fn find_foreign_static (
235+ tcx : TyCtxt < ' tcx > ,
235236 def_id : DefId ,
236- tcx : TyCtxtAt < ' tcx > ,
237237 ) -> InterpResult < ' tcx , Cow < ' tcx , Allocation > > {
238238 let attrs = tcx. get_attrs ( def_id) ;
239239 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> {
263263 }
264264
265265 fn tag_allocation < ' b > (
266+ memory_extra : & MemoryExtra ,
266267 id : AllocId ,
267268 alloc : Cow < ' b , Allocation > ,
268269 kind : Option < MemoryKind < Self :: MemoryKinds > > ,
269- memory : & Memory < ' mir , ' tcx , Self > ,
270270 ) -> ( Cow < ' b , Allocation < Self :: PointerTag , Self :: AllocExtra > > , Self :: PointerTag ) {
271271 let kind = kind. expect ( "we set our STATIC_KIND so this cannot be None" ) ;
272272 let alloc = alloc. into_owned ( ) ;
273- let ( stacks, base_tag) = if !memory . extra . validate {
273+ let ( stacks, base_tag) = if !memory_extra . validate {
274274 ( None , Tag :: Untagged )
275275 } else {
276276 let ( stacks, base_tag) = Stacks :: new_allocation (
277277 id,
278278 Size :: from_bytes ( alloc. bytes . len ( ) as u64 ) ,
279- Rc :: clone ( & memory . extra . stacked_borrows ) ,
279+ Rc :: clone ( & memory_extra . stacked_borrows ) ,
280280 kind,
281281 ) ;
282282 ( Some ( stacks) , base_tag)
@@ -285,18 +285,18 @@ impl<'mir, 'tcx> Machine<'mir, 'tcx> for Evaluator<'tcx> {
285285 assert ! ( alloc. relocations. is_empty( ) , "Only statics can come initialized with inner pointers" ) ;
286286 // Now we can rely on the inner pointers being static, too.
287287 }
288- let mut memory_extra = memory . extra . stacked_borrows . borrow_mut ( ) ;
288+ let mut stacked_borrows = memory_extra . stacked_borrows . borrow_mut ( ) ;
289289 let alloc: Allocation < Tag , Self :: AllocExtra > = Allocation {
290290 bytes : alloc. bytes ,
291291 relocations : Relocations :: from_presorted (
292292 alloc. relocations . iter ( )
293293 // The allocations in the relocations (pointers stored *inside* this allocation)
294294 // all get the base pointer tag.
295295 . map ( |& ( offset, ( ( ) , alloc) ) | {
296- let tag = if !memory . extra . validate {
296+ let tag = if !memory_extra . validate {
297297 Tag :: Untagged
298298 } else {
299- memory_extra . static_base_ptr ( alloc)
299+ stacked_borrows . static_base_ptr ( alloc)
300300 } ;
301301 ( offset, ( tag, alloc) )
302302 } )
@@ -314,13 +314,13 @@ impl<'mir, 'tcx> Machine<'mir, 'tcx> for Evaluator<'tcx> {
314314
315315 #[ inline( always) ]
316316 fn tag_static_base_pointer (
317+ memory_extra : & MemoryExtra ,
317318 id : AllocId ,
318- memory : & Memory < ' mir , ' tcx , Self > ,
319319 ) -> Self :: PointerTag {
320- if !memory . extra . validate {
320+ if !memory_extra . validate {
321321 Tag :: Untagged
322322 } else {
323- memory . extra . stacked_borrows . borrow_mut ( ) . static_base_ptr ( id)
323+ memory_extra . stacked_borrows . borrow_mut ( ) . static_base_ptr ( id)
324324 }
325325 }
326326
@@ -354,8 +354,8 @@ impl<'mir, 'tcx> Machine<'mir, 'tcx> for Evaluator<'tcx> {
354354 }
355355
356356 fn int_to_ptr (
357- int : u64 ,
358357 memory : & Memory < ' mir , ' tcx , Self > ,
358+ int : u64 ,
359359 ) -> InterpResult < ' tcx , Pointer < Self :: PointerTag > > {
360360 if int == 0 {
361361 err ! ( InvalidNullPointerUsage )
@@ -367,8 +367,8 @@ impl<'mir, 'tcx> Machine<'mir, 'tcx> for Evaluator<'tcx> {
367367 }
368368
369369 fn ptr_to_int (
370- ptr : Pointer < Self :: PointerTag > ,
371370 memory : & Memory < ' mir , ' tcx , Self > ,
371+ ptr : Pointer < Self :: PointerTag > ,
372372 ) -> InterpResult < ' tcx , u64 > {
373373 if memory. extra . rng . is_none ( ) {
374374 err ! ( ReadPointerAsBytes )
0 commit comments