Skip to content

Commit d8198ca

Browse files
committed
const-stabilize the unchecked_{add,sub,mul} *intrinsics*
This is only the intrinsics, which aren't exposed anywhere, so I think we can just do this without an FCP. The behaviour of these is well understood, have been implemented for ages, and don't offer any new functionality to `const fn`s -- it would be completely legal for them to be implemented via `wrapping_add`, since we don't promise to catch all UB.
1 parent 09d52bc commit d8198ca

File tree

4 files changed

+52
-54
lines changed

4 files changed

+52
-54
lines changed

library/core/src/intrinsics.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1760,21 +1760,21 @@ extern "rust-intrinsic" {
17601760
/// undefined behavior when `x + y > T::MAX` or `x + y < T::MIN`.
17611761
///
17621762
/// This intrinsic does not have a stable counterpart.
1763-
#[rustc_const_unstable(feature = "const_int_unchecked_arith", issue = "none")]
1763+
#[rustc_const_stable(feature = "const_int_unchecked_arith", since = "1.63.0")]
17641764
pub fn unchecked_add<T: Copy>(x: T, y: T) -> T;
17651765

17661766
/// Returns the result of an unchecked subtraction, resulting in
17671767
/// undefined behavior when `x - y > T::MAX` or `x - y < T::MIN`.
17681768
///
17691769
/// This intrinsic does not have a stable counterpart.
1770-
#[rustc_const_unstable(feature = "const_int_unchecked_arith", issue = "none")]
1770+
#[rustc_const_stable(feature = "const_int_unchecked_arith", since = "1.63.0")]
17711771
pub fn unchecked_sub<T: Copy>(x: T, y: T) -> T;
17721772

17731773
/// Returns the result of an unchecked multiplication, resulting in
17741774
/// undefined behavior when `x * y > T::MAX` or `x * y < T::MIN`.
17751775
///
17761776
/// This intrinsic does not have a stable counterpart.
1777-
#[rustc_const_unstable(feature = "const_int_unchecked_arith", issue = "none")]
1777+
#[rustc_const_stable(feature = "const_int_unchecked_arith", since = "1.63.0")]
17781778
pub fn unchecked_mul<T: Copy>(x: T, y: T) -> T;
17791779

17801780
/// Performs rotate left.

library/core/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,6 @@
113113
#![feature(const_heap)]
114114
#![feature(const_convert)]
115115
#![feature(const_inherent_unchecked_arith)]
116-
#![feature(const_int_unchecked_arith)]
117116
#![feature(const_intrinsic_forget)]
118117
#![feature(const_likely)]
119118
#![feature(const_maybe_uninit_uninit_array)]

src/test/ui/consts/const-int-unchecked.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#![feature(core_intrinsics)]
2-
#![feature(const_int_unchecked_arith)]
32

43
use std::intrinsics;
54

src/test/ui/consts/const-int-unchecked.stderr

+49-49
Original file line numberDiff line numberDiff line change
@@ -1,293 +1,293 @@
11
error[E0080]: evaluation of constant value failed
2-
--> $DIR/const-int-unchecked.rs:15:29
2+
--> $DIR/const-int-unchecked.rs:14:29
33
|
44
LL | const SHL_U8: u8 = unsafe { intrinsics::unchecked_shl(5_u8, 8) };
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflowing shift by 8 in `unchecked_shl`
66

77
error[E0080]: evaluation of constant value failed
8-
--> $DIR/const-int-unchecked.rs:17:31
8+
--> $DIR/const-int-unchecked.rs:16:31
99
|
1010
LL | const SHL_U16: u16 = unsafe { intrinsics::unchecked_shl(5_u16, 16) };
1111
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflowing shift by 16 in `unchecked_shl`
1212

1313
error[E0080]: evaluation of constant value failed
14-
--> $DIR/const-int-unchecked.rs:19:31
14+
--> $DIR/const-int-unchecked.rs:18:31
1515
|
1616
LL | const SHL_U32: u32 = unsafe { intrinsics::unchecked_shl(5_u32, 32) };
1717
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflowing shift by 32 in `unchecked_shl`
1818

1919
error[E0080]: evaluation of constant value failed
20-
--> $DIR/const-int-unchecked.rs:21:31
20+
--> $DIR/const-int-unchecked.rs:20:31
2121
|
2222
LL | const SHL_U64: u64 = unsafe { intrinsics::unchecked_shl(5_u64, 64) };
2323
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflowing shift by 64 in `unchecked_shl`
2424

2525
error[E0080]: evaluation of constant value failed
26-
--> $DIR/const-int-unchecked.rs:23:33
26+
--> $DIR/const-int-unchecked.rs:22:33
2727
|
2828
LL | const SHL_U128: u128 = unsafe { intrinsics::unchecked_shl(5_u128, 128) };
2929
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflowing shift by 128 in `unchecked_shl`
3030

3131
error[E0080]: evaluation of constant value failed
32-
--> $DIR/const-int-unchecked.rs:28:29
32+
--> $DIR/const-int-unchecked.rs:27:29
3333
|
3434
LL | const SHL_I8: i8 = unsafe { intrinsics::unchecked_shl(5_i8, 8) };
3535
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflowing shift by 8 in `unchecked_shl`
3636

3737
error[E0080]: evaluation of constant value failed
38-
--> $DIR/const-int-unchecked.rs:30:31
38+
--> $DIR/const-int-unchecked.rs:29:31
3939
|
4040
LL | const SHL_I16: i16 = unsafe { intrinsics::unchecked_shl(5_16, 16) };
4141
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflowing shift by 16 in `unchecked_shl`
4242

4343
error[E0080]: evaluation of constant value failed
44-
--> $DIR/const-int-unchecked.rs:32:31
44+
--> $DIR/const-int-unchecked.rs:31:31
4545
|
4646
LL | const SHL_I32: i32 = unsafe { intrinsics::unchecked_shl(5_i32, 32) };
4747
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflowing shift by 32 in `unchecked_shl`
4848

4949
error[E0080]: evaluation of constant value failed
50-
--> $DIR/const-int-unchecked.rs:34:31
50+
--> $DIR/const-int-unchecked.rs:33:31
5151
|
5252
LL | const SHL_I64: i64 = unsafe { intrinsics::unchecked_shl(5_i64, 64) };
5353
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflowing shift by 64 in `unchecked_shl`
5454

5555
error[E0080]: evaluation of constant value failed
56-
--> $DIR/const-int-unchecked.rs:36:33
56+
--> $DIR/const-int-unchecked.rs:35:33
5757
|
5858
LL | const SHL_I128: i128 = unsafe { intrinsics::unchecked_shl(5_i128, 128) };
5959
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflowing shift by 128 in `unchecked_shl`
6060

6161
error[E0080]: evaluation of constant value failed
62-
--> $DIR/const-int-unchecked.rs:41:33
62+
--> $DIR/const-int-unchecked.rs:40:33
6363
|
6464
LL | const SHL_I8_NEG: i8 = unsafe { intrinsics::unchecked_shl(5_i8, -1) };
6565
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflowing shift by 255 in `unchecked_shl`
6666

6767
error[E0080]: evaluation of constant value failed
68-
--> $DIR/const-int-unchecked.rs:43:35
68+
--> $DIR/const-int-unchecked.rs:42:35
6969
|
7070
LL | const SHL_I16_NEG: i16 = unsafe { intrinsics::unchecked_shl(5_16, -1) };
7171
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflowing shift by 65535 in `unchecked_shl`
7272

7373
error[E0080]: evaluation of constant value failed
74-
--> $DIR/const-int-unchecked.rs:45:35
74+
--> $DIR/const-int-unchecked.rs:44:35
7575
|
7676
LL | const SHL_I32_NEG: i32 = unsafe { intrinsics::unchecked_shl(5_i32, -1) };
7777
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflowing shift by 4294967295 in `unchecked_shl`
7878

7979
error[E0080]: evaluation of constant value failed
80-
--> $DIR/const-int-unchecked.rs:47:35
80+
--> $DIR/const-int-unchecked.rs:46:35
8181
|
8282
LL | const SHL_I64_NEG: i64 = unsafe { intrinsics::unchecked_shl(5_i64, -1) };
8383
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflowing shift by 18446744073709551615 in `unchecked_shl`
8484

8585
error[E0080]: evaluation of constant value failed
86-
--> $DIR/const-int-unchecked.rs:49:37
86+
--> $DIR/const-int-unchecked.rs:48:37
8787
|
8888
LL | const SHL_I128_NEG: i128 = unsafe { intrinsics::unchecked_shl(5_i128, -1) };
8989
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflowing shift by 340282366920938463463374607431768211455 in `unchecked_shl`
9090

9191
error[E0080]: evaluation of constant value failed
92-
--> $DIR/const-int-unchecked.rs:55:40
92+
--> $DIR/const-int-unchecked.rs:54:40
9393
|
9494
LL | const SHL_I8_NEG_RANDOM: i8 = unsafe { intrinsics::unchecked_shl(5_i8, -6) };
9595
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflowing shift by 250 in `unchecked_shl`
9696

9797
error[E0080]: evaluation of constant value failed
98-
--> $DIR/const-int-unchecked.rs:57:42
98+
--> $DIR/const-int-unchecked.rs:56:42
9999
|
100100
LL | const SHL_I16_NEG_RANDOM: i16 = unsafe { intrinsics::unchecked_shl(5_16, -13) };
101101
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflowing shift by 65523 in `unchecked_shl`
102102

103103
error[E0080]: evaluation of constant value failed
104-
--> $DIR/const-int-unchecked.rs:59:42
104+
--> $DIR/const-int-unchecked.rs:58:42
105105
|
106106
LL | const SHL_I32_NEG_RANDOM: i32 = unsafe { intrinsics::unchecked_shl(5_i32, -25) };
107107
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflowing shift by 4294967271 in `unchecked_shl`
108108

109109
error[E0080]: evaluation of constant value failed
110-
--> $DIR/const-int-unchecked.rs:61:42
110+
--> $DIR/const-int-unchecked.rs:60:42
111111
|
112112
LL | const SHL_I64_NEG_RANDOM: i64 = unsafe { intrinsics::unchecked_shl(5_i64, -30) };
113113
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflowing shift by 18446744073709551586 in `unchecked_shl`
114114

115115
error[E0080]: evaluation of constant value failed
116-
--> $DIR/const-int-unchecked.rs:63:44
116+
--> $DIR/const-int-unchecked.rs:62:44
117117
|
118118
LL | const SHL_I128_NEG_RANDOM: i128 = unsafe { intrinsics::unchecked_shl(5_i128, -93) };
119119
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflowing shift by 340282366920938463463374607431768211363 in `unchecked_shl`
120120

121121
error[E0080]: evaluation of constant value failed
122-
--> $DIR/const-int-unchecked.rs:70:29
122+
--> $DIR/const-int-unchecked.rs:69:29
123123
|
124124
LL | const SHR_U8: u8 = unsafe { intrinsics::unchecked_shr(5_u8, 8) };
125125
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflowing shift by 8 in `unchecked_shr`
126126

127127
error[E0080]: evaluation of constant value failed
128-
--> $DIR/const-int-unchecked.rs:72:31
128+
--> $DIR/const-int-unchecked.rs:71:31
129129
|
130130
LL | const SHR_U16: u16 = unsafe { intrinsics::unchecked_shr(5_u16, 16) };
131131
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflowing shift by 16 in `unchecked_shr`
132132

133133
error[E0080]: evaluation of constant value failed
134-
--> $DIR/const-int-unchecked.rs:74:31
134+
--> $DIR/const-int-unchecked.rs:73:31
135135
|
136136
LL | const SHR_U32: u32 = unsafe { intrinsics::unchecked_shr(5_u32, 32) };
137137
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflowing shift by 32 in `unchecked_shr`
138138

139139
error[E0080]: evaluation of constant value failed
140-
--> $DIR/const-int-unchecked.rs:76:31
140+
--> $DIR/const-int-unchecked.rs:75:31
141141
|
142142
LL | const SHR_U64: u64 = unsafe { intrinsics::unchecked_shr(5_u64, 64) };
143143
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflowing shift by 64 in `unchecked_shr`
144144

145145
error[E0080]: evaluation of constant value failed
146-
--> $DIR/const-int-unchecked.rs:78:33
146+
--> $DIR/const-int-unchecked.rs:77:33
147147
|
148148
LL | const SHR_U128: u128 = unsafe { intrinsics::unchecked_shr(5_u128, 128) };
149149
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflowing shift by 128 in `unchecked_shr`
150150

151151
error[E0080]: evaluation of constant value failed
152-
--> $DIR/const-int-unchecked.rs:83:29
152+
--> $DIR/const-int-unchecked.rs:82:29
153153
|
154154
LL | const SHR_I8: i8 = unsafe { intrinsics::unchecked_shr(5_i8, 8) };
155155
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflowing shift by 8 in `unchecked_shr`
156156

157157
error[E0080]: evaluation of constant value failed
158-
--> $DIR/const-int-unchecked.rs:85:31
158+
--> $DIR/const-int-unchecked.rs:84:31
159159
|
160160
LL | const SHR_I16: i16 = unsafe { intrinsics::unchecked_shr(5_16, 16) };
161161
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflowing shift by 16 in `unchecked_shr`
162162

163163
error[E0080]: evaluation of constant value failed
164-
--> $DIR/const-int-unchecked.rs:87:31
164+
--> $DIR/const-int-unchecked.rs:86:31
165165
|
166166
LL | const SHR_I32: i32 = unsafe { intrinsics::unchecked_shr(5_i32, 32) };
167167
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflowing shift by 32 in `unchecked_shr`
168168

169169
error[E0080]: evaluation of constant value failed
170-
--> $DIR/const-int-unchecked.rs:89:31
170+
--> $DIR/const-int-unchecked.rs:88:31
171171
|
172172
LL | const SHR_I64: i64 = unsafe { intrinsics::unchecked_shr(5_i64, 64) };
173173
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflowing shift by 64 in `unchecked_shr`
174174

175175
error[E0080]: evaluation of constant value failed
176-
--> $DIR/const-int-unchecked.rs:91:33
176+
--> $DIR/const-int-unchecked.rs:90:33
177177
|
178178
LL | const SHR_I128: i128 = unsafe { intrinsics::unchecked_shr(5_i128, 128) };
179179
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflowing shift by 128 in `unchecked_shr`
180180

181181
error[E0080]: evaluation of constant value failed
182-
--> $DIR/const-int-unchecked.rs:96:33
182+
--> $DIR/const-int-unchecked.rs:95:33
183183
|
184184
LL | const SHR_I8_NEG: i8 = unsafe { intrinsics::unchecked_shr(5_i8, -1) };
185185
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflowing shift by 255 in `unchecked_shr`
186186

187187
error[E0080]: evaluation of constant value failed
188-
--> $DIR/const-int-unchecked.rs:98:35
188+
--> $DIR/const-int-unchecked.rs:97:35
189189
|
190190
LL | const SHR_I16_NEG: i16 = unsafe { intrinsics::unchecked_shr(5_16, -1) };
191191
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflowing shift by 65535 in `unchecked_shr`
192192

193193
error[E0080]: evaluation of constant value failed
194-
--> $DIR/const-int-unchecked.rs:100:35
194+
--> $DIR/const-int-unchecked.rs:99:35
195195
|
196196
LL | const SHR_I32_NEG: i32 = unsafe { intrinsics::unchecked_shr(5_i32, -1) };
197197
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflowing shift by 4294967295 in `unchecked_shr`
198198

199199
error[E0080]: evaluation of constant value failed
200-
--> $DIR/const-int-unchecked.rs:102:35
200+
--> $DIR/const-int-unchecked.rs:101:35
201201
|
202202
LL | const SHR_I64_NEG: i64 = unsafe { intrinsics::unchecked_shr(5_i64, -1) };
203203
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflowing shift by 18446744073709551615 in `unchecked_shr`
204204

205205
error[E0080]: evaluation of constant value failed
206-
--> $DIR/const-int-unchecked.rs:104:37
206+
--> $DIR/const-int-unchecked.rs:103:37
207207
|
208208
LL | const SHR_I128_NEG: i128 = unsafe { intrinsics::unchecked_shr(5_i128, -1) };
209209
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflowing shift by 340282366920938463463374607431768211455 in `unchecked_shr`
210210

211211
error[E0080]: evaluation of constant value failed
212-
--> $DIR/const-int-unchecked.rs:110:40
212+
--> $DIR/const-int-unchecked.rs:109:40
213213
|
214214
LL | const SHR_I8_NEG_RANDOM: i8 = unsafe { intrinsics::unchecked_shr(5_i8, -6) };
215215
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflowing shift by 250 in `unchecked_shr`
216216

217217
error[E0080]: evaluation of constant value failed
218-
--> $DIR/const-int-unchecked.rs:112:42
218+
--> $DIR/const-int-unchecked.rs:111:42
219219
|
220220
LL | const SHR_I16_NEG_RANDOM: i16 = unsafe { intrinsics::unchecked_shr(5_16, -13) };
221221
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflowing shift by 65523 in `unchecked_shr`
222222

223223
error[E0080]: evaluation of constant value failed
224-
--> $DIR/const-int-unchecked.rs:114:42
224+
--> $DIR/const-int-unchecked.rs:113:42
225225
|
226226
LL | const SHR_I32_NEG_RANDOM: i32 = unsafe { intrinsics::unchecked_shr(5_i32, -25) };
227227
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflowing shift by 4294967271 in `unchecked_shr`
228228

229229
error[E0080]: evaluation of constant value failed
230-
--> $DIR/const-int-unchecked.rs:116:42
230+
--> $DIR/const-int-unchecked.rs:115:42
231231
|
232232
LL | const SHR_I64_NEG_RANDOM: i64 = unsafe { intrinsics::unchecked_shr(5_i64, -30) };
233233
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflowing shift by 18446744073709551586 in `unchecked_shr`
234234

235235
error[E0080]: evaluation of constant value failed
236-
--> $DIR/const-int-unchecked.rs:118:44
236+
--> $DIR/const-int-unchecked.rs:117:44
237237
|
238238
LL | const SHR_I128_NEG_RANDOM: i128 = unsafe { intrinsics::unchecked_shr(5_i128, -93) };
239239
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflowing shift by 340282366920938463463374607431768211363 in `unchecked_shr`
240240

241241
error[E0080]: evaluation of constant value failed
242-
--> $DIR/const-int-unchecked.rs:123:25
242+
--> $DIR/const-int-unchecked.rs:122:25
243243
|
244244
LL | const _: u16 = unsafe { std::intrinsics::unchecked_add(40000u16, 30000) };
245245
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflow executing `unchecked_add`
246246

247247
error[E0080]: evaluation of constant value failed
248-
--> $DIR/const-int-unchecked.rs:126:25
248+
--> $DIR/const-int-unchecked.rs:125:25
249249
|
250250
LL | const _: u32 = unsafe { std::intrinsics::unchecked_sub(14u32, 22) };
251251
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflow executing `unchecked_sub`
252252

253253
error[E0080]: evaluation of constant value failed
254-
--> $DIR/const-int-unchecked.rs:129:25
254+
--> $DIR/const-int-unchecked.rs:128:25
255255
|
256256
LL | const _: u16 = unsafe { std::intrinsics::unchecked_mul(300u16, 250u16) };
257257
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflow executing `unchecked_mul`
258258

259259
error[E0080]: evaluation of constant value failed
260-
--> $DIR/const-int-unchecked.rs:132:25
260+
--> $DIR/const-int-unchecked.rs:131:25
261261
|
262262
LL | const _: i32 = unsafe { std::intrinsics::unchecked_div(1, 0) };
263263
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ dividing by zero
264264

265265
error[E0080]: evaluation of constant value failed
266-
--> $DIR/const-int-unchecked.rs:134:25
266+
--> $DIR/const-int-unchecked.rs:133:25
267267
|
268268
LL | const _: i32 = unsafe { std::intrinsics::unchecked_div(i32::MIN, -1) };
269269
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflow in signed division (dividing MIN by -1)
270270

271271
error[E0080]: evaluation of constant value failed
272-
--> $DIR/const-int-unchecked.rs:137:25
272+
--> $DIR/const-int-unchecked.rs:136:25
273273
|
274274
LL | const _: i32 = unsafe { std::intrinsics::unchecked_rem(1, 0) };
275275
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ calculating the remainder with a divisor of zero
276276

277277
error[E0080]: evaluation of constant value failed
278-
--> $DIR/const-int-unchecked.rs:139:25
278+
--> $DIR/const-int-unchecked.rs:138:25
279279
|
280280
LL | const _: i32 = unsafe { std::intrinsics::unchecked_rem(i32::MIN, -1) };
281281
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflow in signed remainder (dividing MIN by -1)
282282

283283
error[E0080]: evaluation of constant value failed
284-
--> $DIR/const-int-unchecked.rs:144:25
284+
--> $DIR/const-int-unchecked.rs:143:25
285285
|
286286
LL | const _: u32 = unsafe { std::intrinsics::ctlz_nonzero(0) };
287287
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `ctlz_nonzero` called on 0
288288

289289
error[E0080]: evaluation of constant value failed
290-
--> $DIR/const-int-unchecked.rs:146:25
290+
--> $DIR/const-int-unchecked.rs:145:25
291291
|
292292
LL | const _: u32 = unsafe { std::intrinsics::cttz_nonzero(0) };
293293
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `cttz_nonzero` called on 0

0 commit comments

Comments
 (0)