Skip to content

Bit-shift lint errors on cross-compiles #18587

Closed
@alexcrichton

Description

@alexcrichton

When crossing from 32-to-64 bit architectures the lint will fire erroneously, causing the standard library not to compile:

rustc: i686-apple-darwin/stage2/lib/rustlib/x86_64-apple-darwin/lib/libcore
/Users/rustbuild/src/rust-buildbot/slave/nightly-mac/build/src/libcore/num/int_macros.rs:28:21: 28:45 error: bitshift exceeds the type's number of bits, #[deny(exceeding_bitshifts)] on by default
/Users/rustbuild/src/rust-buildbot/slave/nightly-mac/build/src/libcore/num/int_macros.rs:28 pub const MIN: $T = (-1 as $T) << (BITS - 1);
                                                                                                                ^~~~~~~~~~~~~~~~~~~~~~~~
/Users/rustbuild/src/rust-buildbot/slave/nightly-mac/build/src/libcore/num/int_macros.rs:14:1: 35:3 note: in expansion of int_module!
/Users/rustbuild/src/rust-buildbot/slave/nightly-mac/build/src/libcore/num/int.rs:17:33: 17:53 note: expansion site
error: aborting due to previous error
make: *** [i686-apple-darwin/stage2/lib/rustlib/x86_64-apple-darwin/lib/stamp.core] Error 101

What's happening is that the lint is picking up the number of bits for the type int and uint from int::BITS and uint::BITS, but these are not the target architecture's number of bits.

cc @hirschenberger, this will block a new nightly tonight.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions