@@ -1310,29 +1310,20 @@ impl<'a, 'tcx, Prov: Provenance, Extra, Bytes: AllocBytes>
13101310 }
13111311
13121312 /// Mark the given sub-range (relative to this allocation reference) as uninitialized.
1313- pub fn write_uninit ( & mut self , range : AllocRange ) -> InterpResult < ' tcx > {
1313+ pub fn write_uninit ( & mut self , range : AllocRange ) {
13141314 let range = self . range . subrange ( range) ;
13151315
1316- self . alloc
1317- . write_uninit ( & self . tcx , range)
1318- . map_err ( |e| e. to_interp_error ( self . alloc_id ) )
1319- . into ( )
1316+ self . alloc . write_uninit ( & self . tcx , range) ;
13201317 }
13211318
13221319 /// Mark the entire referenced range as uninitialized
1323- pub fn write_uninit_full ( & mut self ) -> InterpResult < ' tcx > {
1324- self . alloc
1325- . write_uninit ( & self . tcx , self . range )
1326- . map_err ( |e| e. to_interp_error ( self . alloc_id ) )
1327- . into ( )
1320+ pub fn write_uninit_full ( & mut self ) {
1321+ self . alloc . write_uninit ( & self . tcx , self . range ) ;
13281322 }
13291323
13301324 /// Remove all provenance in the reference range.
1331- pub fn clear_provenance ( & mut self ) -> InterpResult < ' tcx > {
1332- self . alloc
1333- . clear_provenance ( & self . tcx , self . range )
1334- . map_err ( |e| e. to_interp_error ( self . alloc_id ) )
1335- . into ( )
1325+ pub fn clear_provenance ( & mut self ) {
1326+ self . alloc . clear_provenance ( & self . tcx , self . range ) ;
13361327 }
13371328}
13381329
@@ -1423,11 +1414,8 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
14231414
14241415 // Side-step AllocRef and directly access the underlying bytes more efficiently.
14251416 // (We are staying inside the bounds here and all bytes do get overwritten so all is good.)
1426- let alloc_id = alloc_ref. alloc_id ;
1427- let bytes = alloc_ref
1428- . alloc
1429- . get_bytes_unchecked_for_overwrite ( & alloc_ref. tcx , alloc_ref. range )
1430- . map_err ( move |e| e. to_interp_error ( alloc_id) ) ?;
1417+ let bytes =
1418+ alloc_ref. alloc . get_bytes_unchecked_for_overwrite ( & alloc_ref. tcx , alloc_ref. range ) ;
14311419 // `zip` would stop when the first iterator ends; we want to definitely
14321420 // cover all of `bytes`.
14331421 for dest in bytes {
@@ -1509,10 +1497,8 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
15091497 // `get_bytes_mut` will clear the provenance, which is correct,
15101498 // since we don't want to keep any provenance at the target.
15111499 // This will also error if copying partial provenance is not supported.
1512- let provenance = src_alloc
1513- . provenance ( )
1514- . prepare_copy ( src_range, dest_offset, num_copies, self )
1515- . map_err ( |e| e. to_interp_error ( src_alloc_id) ) ?;
1500+ let provenance =
1501+ src_alloc. provenance ( ) . prepare_copy ( src_range, dest_offset, num_copies, self ) ;
15161502 // Prepare a copy of the initialization mask.
15171503 let init = src_alloc. init_mask ( ) . prepare_copy ( src_range) ;
15181504
@@ -1530,10 +1516,8 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
15301516 dest_range,
15311517 ) ?;
15321518 // Yes we do overwrite all bytes in `dest_bytes`.
1533- let dest_bytes = dest_alloc
1534- . get_bytes_unchecked_for_overwrite_ptr ( & tcx, dest_range)
1535- . map_err ( |e| e. to_interp_error ( dest_alloc_id) ) ?
1536- . as_mut_ptr ( ) ;
1519+ let dest_bytes =
1520+ dest_alloc. get_bytes_unchecked_for_overwrite_ptr ( & tcx, dest_range) . as_mut_ptr ( ) ;
15371521
15381522 if init. no_bytes_init ( ) {
15391523 // Fast path: If all bytes are `uninit` then there is nothing to copy. The target range
@@ -1542,9 +1526,7 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
15421526 // This also avoids writing to the target bytes so that the backing allocation is never
15431527 // touched if the bytes stay uninitialized for the whole interpreter execution. On contemporary
15441528 // operating system this can avoid physically allocating the page.
1545- dest_alloc
1546- . write_uninit ( & tcx, dest_range)
1547- . map_err ( |e| e. to_interp_error ( dest_alloc_id) ) ?;
1529+ dest_alloc. write_uninit ( & tcx, dest_range) ;
15481530 // `write_uninit` also resets the provenance, so we are done.
15491531 return interp_ok ( ( ) ) ;
15501532 }
0 commit comments