-
Notifications
You must be signed in to change notification settings - Fork 13k
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
ICE on pattern match against const &`static [u8] #46920
Labels
P-high
High priority
regression-from-stable-to-beta
Performance or correctness regression from stable to beta.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Comments
I have some additional information on this:
|
@alexcrichton |
cc @nikomatsakis and @rust-lang/compiler, I think this is a new beta regression! |
alexcrichton
added
I-nominated
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
regression-from-stable-to-beta
Performance or correctness regression from stable to beta.
labels
Jan 16, 2018
Will investigate. |
triage: P-high |
arielb1
added a commit
to arielb1/rust
that referenced
this issue
Jan 16, 2018
The match lowering code, when lowering matches against bytestrings, works by coercing both the scrutinee and the pattern to `&[u8]` and then comparing them using `<[u8] as Eq>::eq`. If the scrutinee is already of type `&[u8]`, then unsizing it is both unneccessary and a trait error caught by the new and updated MIR typeck, so this PR changes lowering to avoid doing that (match lowering tried to avoid that before, but that attempt was quite broken). Fixes rust-lang#46920.
bors
added a commit
that referenced
this issue
Jan 19, 2018
avoid double-unsizing arrays in bytestring match lowering The match lowering code, when lowering matches against bytestrings, works by coercing both the scrutinee and the pattern to `&[u8]` and then comparing them using `<[u8] as Eq>::eq`. If the scrutinee is already of type `&[u8]`, then unsizing it is both unneccessary and a trait error caught by the new and updated MIR typeck, so this PR changes lowering to avoid doing that (match lowering tried to avoid that before, but that attempt was quite broken). Fixes #46920. r? @eddyb
MaloJaffre
pushed a commit
to MaloJaffre/rust
that referenced
this issue
Jan 23, 2018
The match lowering code, when lowering matches against bytestrings, works by coercing both the scrutinee and the pattern to `&[u8]` and then comparing them using `<[u8] as Eq>::eq`. If the scrutinee is already of type `&[u8]`, then unsizing it is both unneccessary and a trait error caught by the new and updated MIR typeck, so this PR changes lowering to avoid doing that (match lowering tried to avoid that before, but that attempt was quite broken). Fixes rust-lang#46920.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
P-high
High priority
regression-from-stable-to-beta
Performance or correctness regression from stable to beta.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
I matched against a
&'static [u8]
and got the error below. The code compiles on stable and beta. Interestingly I do these kinds of pattern matches elsewhere in the code, too, and there it works.I found errors with similiar error messages but could not relate them to this code. So sorry if this is a duplicate.
I tried this code:
Can be reproduced on rust playground:
I expected to see this happen:
A successful build.
Instead, this happened:
error: internal compiler error: broken MIR in NodeId(2445) (""): errors selecting obligation: [FulfillmentError(Obligation(predicate=Binder(TraitPredicate(<[u8] as std::marker::Unsize<[u8]>>)),depth=1),Unimplemented)]
Meta
rustc --version --verbose
:The text was updated successfully, but these errors were encountered: