-
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
Don't depend on Allocation
sizes for pattern length
#56540
Conversation
r? @cramertj (rust_highfive has picked a reviewer for you, use r? to override) |
r? @RalfJung |
Is there a "please select another random reviewer"? I'm afraid I don't think I can review this, pattern matching is complicated and I have zero familiarity with it. In fact I actively try to avoid it, pattern matching is one of the main reasons I only work on MIR and below ;) |
r? @varkor you've done a lot of pattern work recently |
a837830
to
3b24d02
Compare
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
☔ The latest upstream changes (presumably #56269) made this pull request unmergeable. Please resolve the merge conflicts. |
3b24d02
to
8a9414a
Compare
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
src/test/run-pass/ctfe/references.rs
Outdated
match &43 { | ||
&42 => panic!(), | ||
BOO => panic!(), | ||
BOO => panic!(), // pattern is unreachable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a behavioral change of this PR. We now detect that BOO
is &42
. This solely emits new warnings about unreachable patterns.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My main worry is that the tests don't seem to be catching the "unreachable pattern" warnings — comments are insufficient (it's unclear whether "this should warn" means it does, or we'd simply like it to in the future).
Behaviour-wise, this should only increase the number of "unreachable pattern" warnings, right? There should be no patterns that were previously unreachable that are now reachable?
}, | ||
// fat pointers stay the same | ||
(ConstValue::ScalarPair(..), _, _) => val, | ||
// FIXME(oli-obk): this is reachable for `const FOO: &&&u32 = &&&42;` being used |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens in this case in the existing code? A bug
again?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently this is an ICE: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=76fe5897409eefe240b587fb5ba59f6e
It will stay an ICE, but this PR is prepping the road for making it saner, because it's an explicit choice to ICE instead of just a random assert triggering.
/// | ||
/// `crty` and `rty` can differ because you can use array constants in the presence of slice | ||
/// patterns. So the pattern may end up being a slice, but the constant is an array. We convert | ||
/// the array to a slice in that case |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: end comments with full stops (here and elsewhere).
Nope, we don't take apart constants. I was intending to do that as a follow-up to this PR in order to keep the diffs sane |
@bors r+ |
📌 Commit 1c2a29e has been approved by |
⌛ Testing commit 1c2a29e with merge 19b52568c88514b941f5d7aef723e9c67805ed5a... |
💔 Test failed - status-travis |
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
@bors retry network error |
Don't depend on `Allocation` sizes for pattern length And generally be more explicit about shortcomings of the implementation cc @RalfJung
☀️ Test successful - status-appveyor, status-travis |
And generally be more explicit about shortcomings of the implementation
cc @RalfJung