-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bit-shift lint errors on cross-compiles #18587
Comments
There's currently a bug in it which fires erroneously on cross compiles, preventing new nightlies from being generated. This can be reset back to Deny once it's been fixed. cc rust-lang#18587
How can I find out the target architecture on cross compiles? |
I don't know off the top of my head what the best way is to do so, but you can take a look at |
Ok, I think I found it, working on it... |
Thanks @hirschenberger! |
Is it possible to add cross compilation tests? |
Sadly not currently :(. In #18206 I don't see a test for |
Do you think this will be enough? #[cfg(target_word_size = "32")]
let n = 1i << 32; //~ ERROR: bitshift exceeds the type's number of bits
#[cfg(target_word_size = "64")]
let n = 1i << 64; //~ ERROR: bitshift exceeds the type's number of bits |
There's currently a bug in it which fires erroneously on cross compiles, preventing new nightlies from being generated. This can be reset back to Deny once it's been fixed. cc #18587
Looks good to me! I'd add one for |
Sry I have a little syntax Problem: error: expected item after attributes #[cfg(target_word_size = "32")]
{
let n = 1i << 32; //~ ERROR: bitshift exceeds the type's number of bits
let n = 1u << 32; //~ ERROR: bitshift exceeds the type's number of bits
} doesn't work |
It's ok if you want to just wrap it up in something like: #[cfg(target_word_size = "32")]
fn dead_but_still_linted() {
let n = 1i << 32; //~ ERROR: bitshift exceeds the type's number of bits
let n = 1u << 32; //~ ERROR: bitshift exceeds the type's number of bits
} |
@alexcrichton Is it working for all cross compiles? Can we switch it to |
I think so, sure! |
Discussed in rust-lang#18587
fix: Fix syntax fixup inserting unnecessary semicolons
When crossing from 32-to-64 bit architectures the lint will fire erroneously, causing the standard library not to compile:
What's happening is that the lint is picking up the number of bits for the type
int
anduint
fromint::BITS
anduint::BITS
, but these are not the target architecture's number of bits.cc @hirschenberger, this will block a new nightly tonight.
The text was updated successfully, but these errors were encountered: