Stream: cranelift

Topic: odd error


view this post on Zulip Carlo Kok (Jul 20 2020 at 18:28):

error[E0599]: no associated item named `MAX` found for type `u8` in the current scope
   --> cranelift\codegen\src\isa\aarch64\lower.rs:325:40
    |
325 |                 if shiftee_bits <= u8::MAX as usize {
    |                                        ^^^ associated item not found in `u8`
    |
help: you are looking for the module in `std`, not the primitive type
    |
325 |                 if shiftee_bits <= std::u8::MAX as usize {
    |                                    ^^^^^^^^^^^^

view this post on Zulip Carlo Kok (Jul 20 2020 at 18:28):

what am I doing wrong?

view this post on Zulip Chris Fallin (Jul 20 2020 at 18:29):

Hmm, that's from my recent commit... are you building no_std? What version is your rustc?

view this post on Zulip Chris Fallin (Jul 20 2020 at 18:31):

(It looks like the fix is just as rustc says there; I can do a quick PR for that; but I'm curious how this arose)

view this post on Zulip Carlo Kok (Jul 20 2020 at 18:32):

trying an update to rustc 1.45.0 (5c1f21c3b 2020-07-13) now actually, was a few months behind

view this post on Zulip Carlo Kok (Jul 20 2020 at 18:32):

unfortunately, I didn't note what rust version I did have :(

view this post on Zulip Chris Fallin (Jul 20 2020 at 18:33):

A quick grep shows a number of other unqualified u32::MAX, etc., but I'm happy to fix this one if it broke some build configuration...

view this post on Zulip Carlo Kok (Jul 20 2020 at 18:35):

no need for me (presuming the update fixes it)

view this post on Zulip Chris Fallin (Jul 20 2020 at 18:35):

Oh, interesting, as per https://doc.rust-lang.org/std/primitive.u8.html the u8::MAX member (for primitive u8) is only stable in 1.43

view this post on Zulip Chris Fallin (Jul 20 2020 at 18:36):

We try to support 1.41; so I'll go ahead and fix this. Thanks!

view this post on Zulip Carlo Kok (Jul 20 2020 at 18:37):

damn; I accidentally selected a char in the console; so was waiting indefinitely for rust/windows to finish building (selection blocks stdout, which pauses rust)

view this post on Zulip Chris Fallin (Jul 20 2020 at 18:38):

Created https://github.com/bytecodealliance/wasmtime/pull/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.

view this post on Zulip Carlo Kok (Jul 20 2020 at 18:38):

you are fast.

view this post on Zulip Chris Fallin (Jul 20 2020 at 18:41):

rustc told me exactly what to do :-)

view this post on Zulip Carlo Kok (Jul 20 2020 at 18:42):

;0


Last updated: Dec 23 2024 at 13:07 UTC