@@ -309,7 +309,7 @@ pub enum AllocError {
309
309
/// Partially copying a pointer.
310
310
ReadPartialPointer ( Size ) ,
311
311
/// Using uninitialized data where it is not allowed.
312
- InvalidUninitBytes ( Option < BadBytesAccess > ) ,
312
+ InvalidUninitBytes ( BadBytesAccess ) ,
313
313
}
314
314
pub type AllocResult < T = ( ) > = Result < T , AllocError > ;
315
315
@@ -336,7 +336,7 @@ impl AllocError {
336
336
UnsupportedOpInfo :: ReadPartialPointer ( Pointer :: new ( alloc_id, offset) ) ,
337
337
) ,
338
338
InvalidUninitBytes ( info) => InterpErrorKind :: UndefinedBehavior (
339
- UndefinedBehaviorInfo :: InvalidUninitBytes ( info . map ( |b| ( alloc_id, b ) ) ) ,
339
+ UndefinedBehaviorInfo :: InvalidUninitBytes ( alloc_id, info ) ,
340
340
) ,
341
341
}
342
342
}
@@ -597,10 +597,7 @@ impl<Prov: Provenance, Extra, Bytes: AllocBytes> Allocation<Prov, Extra, Bytes>
597
597
range : AllocRange ,
598
598
) -> AllocResult < & [ u8 ] > {
599
599
self . init_mask . is_range_initialized ( range) . map_err ( |uninit_range| {
600
- AllocError :: InvalidUninitBytes ( Some ( BadBytesAccess {
601
- access : range,
602
- bad : uninit_range,
603
- } ) )
600
+ AllocError :: InvalidUninitBytes ( BadBytesAccess { access : range, bad : uninit_range } )
604
601
} ) ?;
605
602
if !Prov :: OFFSET_IS_ADDR && !self . provenance . range_empty ( range, cx) {
606
603
// Find the provenance.
@@ -701,10 +698,7 @@ impl<Prov: Provenance, Extra, Bytes: AllocBytes> Allocation<Prov, Extra, Bytes>
701
698
) -> AllocResult < Scalar < Prov > > {
702
699
// First and foremost, if anything is uninit, bail.
703
700
if let Err ( bad) = self . init_mask . is_range_initialized ( range) {
704
- return Err ( AllocError :: InvalidUninitBytes ( Some ( BadBytesAccess {
705
- access : range,
706
- bad,
707
- } ) ) ) ;
701
+ return Err ( AllocError :: InvalidUninitBytes ( BadBytesAccess { access : range, bad } ) ) ;
708
702
}
709
703
710
704
// Get the integer part of the result. We HAVE TO check provenance before returning this!
0 commit comments