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

Fix show error message when literal overflows in match patterns #94354

Closed
wants to merge 3 commits into from

Conversation

light4
Copy link
Contributor

@light4 light4 commented Feb 25, 2022

Fix #94239
This changes overflow behavior in fn lit_to_const

@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Feb 25, 2022
@rust-highfive
Copy link
Collaborator

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @cjgillot (or someone else) soon.

Please see the contribution instructions for more information.

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Feb 25, 2022
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@Dylan-DPC
Copy link
Member

r? @Dylan-DPC

@rust-highfive rust-highfive assigned Dylan-DPC and unassigned cjgillot Feb 26, 2022
@Dylan-DPC
Copy link
Member

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Feb 26, 2022

📌 Commit b0c4db3 has been approved by Dylan-DPC

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 26, 2022
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Feb 26, 2022
Fix show error message when literal overflows in match patterns

Fix rust-lang#94239
This changes overflow behavior in [fn lit_to_const](https://github.com/rust-lang/rust/blob/master/compiler/rustc_mir_build/src/thir/constant.rs#L10)
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Feb 27, 2022
Fix show error message when literal overflows in match patterns

Fix rust-lang#94239
This changes overflow behavior in [fn lit_to_const](https://github.com/rust-lang/rust/blob/master/compiler/rustc_mir_build/src/thir/constant.rs#L10)
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Feb 27, 2022
Fix show error message when literal overflows in match patterns

Fix rust-lang#94239
This changes overflow behavior in [fn lit_to_const](https://github.com/rust-lang/rust/blob/master/compiler/rustc_mir_build/src/thir/constant.rs#L10)
@matthiaskrgr
Copy link
Member

@bors r-
It looks like this causes test failures on dist-i586-gnu-i586-i686-musl

#94430 (comment)

I don't really have an explanation for this; in #94405 (comment) two PRs were already merged and the remaining two prs do not cause any functional changes so this pr is the only one thats left 🤔

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Feb 27, 2022
@light4
Copy link
Contributor Author

light4 commented Feb 28, 2022

The overflowing_literals behavior has changed, before this PR, it's just truncated the leading bytes, now it's changed to the max number of the type. Maybe this PR should be closed.

These files contains #![allow(overflowing_literals)]

❯ rg --fixed-strings --files-with-matches '#![allow(overflowing_literals)]'
library/stdarch/crates/intrinsic-test/src/main.rs
library/stdarch/crates/core_arch/src/x86/aes.rs
library/stdarch/crates/core_arch/src/x86/avx512bitalg.rs
library/stdarch/crates/core_arch/src/x86/avx512vaes.rs
library/stdarch/crates/core_arch/src/x86/avx512gfni.rs
library/stdarch/crates/core_arch/src/x86/pclmulqdq.rs
library/stdarch/crates/core_arch/src/x86/avx512vpclmulqdq.rs
src/test/ui/structs-enums/enum-discrim-autosizing.rs
src/test/ui/structs-enums/enum-discrim-width-stuff.rs
src/test/ui/structs-enums/enum-discrim-range-overflow.rs
src/test/ui/simd/target-feature-mixup.rs
src/test/ui/pattern/usefulness/issue-13727.rs
src/test/ui/packed/packed-struct-generic-layout.rs
src/test/ui/numbers-arithmetic/shift.rs
src/test/ui/numbers-arithmetic/i128.rs
src/test/ui/deriving/deriving-hash.rs
src/test/ui/consts/const-fn-val.rs
src/test/ui/consts/const-rec-and-tup.rs
src/test/ui/consts/const-negation.rs
src/test/ui/array-slice-vec/box-of-array-of-drop-1.rs
src/test/ui/array-slice-vec/box-of-array-of-drop-2.rs
src/test/ui/array-slice-vec/nested-vec-3.rs
src/doc/rust-by-example/src/types/cast.md
library/core/tests/num/dec2flt/mod.rs

@light4
Copy link
Contributor Author

light4 commented Feb 28, 2022

Closed due to cast behavior: https://doc.rust-lang.org/stable/rust-by-example/types/cast.html

@light4 light4 closed this Feb 28, 2022
@light4 light4 deleted the issue-94239 branch November 10, 2022 15:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Integer literal overflows in match patterns result in unhelpful error message
8 participants