File tree 1 file changed +5
-5
lines changed
1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,9 @@ use safety::{ensures, requires};
4
4
#[ cfg( kani) ]
5
5
use crate :: kani;
6
6
7
+ #[ allow( unused_imports) ]
8
+ use crate :: ub_checks:: float_to_int_in_range;
9
+
7
10
mod private {
8
11
/// This trait being unreachable from outside the crate
9
12
/// prevents other implementations of the `FloatToInt` trait,
@@ -31,11 +34,8 @@ macro_rules! impl_float_to_int {
31
34
#[ inline]
32
35
#[ requires(
33
36
!self . is_nan( ) &&
34
- !self . is_infinite( ) &&
35
- // Even if <$Int>::MIN < <$Float>::MIN or <$Int>::MAX > <$Float>::MAX,
36
- // the bounds would be -Inf or Inf, so they'll work anyways
37
- self > <$Int>:: MIN as $Float - 1.0 &&
38
- self < <$Int>:: MAX as $Float + 1.0
37
+ self . is_finite( ) &&
38
+ float_to_int_in_range:: <$Float, $Int>( self )
39
39
) ]
40
40
#[ ensures( |& result|{
41
41
let fract = self - result as $Float;
You can’t perform that action at this time.
0 commit comments