From 96ef2f1a1b219ecea41ef03e039b7034a7342f34 Mon Sep 17 00:00:00 2001 From: Chris Fallin Date: Mon, 20 Jul 2020 12:59:15 -0700 Subject: [PATCH] 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`). --- .github/workflows/main.yml | 1 + cranelift/codegen/src/isa/aarch64/lower.rs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e6a54b2498..88674b47d3 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -129,6 +129,7 @@ jobs: - run: rustup install 1.41.0 - 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-tools fuzz_targets: diff --git a/cranelift/codegen/src/isa/aarch64/lower.rs b/cranelift/codegen/src/isa/aarch64/lower.rs index 39b4b1c0be..dedba775ae 100644 --- a/cranelift/codegen/src/isa/aarch64/lower.rs +++ b/cranelift/codegen/src/isa/aarch64/lower.rs @@ -322,7 +322,7 @@ fn put_input_in_rs>( // Can we get the shift amount as an immediate? if let Some(shiftimm) = input_to_shiftimm(ctx, shift_amt) { 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 reg = put_input_in_reg(ctx, shiftee, narrow_mode); return ResultRS::RegShift(reg, ShiftOpAndAmt::new(ShiftOp::LSL, shiftimm));