@@ -9,7 +9,7 @@ use rustc::mir;
99use rustc:: mir:: interpret:: truncate;
1010use rustc:: ty:: { self , Ty } ;
1111use rustc:: ty:: layout:: {
12- self , Size , Abi , Align , LayoutOf , TyLayout , HasDataLayout , VariantIdx , PrimitiveExt
12+ self , Size , Align , LayoutOf , TyLayout , HasDataLayout , VariantIdx , PrimitiveExt
1313} ;
1414use rustc:: ty:: TypeFoldable ;
1515
@@ -377,20 +377,17 @@ where
377377 layout:: FieldPlacement :: Array { stride, .. } => {
378378 let len = base. len ( self ) ?;
379379 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 .
382382 debug ! ( "tried to access element {} of array/slice with length {}" , field, len) ;
383383 throw_panic ! ( BoundsCheck { len, index: field } ) ;
384384 }
385385 stride * field
386386 }
387387 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- }
392388 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) ;
394391 // Offset is always 0
395392 Size :: from_bytes ( 0 )
396393 }
0 commit comments