Fix u8::MAX -> std::u8::MAX. (#2047)

As per Carlo Kok on Zulip #cranelift, this breaks builds with stable
Rust pre-1.43, as `core::u8::MAX` was only stabilized then. We'd like to
support older versions if we can easily do so.

This PR also adds `cranelift-tools` to the crates checked on CI with
Rust 1.41.0, which pulls in all backends (including `aarch64`).
This commit is contained in:
Chris Fallin
2020-07-20 12:59:15 -07:00
committed by GitHub
parent 4c15a4daf2
commit 96ef2f1a1b
2 changed files with 2 additions and 1 deletions

View File

@@ -129,6 +129,7 @@ jobs:
- run: rustup install 1.41.0 - run: rustup install 1.41.0
- run: cargo +1.41.0 check -p cranelift-codegen - run: cargo +1.41.0 check -p cranelift-codegen
- run: cargo +1.41.0 check -p cranelift-wasm - run: cargo +1.41.0 check -p cranelift-wasm
- run: cargo +1.41.0 check -p cranelift-tools
fuzz_targets: fuzz_targets:

View File

@@ -322,7 +322,7 @@ fn put_input_in_rs<C: LowerCtx<I = Inst>>(
// Can we get the shift amount as an immediate? // Can we get the shift amount as an immediate?
if let Some(shiftimm) = input_to_shiftimm(ctx, shift_amt) { if let Some(shiftimm) = input_to_shiftimm(ctx, shift_amt) {
let shiftee_bits = ty_bits(ctx.input_ty(insn, 0)); let shiftee_bits = ty_bits(ctx.input_ty(insn, 0));
if shiftee_bits <= u8::MAX as usize { if shiftee_bits <= std::u8::MAX as usize {
let shiftimm = shiftimm.mask(shiftee_bits as u8); let shiftimm = shiftimm.mask(shiftee_bits as u8);
let reg = put_input_in_reg(ctx, shiftee, narrow_mode); let reg = put_input_in_reg(ctx, shiftee, narrow_mode);
return ResultRS::RegShift(reg, ShiftOpAndAmt::new(ShiftOp::LSL, shiftimm)); return ResultRS::RegShift(reg, ShiftOpAndAmt::new(ShiftOp::LSL, shiftimm));