-
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
Should have a lint for statically detectable overlong bit shifts #17713
Labels
A-lint
Area: Lints (warnings about flaws in source code) such as unused_mut.
Comments
huonw
added
the
A-lint
Area: Lints (warnings about flaws in source code) such as unused_mut.
label
Oct 2, 2014
hirschenberger
added a commit
to hirschenberger/rust
that referenced
this issue
Nov 1, 2014
I think this can be closed, resolved in #18206 |
Hooray! |
lnicola
pushed a commit
to lnicola/rust
that referenced
this issue
Jul 28, 2024
fix: early exit if unresolved field is an index Fixes rust-lang#17710
RalfJung
pushed a commit
to RalfJung/rust
that referenced
this issue
Aug 1, 2024
fix: early exit if unresolved field is an index Fixes rust-lang#17710
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Currently overlong bit shifts are undefined behavior because that's how llvm rolls--#10183. But even when they aren't, we should warn on something like
x << 24
wherex
happens to beu8
, since it's a useless operation that couldn't possibly return anything interesting.There's a motivating example and I imagine it'd be a common gotcha since other languages tend to read unadorned integral literals as 32bit
int
s and then promote thex
inx << 24
before doing the actual shift.The text was updated successfully, but these errors were encountered: