-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Add casting suggestion when assigning negative 2's complement bin or hex literal to a size compatible signed integer #111212
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @TaKO8Ki (or someone else) soon. Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (
|
This comment has been minimized.
This comment has been minimized.
r? compiler |
2753353
to
2113769
Compare
r? compiler |
The logic here seems good to me. The only question I asked myself was whether we want to be pushing people towards using But I suspect this change does more good than potential harm, so lets land it. |
@bors r+ rollup |
…iaskrgr Rollup of 6 pull requests Successful merges: - rust-lang#111212 (Add casting suggestion when assigning negative 2's complement bin or hex literal to a size compatible signed integer) - rust-lang#112304 (Add chapter in rustdoc book for re-exports and add a regression test for `#[doc(hidden)]` behaviour) - rust-lang#112486 (Fix suggestion for E0404 not dealing with multiple generics) - rust-lang#112562 (rustdoc-gui: allow running on Windows) - rust-lang#112621 (Mention `env!` in `option_env!`'s docs) - rust-lang#112634 (add InlineConst check) r? `@ghost` `@rustbot` modify labels: rollup
Fixes #107896
The issue stated the case for
iX::MIN
variants. This PR extends the cases for other negative values (in the 2's complement).Leveraged sign bits to detect such cases.
Example cases: