]> git.lizzy.rs Git - rust.git/blob - src/test/ui/consts/const-float-bits-reject-conv.stderr
Ban subnormals and NaNs in const {from,to}_bits
[rust.git] / src / test / ui / consts / const-float-bits-reject-conv.stderr
1 error[E0080]: evaluation of constant value failed
2   --> $SRC_DIR/core/src/num/f32.rs:LL:COL
3    |
4 LL |                     panic!("const-eval error: cannot use f32::to_bits on a NaN")
5    |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6    |                     |
7    |                     the evaluated program panicked at 'const-eval error: cannot use f32::to_bits on a NaN', $SRC_DIR/core/src/num/f32.rs:LL:COL
8    |                     inside `core::f32::<impl f32>::to_bits::ct_f32_to_u32` at $SRC_DIR/core/src/panic.rs:LL:COL
9 ...
10 LL |         unsafe { intrinsics::const_eval_select((self,), ct_f32_to_u32, rt_f32_to_u32) }
11    |                  -------------------------------------------------------------------- inside `core::f32::<impl f32>::to_bits` at $SRC_DIR/core/src/num/f32.rs:LL:COL
12    |
13   ::: $SRC_DIR/core/src/ops/function.rs:LL:COL
14    |
15 LL |     extern "rust-call" fn call_once(self, args: Args) -> Self::Output;
16    |     ------------------------------------------------------------------ inside `<fn(f32) -> u32 {core::f32::<impl f32>::to_bits::ct_f32_to_u32} as FnOnce<(f32,)>>::call_once - shim(fn(f32) -> u32 {core::f32::<impl f32>::to_bits::ct_f32_to_u32})` at $SRC_DIR/core/src/ops/function.rs:LL:COL
17    |
18   ::: $SRC_DIR/core/src/intrinsics.rs:LL:COL
19    |
20 LL |     called_in_const.call_once(arg)
21    |     ------------------------------ inside `const_eval_select::<(f32,), fn(f32) -> u32 {core::f32::<impl f32>::to_bits::ct_f32_to_u32}, [closure@core::f32::<impl f32>::to_bits::{closure#0}], u32>` at $SRC_DIR/core/src/intrinsics.rs:LL:COL
22    |
23   ::: $DIR/const-float-bits-reject-conv.rs:27:30
24    |
25 LL |     const MASKED_NAN1: u32 = f32::NAN.to_bits() ^ 0x002A_AAAA;
26    |                              ------------------ inside `f32::MASKED_NAN1` at $DIR/const-float-bits-reject-conv.rs:27:30
27    |
28    = note: this error originates in the macro `$crate::panic::panic_2021` (in Nightly builds, run with -Z macro-backtrace for more info)
29
30 error[E0080]: evaluation of constant value failed
31   --> $SRC_DIR/core/src/num/f32.rs:LL:COL
32    |
33 LL |                     panic!("const-eval error: cannot use f32::to_bits on a NaN")
34    |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
35    |                     |
36    |                     the evaluated program panicked at 'const-eval error: cannot use f32::to_bits on a NaN', $SRC_DIR/core/src/num/f32.rs:LL:COL
37    |                     inside `core::f32::<impl f32>::to_bits::ct_f32_to_u32` at $SRC_DIR/core/src/panic.rs:LL:COL
38 ...
39 LL |         unsafe { intrinsics::const_eval_select((self,), ct_f32_to_u32, rt_f32_to_u32) }
40    |                  -------------------------------------------------------------------- inside `core::f32::<impl f32>::to_bits` at $SRC_DIR/core/src/num/f32.rs:LL:COL
41    |
42   ::: $SRC_DIR/core/src/ops/function.rs:LL:COL
43    |
44 LL |     extern "rust-call" fn call_once(self, args: Args) -> Self::Output;
45    |     ------------------------------------------------------------------ inside `<fn(f32) -> u32 {core::f32::<impl f32>::to_bits::ct_f32_to_u32} as FnOnce<(f32,)>>::call_once - shim(fn(f32) -> u32 {core::f32::<impl f32>::to_bits::ct_f32_to_u32})` at $SRC_DIR/core/src/ops/function.rs:LL:COL
46    |
47   ::: $SRC_DIR/core/src/intrinsics.rs:LL:COL
48    |
49 LL |     called_in_const.call_once(arg)
50    |     ------------------------------ inside `const_eval_select::<(f32,), fn(f32) -> u32 {core::f32::<impl f32>::to_bits::ct_f32_to_u32}, [closure@core::f32::<impl f32>::to_bits::{closure#0}], u32>` at $SRC_DIR/core/src/intrinsics.rs:LL:COL
51    |
52   ::: $DIR/const-float-bits-reject-conv.rs:28:30
53    |
54 LL |     const MASKED_NAN2: u32 = f32::NAN.to_bits() ^ 0x0055_5555;
55    |                              ------------------ inside `f32::MASKED_NAN2` at $DIR/const-float-bits-reject-conv.rs:28:30
56    |
57    = note: this error originates in the macro `$crate::panic::panic_2021` (in Nightly builds, run with -Z macro-backtrace for more info)
58
59 error[E0080]: evaluation of constant value failed
60   --> $SRC_DIR/core/src/num/f64.rs:LL:COL
61    |
62 LL |                     panic!("const-eval error: cannot use f64::to_bits on a NaN")
63    |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
64    |                     |
65    |                     the evaluated program panicked at 'const-eval error: cannot use f64::to_bits on a NaN', $SRC_DIR/core/src/num/f64.rs:LL:COL
66    |                     inside `core::f64::<impl f64>::to_bits::ct_f64_to_u64` at $SRC_DIR/core/src/panic.rs:LL:COL
67 ...
68 LL |         unsafe { intrinsics::const_eval_select((self,), ct_f64_to_u64, rt_f64_to_u64) }
69    |                  -------------------------------------------------------------------- inside `core::f64::<impl f64>::to_bits` at $SRC_DIR/core/src/num/f64.rs:LL:COL
70    |
71   ::: $SRC_DIR/core/src/ops/function.rs:LL:COL
72    |
73 LL |     extern "rust-call" fn call_once(self, args: Args) -> Self::Output;
74    |     ------------------------------------------------------------------ inside `<fn(f64) -> u64 {core::f64::<impl f64>::to_bits::ct_f64_to_u64} as FnOnce<(f64,)>>::call_once - shim(fn(f64) -> u64 {core::f64::<impl f64>::to_bits::ct_f64_to_u64})` at $SRC_DIR/core/src/ops/function.rs:LL:COL
75    |
76   ::: $SRC_DIR/core/src/intrinsics.rs:LL:COL
77    |
78 LL |     called_in_const.call_once(arg)
79    |     ------------------------------ inside `const_eval_select::<(f64,), fn(f64) -> u64 {core::f64::<impl f64>::to_bits::ct_f64_to_u64}, [closure@core::f64::<impl f64>::to_bits::{closure#0}], u64>` at $SRC_DIR/core/src/intrinsics.rs:LL:COL
80    |
81   ::: $DIR/const-float-bits-reject-conv.rs:46:30
82    |
83 LL |     const MASKED_NAN1: u64 = f64::NAN.to_bits() ^ 0x000A_AAAA_AAAA_AAAA;
84    |                              ------------------ inside `f64::MASKED_NAN1` at $DIR/const-float-bits-reject-conv.rs:46:30
85    |
86    = note: this error originates in the macro `$crate::panic::panic_2021` (in Nightly builds, run with -Z macro-backtrace for more info)
87
88 error[E0080]: evaluation of constant value failed
89   --> $SRC_DIR/core/src/num/f64.rs:LL:COL
90    |
91 LL |                     panic!("const-eval error: cannot use f64::to_bits on a NaN")
92    |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
93    |                     |
94    |                     the evaluated program panicked at 'const-eval error: cannot use f64::to_bits on a NaN', $SRC_DIR/core/src/num/f64.rs:LL:COL
95    |                     inside `core::f64::<impl f64>::to_bits::ct_f64_to_u64` at $SRC_DIR/core/src/panic.rs:LL:COL
96 ...
97 LL |         unsafe { intrinsics::const_eval_select((self,), ct_f64_to_u64, rt_f64_to_u64) }
98    |                  -------------------------------------------------------------------- inside `core::f64::<impl f64>::to_bits` at $SRC_DIR/core/src/num/f64.rs:LL:COL
99    |
100   ::: $SRC_DIR/core/src/ops/function.rs:LL:COL
101    |
102 LL |     extern "rust-call" fn call_once(self, args: Args) -> Self::Output;
103    |     ------------------------------------------------------------------ inside `<fn(f64) -> u64 {core::f64::<impl f64>::to_bits::ct_f64_to_u64} as FnOnce<(f64,)>>::call_once - shim(fn(f64) -> u64 {core::f64::<impl f64>::to_bits::ct_f64_to_u64})` at $SRC_DIR/core/src/ops/function.rs:LL:COL
104    |
105   ::: $SRC_DIR/core/src/intrinsics.rs:LL:COL
106    |
107 LL |     called_in_const.call_once(arg)
108    |     ------------------------------ inside `const_eval_select::<(f64,), fn(f64) -> u64 {core::f64::<impl f64>::to_bits::ct_f64_to_u64}, [closure@core::f64::<impl f64>::to_bits::{closure#0}], u64>` at $SRC_DIR/core/src/intrinsics.rs:LL:COL
109    |
110   ::: $DIR/const-float-bits-reject-conv.rs:47:30
111    |
112 LL |     const MASKED_NAN2: u64 = f64::NAN.to_bits() ^ 0x0005_5555_5555_5555;
113    |                              ------------------ inside `f64::MASKED_NAN2` at $DIR/const-float-bits-reject-conv.rs:47:30
114    |
115    = note: this error originates in the macro `$crate::panic::panic_2021` (in Nightly builds, run with -Z macro-backtrace for more info)
116
117 error: aborting due to 4 previous errors
118
119 For more information about this error, try `rustc --explain E0080`.