File tree 1 file changed +3
-1
lines changed
compiler/rustc_middle/src/mir/interpret
1 file changed +3
-1
lines changed Original file line number Diff line number Diff line change @@ -79,7 +79,7 @@ impl<'tcx> ConstValue<'tcx> {
79
79
}
80
80
81
81
pub fn try_to_scalar_int ( & self ) -> Option < ScalarInt > {
82
- Some ( self . try_to_scalar ( ) ?. assert_int ( ) )
82
+ self . try_to_scalar ( ) ?. try_to_int ( ) . ok ( )
83
83
}
84
84
85
85
pub fn try_to_bits ( & self , size : Size ) -> Option < u128 > {
@@ -368,6 +368,7 @@ impl<'tcx, Prov: Provenance> Scalar<Prov> {
368
368
}
369
369
370
370
#[ inline( always) ]
371
+ #[ cfg_attr( debug_assertions, track_caller) ] // only in debug builds due to perf (see #98980)
371
372
pub fn assert_int ( self ) -> ScalarInt {
372
373
self . try_to_int ( ) . unwrap ( )
373
374
}
@@ -389,6 +390,7 @@ impl<'tcx, Prov: Provenance> Scalar<Prov> {
389
390
}
390
391
391
392
#[ inline( always) ]
393
+ #[ cfg_attr( debug_assertions, track_caller) ] // only in debug builds due to perf (see #98980)
392
394
pub fn assert_bits ( self , target_size : Size ) -> u128 {
393
395
self . to_bits ( target_size) . unwrap ( )
394
396
}
You can’t perform that action at this time.
0 commit comments