File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed
src/librustc/mir/interpret Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -368,10 +368,10 @@ impl<'tcx, Tag> Scalar<Tag> {
368368 target_size : Size ,
369369 cx : & impl HasDataLayout ,
370370 ) -> Result < u128 , Pointer < Tag > > {
371+ assert_ne ! ( target_size. bytes( ) , 0 , "you should never look at the bits of a ZST" ) ;
371372 match self {
372373 Scalar :: Raw { data, size } => {
373374 assert_eq ! ( target_size. bytes( ) , size as u64 ) ;
374- assert_ne ! ( size, 0 , "you should never look at the bits of a ZST" ) ;
375375 Scalar :: check_data ( data, size) ;
376376 Ok ( data)
377377 }
@@ -386,10 +386,10 @@ impl<'tcx, Tag> Scalar<Tag> {
386386 /// It is just a helper for other methods in this file.
387387 #[ inline]
388388 fn to_bits ( self , target_size : Size ) -> InterpResult < ' tcx , u128 > {
389+ assert_ne ! ( target_size. bytes( ) , 0 , "you should never look at the bits of a ZST" ) ;
389390 match self {
390391 Scalar :: Raw { data, size } => {
391392 assert_eq ! ( target_size. bytes( ) , size as u64 ) ;
392- assert_ne ! ( size, 0 , "you should never look at the bits of a ZST" ) ;
393393 Scalar :: check_data ( data, size) ;
394394 Ok ( data)
395395 }
You can’t perform that action at this time.
0 commit comments