@@ -9,7 +9,7 @@ use rustc::mir;
9
9
use rustc:: mir:: interpret:: truncate;
10
10
use rustc:: ty:: { self , Ty } ;
11
11
use rustc:: ty:: layout:: {
12
- self , Size , Abi , Align , LayoutOf , TyLayout , HasDataLayout , VariantIdx , PrimitiveExt
12
+ self , Size , Align , LayoutOf , TyLayout , HasDataLayout , VariantIdx , PrimitiveExt
13
13
} ;
14
14
use rustc:: ty:: TypeFoldable ;
15
15
@@ -377,20 +377,17 @@ where
377
377
layout:: FieldPlacement :: Array { stride, .. } => {
378
378
let len = base. len ( self ) ?;
379
379
if field >= len {
380
- // This can be violated because this runs during promotion on code where the
381
- // type system has not yet ensured that such things don't happen .
380
+ // This can be violated because the index (field) can be a runtime value
381
+ // provided by the user .
382
382
debug ! ( "tried to access element {} of array/slice with length {}" , field, len) ;
383
383
throw_panic ! ( BoundsCheck { len, index: field } ) ;
384
384
}
385
385
stride * field
386
386
}
387
387
layout:: FieldPlacement :: Union ( count) => {
388
- // FIXME(#64506) `UninhabitedValue` can be removed when this issue is resolved
389
- if base. layout . abi == Abi :: Uninhabited {
390
- throw_unsup ! ( UninhabitedValue ) ;
391
- }
392
388
assert ! ( field < count as u64 ,
393
- "Tried to access field {} of union with {} fields" , field, count) ;
389
+ "Tried to access field {} of union {:#?} with {} fields" ,
390
+ field, base. layout, count) ;
394
391
// Offset is always 0
395
392
Size :: from_bytes ( 0 )
396
393
}
0 commit comments