@@ -1309,29 +1309,20 @@ impl<'a, 'tcx, Prov: Provenance, Extra, Bytes: AllocBytes>
13091309 }
13101310
13111311 /// Mark the given sub-range (relative to this allocation reference) as uninitialized.
1312- pub fn write_uninit ( & mut self , range : AllocRange ) -> InterpResult < ' tcx > {
1312+ pub fn write_uninit ( & mut self , range : AllocRange ) {
13131313 let range = self . range . subrange ( range) ;
13141314
1315- self . alloc
1316- . write_uninit ( & self . tcx , range)
1317- . map_err ( |e| e. to_interp_error ( self . alloc_id ) )
1318- . into ( )
1315+ self . alloc . write_uninit ( & self . tcx , range) ;
13191316 }
13201317
13211318 /// Mark the entire referenced range as uninitialized
1322- pub fn write_uninit_full ( & mut self ) -> InterpResult < ' tcx > {
1323- self . alloc
1324- . write_uninit ( & self . tcx , self . range )
1325- . map_err ( |e| e. to_interp_error ( self . alloc_id ) )
1326- . into ( )
1319+ pub fn write_uninit_full ( & mut self ) {
1320+ self . alloc . write_uninit ( & self . tcx , self . range ) ;
13271321 }
13281322
13291323 /// Remove all provenance in the reference range.
1330- pub fn clear_provenance ( & mut self ) -> InterpResult < ' tcx > {
1331- self . alloc
1332- . clear_provenance ( & self . tcx , self . range )
1333- . map_err ( |e| e. to_interp_error ( self . alloc_id ) )
1334- . into ( )
1324+ pub fn clear_provenance ( & mut self ) {
1325+ self . alloc . clear_provenance ( & self . tcx , self . range ) ;
13351326 }
13361327}
13371328
@@ -1422,11 +1413,8 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
14221413
14231414 // Side-step AllocRef and directly access the underlying bytes more efficiently.
14241415 // (We are staying inside the bounds here and all bytes do get overwritten so all is good.)
1425- let alloc_id = alloc_ref. alloc_id ;
1426- let bytes = alloc_ref
1427- . alloc
1428- . get_bytes_unchecked_for_overwrite ( & alloc_ref. tcx , alloc_ref. range )
1429- . map_err ( move |e| e. to_interp_error ( alloc_id) ) ?;
1416+ let bytes =
1417+ alloc_ref. alloc . get_bytes_unchecked_for_overwrite ( & alloc_ref. tcx , alloc_ref. range ) ;
14301418 // `zip` would stop when the first iterator ends; we want to definitely
14311419 // cover all of `bytes`.
14321420 for dest in bytes {
@@ -1508,10 +1496,8 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
15081496 // `get_bytes_mut` will clear the provenance, which is correct,
15091497 // since we don't want to keep any provenance at the target.
15101498 // This will also error if copying partial provenance is not supported.
1511- let provenance = src_alloc
1512- . provenance ( )
1513- . prepare_copy ( src_range, dest_offset, num_copies, self )
1514- . map_err ( |e| e. to_interp_error ( src_alloc_id) ) ?;
1499+ let provenance =
1500+ src_alloc. provenance ( ) . prepare_copy ( src_range, dest_offset, num_copies, self ) ;
15151501 // Prepare a copy of the initialization mask.
15161502 let init = src_alloc. init_mask ( ) . prepare_copy ( src_range) ;
15171503
@@ -1529,10 +1515,8 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
15291515 dest_range,
15301516 ) ?;
15311517 // Yes we do overwrite all bytes in `dest_bytes`.
1532- let dest_bytes = dest_alloc
1533- . get_bytes_unchecked_for_overwrite_ptr ( & tcx, dest_range)
1534- . map_err ( |e| e. to_interp_error ( dest_alloc_id) ) ?
1535- . as_mut_ptr ( ) ;
1518+ let dest_bytes =
1519+ dest_alloc. get_bytes_unchecked_for_overwrite_ptr ( & tcx, dest_range) . as_mut_ptr ( ) ;
15361520
15371521 if init. no_bytes_init ( ) {
15381522 // Fast path: If all bytes are `uninit` then there is nothing to copy. The target range
@@ -1541,9 +1525,7 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
15411525 // This also avoids writing to the target bytes so that the backing allocation is never
15421526 // touched if the bytes stay uninitialized for the whole interpreter execution. On contemporary
15431527 // operating system this can avoid physically allocating the page.
1544- dest_alloc
1545- . write_uninit ( & tcx, dest_range)
1546- . map_err ( |e| e. to_interp_error ( dest_alloc_id) ) ?;
1528+ dest_alloc. write_uninit ( & tcx, dest_range) ;
15471529 // `write_uninit` also resets the provenance, so we are done.
15481530 return interp_ok ( ( ) ) ;
15491531 }
0 commit comments