@@ -110,7 +110,7 @@ pub(crate) fn codegen_const_value<'tcx>(
110
110
if fx. clif_type ( layout. ty ) . is_some ( ) {
111
111
return CValue :: const_val ( fx, layout, int) ;
112
112
} else {
113
- let raw_val = int. size ( ) . truncate ( int. to_bits ( int. size ( ) ) . unwrap ( ) ) ;
113
+ let raw_val = int. size ( ) . truncate ( int. assert_bits ( int. size ( ) ) ) ;
114
114
let val = match int. size ( ) . bytes ( ) {
115
115
1 => fx. bcx . ins ( ) . iconst ( types:: I8 , raw_val as i64 ) ,
116
116
2 => fx. bcx . ins ( ) . iconst ( types:: I16 , raw_val as i64 ) ,
@@ -491,27 +491,24 @@ pub(crate) fn mir_operand_get_const_val<'tcx>(
491
491
return None ;
492
492
}
493
493
let scalar_int = mir_operand_get_const_val ( fx, operand) ?;
494
- let scalar_int = match fx
495
- . layout_of ( * ty)
496
- . size
497
- . cmp ( & scalar_int. size ( ) )
498
- {
499
- Ordering :: Equal => scalar_int,
500
- Ordering :: Less => match ty. kind ( ) {
501
- ty:: Uint ( _) => ScalarInt :: try_from_uint (
502
- scalar_int. try_to_uint ( scalar_int. size ( ) ) . unwrap ( ) ,
503
- fx. layout_of ( * ty) . size ,
504
- )
505
- . unwrap ( ) ,
506
- ty:: Int ( _) => ScalarInt :: try_from_int (
507
- scalar_int. try_to_int ( scalar_int. size ( ) ) . unwrap ( ) ,
508
- fx. layout_of ( * ty) . size ,
509
- )
510
- . unwrap ( ) ,
511
- _ => unreachable ! ( ) ,
512
- } ,
513
- Ordering :: Greater => return None ,
514
- } ;
494
+ let scalar_int =
495
+ match fx. layout_of ( * ty) . size . cmp ( & scalar_int. size ( ) ) {
496
+ Ordering :: Equal => scalar_int,
497
+ Ordering :: Less => match ty. kind ( ) {
498
+ ty:: Uint ( _) => ScalarInt :: try_from_uint (
499
+ scalar_int. assert_uint ( scalar_int. size ( ) ) ,
500
+ fx. layout_of ( * ty) . size ,
501
+ )
502
+ . unwrap ( ) ,
503
+ ty:: Int ( _) => ScalarInt :: try_from_int (
504
+ scalar_int. assert_int ( scalar_int. size ( ) ) ,
505
+ fx. layout_of ( * ty) . size ,
506
+ )
507
+ . unwrap ( ) ,
508
+ _ => unreachable ! ( ) ,
509
+ } ,
510
+ Ordering :: Greater => return None ,
511
+ } ;
515
512
computed_scalar_int = Some ( scalar_int) ;
516
513
}
517
514
Rvalue :: Use ( operand) => {
0 commit comments