@@ -241,7 +241,9 @@ impl<'a, 'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'a, 'mir, 'tcx, M> {
241241 }
242242 } ;
243243
244- let alloc_kind = self . alloc_kind . remove ( & ptr. alloc_id ) . expect ( "alloc_map out of sync with alloc_kind" ) ;
244+ let alloc_kind = self . alloc_kind
245+ . remove ( & ptr. alloc_id )
246+ . expect ( "alloc_map out of sync with alloc_kind" ) ;
245247
246248 // It is okay for us to still holds locks on deallocation -- for example, we could store
247249 // data we own in a local, and the local could be deallocated (from StorageDead) before the
@@ -259,7 +261,11 @@ impl<'a, 'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'a, 'mir, 'tcx, M> {
259261 }
260262 if let Some ( ( size, align) ) = size_and_align {
261263 if size. bytes ( ) != alloc. bytes . len ( ) as u64 || align != alloc. align {
262- return err ! ( IncorrectAllocationInformation ( size, Size :: from_bytes( alloc. bytes. len( ) as u64 ) , align, alloc. align) ) ;
264+ let bytes = Size :: from_bytes ( alloc. bytes . len ( ) as u64 ) ;
265+ return err ! ( IncorrectAllocationInformation ( size,
266+ bytes,
267+ align,
268+ alloc. align) ) ;
263269 }
264270 }
265271
@@ -678,7 +684,8 @@ impl<'a, 'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'a, 'mir, 'tcx, M> {
678684 relocations
679685 . iter ( )
680686 . map ( |& ( offset, alloc_id) | {
681- ( offset + dest. offset - src. offset + ( i * size * relocations. len ( ) as u64 ) , alloc_id)
687+ ( offset + dest. offset - src. offset + ( i * size * relocations. len ( ) as u64 ) ,
688+ alloc_id)
682689 } )
683690 ) ;
684691 }
@@ -707,11 +714,15 @@ impl<'a, 'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'a, 'mir, 'tcx, M> {
707714 }
708715
709716 for i in 0 ..length {
710- ptr:: copy ( src_bytes, dest_bytes. offset ( ( size. bytes ( ) * i) as isize ) , size. bytes ( ) as usize ) ;
717+ ptr:: copy ( src_bytes,
718+ dest_bytes. offset ( ( size. bytes ( ) * i) as isize ) ,
719+ size. bytes ( ) as usize ) ;
711720 }
712721 } else {
713722 for i in 0 ..length {
714- ptr:: copy_nonoverlapping ( src_bytes, dest_bytes. offset ( ( size. bytes ( ) * i) as isize ) , size. bytes ( ) as usize ) ;
723+ ptr:: copy_nonoverlapping ( src_bytes,
724+ dest_bytes. offset ( ( size. bytes ( ) * i) as isize ) ,
725+ size. bytes ( ) as usize ) ;
715726 }
716727 }
717728 }
@@ -778,7 +789,8 @@ impl<'a, 'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'a, 'mir, 'tcx, M> {
778789 }
779790
780791 /// Read a *non-ZST* scalar
781- pub fn read_scalar ( & self , ptr : Pointer , ptr_align : Align , size : Size ) -> EvalResult < ' tcx , ScalarMaybeUndef > {
792+ pub fn read_scalar ( & self , ptr : Pointer , ptr_align : Align , size : Size )
793+ -> EvalResult < ' tcx , ScalarMaybeUndef > {
782794 // Make sure we don't read part of a pointer as a pointer
783795 self . check_relocation_edges ( ptr, size) ?;
784796 let endianness = self . endianness ( ) ;
@@ -801,7 +813,10 @@ impl<'a, 'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'a, 'mir, 'tcx, M> {
801813 } else {
802814 let alloc = self . get ( ptr. alloc_id ) ?;
803815 match alloc. relocations . get ( & ptr. offset ) {
804- Some ( & alloc_id) => return Ok ( ScalarMaybeUndef :: Scalar ( Pointer :: new ( alloc_id, Size :: from_bytes ( bits as u64 ) ) . into ( ) ) ) ,
816+ Some ( & alloc_id) => {
817+ let ptr = Pointer :: new ( alloc_id, Size :: from_bytes ( bits as u64 ) ) ;
818+ return Ok ( ScalarMaybeUndef :: Scalar ( ptr. into ( ) ) )
819+ }
805820 None => { } ,
806821 }
807822 }
@@ -812,7 +827,8 @@ impl<'a, 'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'a, 'mir, 'tcx, M> {
812827 } ) )
813828 }
814829
815- pub fn read_ptr_sized ( & self , ptr : Pointer , ptr_align : Align ) -> EvalResult < ' tcx , ScalarMaybeUndef > {
830+ pub fn read_ptr_sized ( & self , ptr : Pointer , ptr_align : Align )
831+ -> EvalResult < ' tcx , ScalarMaybeUndef > {
816832 self . read_scalar ( ptr, ptr_align, self . pointer_size ( ) )
817833 }
818834
@@ -865,7 +881,8 @@ impl<'a, 'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'a, 'mir, 'tcx, M> {
865881 Ok ( ( ) )
866882 }
867883
868- pub fn write_ptr_sized ( & mut self , ptr : Pointer , ptr_align : Align , val : ScalarMaybeUndef ) -> EvalResult < ' tcx > {
884+ pub fn write_ptr_sized ( & mut self , ptr : Pointer , ptr_align : Align , val : ScalarMaybeUndef )
885+ -> EvalResult < ' tcx > {
869886 let ptr_size = self . pointer_size ( ) ;
870887 self . write_scalar ( ptr. into ( ) , ptr_align, val, ptr_size)
871888 }
@@ -1009,7 +1026,9 @@ pub trait HasMemory<'a, 'mir, 'tcx: 'a + 'mir, M: Machine<'mir, 'tcx>> {
10091026 fn memory ( & self ) -> & Memory < ' a , ' mir , ' tcx , M > ;
10101027}
10111028
1012- impl < ' a , ' mir , ' tcx , M : Machine < ' mir , ' tcx > > HasMemory < ' a , ' mir , ' tcx , M > for Memory < ' a , ' mir , ' tcx , M > {
1029+ impl < ' a , ' mir , ' tcx , M > HasMemory < ' a , ' mir , ' tcx , M > for Memory < ' a , ' mir , ' tcx , M >
1030+ where M : Machine < ' mir , ' tcx >
1031+ {
10131032 #[ inline]
10141033 fn memory_mut ( & mut self ) -> & mut Memory < ' a , ' mir , ' tcx , M > {
10151034 self
@@ -1021,7 +1040,9 @@ impl<'a, 'mir, 'tcx, M: Machine<'mir, 'tcx>> HasMemory<'a, 'mir, 'tcx, M> for Me
10211040 }
10221041}
10231042
1024- impl < ' a , ' mir , ' tcx , M : Machine < ' mir , ' tcx > > HasMemory < ' a , ' mir , ' tcx , M > for EvalContext < ' a , ' mir , ' tcx , M > {
1043+ impl < ' a , ' mir , ' tcx , M > HasMemory < ' a , ' mir , ' tcx , M > for EvalContext < ' a , ' mir , ' tcx , M >
1044+ where M : Machine < ' mir , ' tcx >
1045+ {
10251046 #[ inline]
10261047 fn memory_mut ( & mut self ) -> & mut Memory < ' a , ' mir , ' tcx , M > {
10271048 & mut self . memory
@@ -1033,7 +1054,9 @@ impl<'a, 'mir, 'tcx, M: Machine<'mir, 'tcx>> HasMemory<'a, 'mir, 'tcx, M> for Ev
10331054 }
10341055}
10351056
1036- impl < ' a , ' mir , ' tcx , M : Machine < ' mir , ' tcx > > layout:: HasDataLayout for & ' a Memory < ' a , ' mir , ' tcx , M > {
1057+ impl < ' a , ' mir , ' tcx , M > layout:: HasDataLayout for & ' a Memory < ' a , ' mir , ' tcx , M >
1058+ where M : Machine < ' mir , ' tcx >
1059+ {
10371060 #[ inline]
10381061 fn data_layout ( & self ) -> & TargetDataLayout {
10391062 & self . tcx . data_layout
0 commit comments