@@ -446,7 +446,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: MiriEvalContextExt<'mir, 'tcx> {
446446 /// Atomic variant of read_scalar_at_offset.
447447 fn read_scalar_at_offset_atomic (
448448 & self ,
449- op : OpTy < ' tcx , Tag > ,
449+ op : & OpTy < ' tcx , Tag > ,
450450 offset : u64 ,
451451 layout : TyAndLayout < ' tcx > ,
452452 atomic : AtomicReadOp ,
@@ -458,13 +458,13 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: MiriEvalContextExt<'mir, 'tcx> {
458458 // Ensure that the following read at an offset is within bounds.
459459 assert ! ( op_place. layout. size >= offset + layout. size) ;
460460 let value_place = op_place. offset ( offset, MemPlaceMeta :: None , layout, this) ?;
461- this. read_scalar_atomic ( value_place, atomic)
461+ this. read_scalar_atomic ( & value_place, atomic)
462462 }
463463
464464 /// Atomic variant of write_scalar_at_offset.
465465 fn write_scalar_at_offset_atomic (
466466 & mut self ,
467- op : OpTy < ' tcx , Tag > ,
467+ op : & OpTy < ' tcx , Tag > ,
468468 offset : u64 ,
469469 value : impl Into < ScalarMaybeUninit < Tag > > ,
470470 layout : TyAndLayout < ' tcx > ,
@@ -477,17 +477,17 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: MiriEvalContextExt<'mir, 'tcx> {
477477 // Ensure that the following read at an offset is within bounds.
478478 assert ! ( op_place. layout. size >= offset + layout. size) ;
479479 let value_place = op_place. offset ( offset, MemPlaceMeta :: None , layout, this) ?;
480- this. write_scalar_atomic ( value. into ( ) , value_place, atomic)
480+ this. write_scalar_atomic ( value. into ( ) , & value_place, atomic)
481481 }
482482
483483 /// Perform an atomic read operation at the memory location.
484484 fn read_scalar_atomic (
485485 & self ,
486- place : MPlaceTy < ' tcx , Tag > ,
486+ place : & MPlaceTy < ' tcx , Tag > ,
487487 atomic : AtomicReadOp ,
488488 ) -> InterpResult < ' tcx , ScalarMaybeUninit < Tag > > {
489489 let this = self . eval_context_ref ( ) ;
490- let scalar = this. allow_data_races_ref ( move |this| this. read_scalar ( place. into ( ) ) ) ?;
490+ let scalar = this. allow_data_races_ref ( move |this| this. read_scalar ( & place. into ( ) ) ) ?;
491491 self . validate_atomic_load ( place, atomic) ?;
492492 Ok ( scalar)
493493 }
@@ -496,31 +496,31 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: MiriEvalContextExt<'mir, 'tcx> {
496496 fn write_scalar_atomic (
497497 & mut self ,
498498 val : ScalarMaybeUninit < Tag > ,
499- dest : MPlaceTy < ' tcx , Tag > ,
499+ dest : & MPlaceTy < ' tcx , Tag > ,
500500 atomic : AtomicWriteOp ,
501501 ) -> InterpResult < ' tcx > {
502502 let this = self . eval_context_mut ( ) ;
503- this. allow_data_races_mut ( move |this| this. write_scalar ( val, dest. into ( ) ) ) ?;
503+ this. allow_data_races_mut ( move |this| this. write_scalar ( val, & ( * dest) . into ( ) ) ) ?;
504504 self . validate_atomic_store ( dest, atomic)
505505 }
506506
507507 /// Perform a atomic operation on a memory location.
508508 fn atomic_op_immediate (
509509 & mut self ,
510- place : MPlaceTy < ' tcx , Tag > ,
511- rhs : ImmTy < ' tcx , Tag > ,
510+ place : & MPlaceTy < ' tcx , Tag > ,
511+ rhs : & ImmTy < ' tcx , Tag > ,
512512 op : mir:: BinOp ,
513513 neg : bool ,
514514 atomic : AtomicRwOp ,
515515 ) -> InterpResult < ' tcx , ImmTy < ' tcx , Tag > > {
516516 let this = self . eval_context_mut ( ) ;
517517
518- let old = this. allow_data_races_mut ( |this| this. read_immediate ( place. into ( ) ) ) ?;
518+ let old = this. allow_data_races_mut ( |this| this. read_immediate ( & place. into ( ) ) ) ?;
519519
520520 // Atomics wrap around on overflow.
521- let val = this. binary_op ( op, old, rhs) ?;
522- let val = if neg { this. unary_op ( mir:: UnOp :: Not , val) ? } else { val } ;
523- this. allow_data_races_mut ( |this| this. write_immediate ( * val, place. into ( ) ) ) ?;
521+ let val = this. binary_op ( op, & old, rhs) ?;
522+ let val = if neg { this. unary_op ( mir:: UnOp :: Not , & val) ? } else { val } ;
523+ this. allow_data_races_mut ( |this| this. write_immediate ( * val, & ( * place) . into ( ) ) ) ?;
524524
525525 this. validate_atomic_rmw ( place, atomic) ?;
526526 Ok ( old)
@@ -530,14 +530,14 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: MiriEvalContextExt<'mir, 'tcx> {
530530 /// scalar value, the old value is returned.
531531 fn atomic_exchange_scalar (
532532 & mut self ,
533- place : MPlaceTy < ' tcx , Tag > ,
533+ place : & MPlaceTy < ' tcx , Tag > ,
534534 new : ScalarMaybeUninit < Tag > ,
535535 atomic : AtomicRwOp ,
536536 ) -> InterpResult < ' tcx , ScalarMaybeUninit < Tag > > {
537537 let this = self . eval_context_mut ( ) ;
538538
539- let old = this. allow_data_races_mut ( |this| this. read_scalar ( place. into ( ) ) ) ?;
540- this. allow_data_races_mut ( |this| this. write_scalar ( new, place. into ( ) ) ) ?;
539+ let old = this. allow_data_races_mut ( |this| this. read_scalar ( & place. into ( ) ) ) ?;
540+ this. allow_data_races_mut ( |this| this. write_scalar ( new, & ( * place) . into ( ) ) ) ?;
541541 this. validate_atomic_rmw ( place, atomic) ?;
542542 Ok ( old)
543543 }
@@ -550,8 +550,8 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: MiriEvalContextExt<'mir, 'tcx> {
550550 /// identical.
551551 fn atomic_compare_exchange_scalar (
552552 & mut self ,
553- place : MPlaceTy < ' tcx , Tag > ,
554- expect_old : ImmTy < ' tcx , Tag > ,
553+ place : & MPlaceTy < ' tcx , Tag > ,
554+ expect_old : & ImmTy < ' tcx , Tag > ,
555555 new : ScalarMaybeUninit < Tag > ,
556556 success : AtomicRwOp ,
557557 fail : AtomicReadOp ,
@@ -564,9 +564,9 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: MiriEvalContextExt<'mir, 'tcx> {
564564 // to read with the failure ordering and if successful then try again with the success
565565 // read ordering and write in the success case.
566566 // Read as immediate for the sake of `binary_op()`
567- let old = this. allow_data_races_mut ( |this| this. read_immediate ( place. into ( ) ) ) ?;
567+ let old = this. allow_data_races_mut ( |this| this. read_immediate ( & ( place. into ( ) ) ) ) ?;
568568 // `binary_op` will bail if either of them is not a scalar.
569- let eq = this. overflowing_binary_op ( mir:: BinOp :: Eq , old, expect_old) ?. 0 ;
569+ let eq = this. overflowing_binary_op ( mir:: BinOp :: Eq , & old, expect_old) ?. 0 ;
570570 // If the operation would succeed, but is "weak", fail some portion
571571 // of the time, based on `rate`.
572572 let rate = this. memory . extra . cmpxchg_weak_failure_rate ;
@@ -581,7 +581,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: MiriEvalContextExt<'mir, 'tcx> {
581581 // if successful, perform a full rw-atomic validation
582582 // otherwise treat this as an atomic load with the fail ordering.
583583 if cmpxchg_success {
584- this. allow_data_races_mut ( |this| this. write_scalar ( new, place. into ( ) ) ) ?;
584+ this. allow_data_races_mut ( |this| this. write_scalar ( new, & ( * place) . into ( ) ) ) ?;
585585 this. validate_atomic_rmw ( place, success) ?;
586586 } else {
587587 this. validate_atomic_load ( place, fail) ?;
@@ -595,7 +595,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: MiriEvalContextExt<'mir, 'tcx> {
595595 /// associated memory-place and on the current thread.
596596 fn validate_atomic_load (
597597 & self ,
598- place : MPlaceTy < ' tcx , Tag > ,
598+ place : & MPlaceTy < ' tcx , Tag > ,
599599 atomic : AtomicReadOp ,
600600 ) -> InterpResult < ' tcx > {
601601 let this = self . eval_context_ref ( ) ;
@@ -617,7 +617,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: MiriEvalContextExt<'mir, 'tcx> {
617617 /// associated memory-place and on the current thread.
618618 fn validate_atomic_store (
619619 & mut self ,
620- place : MPlaceTy < ' tcx , Tag > ,
620+ place : & MPlaceTy < ' tcx , Tag > ,
621621 atomic : AtomicWriteOp ,
622622 ) -> InterpResult < ' tcx > {
623623 let this = self . eval_context_ref ( ) ;
@@ -639,7 +639,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: MiriEvalContextExt<'mir, 'tcx> {
639639 /// at the associated memory place and on the current thread.
640640 fn validate_atomic_rmw (
641641 & mut self ,
642- place : MPlaceTy < ' tcx , Tag > ,
642+ place : & MPlaceTy < ' tcx , Tag > ,
643643 atomic : AtomicRwOp ,
644644 ) -> InterpResult < ' tcx > {
645645 use AtomicRwOp :: * ;
@@ -973,7 +973,7 @@ trait EvalContextPrivExt<'mir, 'tcx: 'mir>: MiriEvalContextExt<'mir, 'tcx> {
973973 /// atomic-stores/atomic-rmw?
974974 fn validate_atomic_op < A : Debug + Copy > (
975975 & self ,
976- place : MPlaceTy < ' tcx , Tag > ,
976+ place : & MPlaceTy < ' tcx , Tag > ,
977977 atomic : A ,
978978 description : & str ,
979979 mut op : impl FnMut (
0 commit comments