Skip to content
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

"exceeding bitshifts" lint does not always work in debug mode on playground #70660

Closed
RalfJung opened this issue Apr 1, 2020 · 6 comments
Closed
Labels
C-bug Category: This is a bug.

Comments

@RalfJung
Copy link
Member

RalfJung commented Apr 1, 2020

I tried this code:

#![crate_type = "lib"]
pub fn foo(x: i32) -> i32 {
    x << 33
}

I am building in debug mode on the playground.

I expected to see this happen: it should warn about the exceeding bitshift (like it does in release mode).

Instead, this happened: there is no warning,

Meta

Possibly related to #69021

@RalfJung
Copy link
Member Author

RalfJung commented Apr 1, 2020

I am quite puzzled why this does not get caught by this test which I added specifically to catch cases like this. Isn't the "noopt" revision equivalent to debug mode?

// revisions: noopt opt opt_with_overflow_checks
//[noopt]compile-flags: -C opt-level=0
//[opt]compile-flags: -O
//[opt_with_overflow_checks]compile-flags: -C overflow-checks=on -O

@RalfJung
Copy link
Member Author

RalfJung commented Apr 1, 2020

Oh, well that is strange... when I locally just run rustc on the same code (with no flags), I get the expected warning.

@shepmaster what is the exact invocation that playground uses with "Debug" mode to build the code?

@RalfJung RalfJung changed the title "exceeding bitshifts" lint does not always work in debug mode "exceeding bitshifts" lint does not always work in debug mode on playground Apr 1, 2020
@RalfJung
Copy link
Member Author

RalfJung commented Apr 1, 2020

Oh lol, I only checked stable Rust; this got fixed by one of my PRs from February and those are not on stable yet... d'oh.

@RalfJung RalfJung closed this as completed Apr 1, 2020
@RalfJung
Copy link
Member Author

RalfJung commented Apr 1, 2020

Also, we have to make sure that there always is some ICE we can trigger in rustc, because that's a good way to get the actual compiler flags. ;)

@shepmaster
Copy link
Member

shepmaster commented Apr 1, 2020

there always is some ICE we can trigger in rustc

Isn’t that what break rust is for?

fn main() {
    break rust;
}
error: internal compiler error: It looks like you're trying to break rust; would you like some ICE?

note: the compiler expectedly panicked. this is a feature.

note: we would appreciate a joke overview: https://github.com/rust-lang/rust/issues/43162#issuecomment-320764675

@RalfJung
Copy link
Member Author

RalfJung commented Apr 1, 2020

@shepmaster yeah but see #70661

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug.
Projects
None yet
Development

No branches or pull requests

2 participants