De-LLVM the unchecked shifts [MCP#693]
This is just one part of the MCP, but it's the one that IMHO removes the most noise from the standard library code. Seems net simpler this way, since MIR already supported heterogeneous shifts anyway, and thus it's not more work for backends than before.
This commit is contained in:
parent
69fa40cb48
commit
0601f0c66d
32 changed files with 405 additions and 576 deletions
|
|
@ -27,7 +27,7 @@ const SHL_U128: u128 = unsafe { intrinsics::unchecked_shl(5_u128, 128) };
|
|||
|
||||
const SHL_I8: i8 = unsafe { intrinsics::unchecked_shl(5_i8, 8) };
|
||||
//~^ ERROR evaluation of constant value failed
|
||||
const SHL_I16: i16 = unsafe { intrinsics::unchecked_shl(5_16, 16) };
|
||||
const SHL_I16: i16 = unsafe { intrinsics::unchecked_shl(5_i16, 16) };
|
||||
//~^ ERROR evaluation of constant value failed
|
||||
const SHL_I32: i32 = unsafe { intrinsics::unchecked_shl(5_i32, 32) };
|
||||
//~^ ERROR evaluation of constant value failed
|
||||
|
|
@ -40,7 +40,7 @@ const SHL_I128: i128 = unsafe { intrinsics::unchecked_shl(5_i128, 128) };
|
|||
|
||||
const SHL_I8_NEG: i8 = unsafe { intrinsics::unchecked_shl(5_i8, -1) };
|
||||
//~^ ERROR evaluation of constant value failed
|
||||
const SHL_I16_NEG: i16 = unsafe { intrinsics::unchecked_shl(5_16, -1) };
|
||||
const SHL_I16_NEG: i16 = unsafe { intrinsics::unchecked_shl(5_i16, -1) };
|
||||
//~^ ERROR evaluation of constant value failed
|
||||
const SHL_I32_NEG: i32 = unsafe { intrinsics::unchecked_shl(5_i32, -1) };
|
||||
//~^ ERROR evaluation of constant value failed
|
||||
|
|
@ -54,7 +54,7 @@ const SHL_I128_NEG: i128 = unsafe { intrinsics::unchecked_shl(5_i128, -1) };
|
|||
|
||||
const SHL_I8_NEG_RANDOM: i8 = unsafe { intrinsics::unchecked_shl(5_i8, -6) };
|
||||
//~^ ERROR evaluation of constant value failed
|
||||
const SHL_I16_NEG_RANDOM: i16 = unsafe { intrinsics::unchecked_shl(5_16, -13) };
|
||||
const SHL_I16_NEG_RANDOM: i16 = unsafe { intrinsics::unchecked_shl(5_i16, -13) };
|
||||
//~^ ERROR evaluation of constant value failed
|
||||
const SHL_I32_NEG_RANDOM: i32 = unsafe { intrinsics::unchecked_shl(5_i32, -25) };
|
||||
//~^ ERROR evaluation of constant value failed
|
||||
|
|
@ -82,7 +82,7 @@ const SHR_U128: u128 = unsafe { intrinsics::unchecked_shr(5_u128, 128) };
|
|||
|
||||
const SHR_I8: i8 = unsafe { intrinsics::unchecked_shr(5_i8, 8) };
|
||||
//~^ ERROR evaluation of constant value failed
|
||||
const SHR_I16: i16 = unsafe { intrinsics::unchecked_shr(5_16, 16) };
|
||||
const SHR_I16: i16 = unsafe { intrinsics::unchecked_shr(5_i16, 16) };
|
||||
//~^ ERROR evaluation of constant value failed
|
||||
const SHR_I32: i32 = unsafe { intrinsics::unchecked_shr(5_i32, 32) };
|
||||
//~^ ERROR evaluation of constant value failed
|
||||
|
|
@ -95,7 +95,7 @@ const SHR_I128: i128 = unsafe { intrinsics::unchecked_shr(5_i128, 128) };
|
|||
|
||||
const SHR_I8_NEG: i8 = unsafe { intrinsics::unchecked_shr(5_i8, -1) };
|
||||
//~^ ERROR evaluation of constant value failed
|
||||
const SHR_I16_NEG: i16 = unsafe { intrinsics::unchecked_shr(5_16, -1) };
|
||||
const SHR_I16_NEG: i16 = unsafe { intrinsics::unchecked_shr(5_i16, -1) };
|
||||
//~^ ERROR evaluation of constant value failed
|
||||
const SHR_I32_NEG: i32 = unsafe { intrinsics::unchecked_shr(5_i32, -1) };
|
||||
//~^ ERROR evaluation of constant value failed
|
||||
|
|
@ -109,7 +109,7 @@ const SHR_I128_NEG: i128 = unsafe { intrinsics::unchecked_shr(5_i128, -1) };
|
|||
|
||||
const SHR_I8_NEG_RANDOM: i8 = unsafe { intrinsics::unchecked_shr(5_i8, -6) };
|
||||
//~^ ERROR evaluation of constant value failed
|
||||
const SHR_I16_NEG_RANDOM: i16 = unsafe { intrinsics::unchecked_shr(5_16, -13) };
|
||||
const SHR_I16_NEG_RANDOM: i16 = unsafe { intrinsics::unchecked_shr(5_i16, -13) };
|
||||
//~^ ERROR evaluation of constant value failed
|
||||
const SHR_I32_NEG_RANDOM: i32 = unsafe { intrinsics::unchecked_shr(5_i32, -25) };
|
||||
//~^ ERROR evaluation of constant value failed
|
||||
|
|
|
|||
|
|
@ -37,8 +37,8 @@ LL | const SHL_I8: i8 = unsafe { intrinsics::unchecked_shl(5_i8, 8) };
|
|||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/const-int-unchecked.rs:30:31
|
||||
|
|
||||
LL | const SHL_I16: i16 = unsafe { intrinsics::unchecked_shl(5_16, 16) };
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflowing shift by 16 in `unchecked_shl`
|
||||
LL | const SHL_I16: i16 = unsafe { intrinsics::unchecked_shl(5_i16, 16) };
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflowing shift by 16 in `unchecked_shl`
|
||||
|
||||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/const-int-unchecked.rs:32:31
|
||||
|
|
@ -67,8 +67,8 @@ LL | const SHL_I8_NEG: i8 = unsafe { intrinsics::unchecked_shl(5_i8, -1) };
|
|||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/const-int-unchecked.rs:43:35
|
||||
|
|
||||
LL | const SHL_I16_NEG: i16 = unsafe { intrinsics::unchecked_shl(5_16, -1) };
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflowing shift by -1 in `unchecked_shl`
|
||||
LL | const SHL_I16_NEG: i16 = unsafe { intrinsics::unchecked_shl(5_i16, -1) };
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflowing shift by -1 in `unchecked_shl`
|
||||
|
||||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/const-int-unchecked.rs:45:35
|
||||
|
|
@ -97,8 +97,8 @@ LL | const SHL_I8_NEG_RANDOM: i8 = unsafe { intrinsics::unchecked_shl(5_i8, -6)
|
|||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/const-int-unchecked.rs:57:42
|
||||
|
|
||||
LL | const SHL_I16_NEG_RANDOM: i16 = unsafe { intrinsics::unchecked_shl(5_16, -13) };
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflowing shift by -13 in `unchecked_shl`
|
||||
LL | const SHL_I16_NEG_RANDOM: i16 = unsafe { intrinsics::unchecked_shl(5_i16, -13) };
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflowing shift by -13 in `unchecked_shl`
|
||||
|
||||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/const-int-unchecked.rs:59:42
|
||||
|
|
@ -157,8 +157,8 @@ LL | const SHR_I8: i8 = unsafe { intrinsics::unchecked_shr(5_i8, 8) };
|
|||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/const-int-unchecked.rs:85:31
|
||||
|
|
||||
LL | const SHR_I16: i16 = unsafe { intrinsics::unchecked_shr(5_16, 16) };
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflowing shift by 16 in `unchecked_shr`
|
||||
LL | const SHR_I16: i16 = unsafe { intrinsics::unchecked_shr(5_i16, 16) };
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflowing shift by 16 in `unchecked_shr`
|
||||
|
||||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/const-int-unchecked.rs:87:31
|
||||
|
|
@ -187,8 +187,8 @@ LL | const SHR_I8_NEG: i8 = unsafe { intrinsics::unchecked_shr(5_i8, -1) };
|
|||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/const-int-unchecked.rs:98:35
|
||||
|
|
||||
LL | const SHR_I16_NEG: i16 = unsafe { intrinsics::unchecked_shr(5_16, -1) };
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflowing shift by -1 in `unchecked_shr`
|
||||
LL | const SHR_I16_NEG: i16 = unsafe { intrinsics::unchecked_shr(5_i16, -1) };
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflowing shift by -1 in `unchecked_shr`
|
||||
|
||||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/const-int-unchecked.rs:100:35
|
||||
|
|
@ -217,8 +217,8 @@ LL | const SHR_I8_NEG_RANDOM: i8 = unsafe { intrinsics::unchecked_shr(5_i8, -6)
|
|||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/const-int-unchecked.rs:112:42
|
||||
|
|
||||
LL | const SHR_I16_NEG_RANDOM: i16 = unsafe { intrinsics::unchecked_shr(5_16, -13) };
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflowing shift by -13 in `unchecked_shr`
|
||||
LL | const SHR_I16_NEG_RANDOM: i16 = unsafe { intrinsics::unchecked_shr(5_i16, -13) };
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflowing shift by -13 in `unchecked_shr`
|
||||
|
||||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/const-int-unchecked.rs:114:42
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue