-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Lower constant patterns with ascribed types. #58161
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Conversation
r=me with comment in place |
This commit fixes a bug introduced by rust-lang#55937 which started checking user type annotations for associated type patterns. Where lowering a associated constant expression would previously return a `PatternKind::Constant`, it now returns a `PatternKind::AscribeUserType` with a `PatternKind::Constant` inside, this commit unwraps that to access the constant pattern inside and behaves as before.
789112f
to
6717727
Compare
So @matthewjasper had complained that the r=me with that |
📌 Commit 6717727 has been approved by |
beta-nominating because this fixes a regression in beta. |
⌛ Testing commit 6717727 with merge 7fcc7a28ebc267130f91107187c3073658f8482e... |
💔 Test failed - checks-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 |
cc @kennytm looks spurious |
Lower constant patterns with ascribed types. Fixes #57960. This PR fixes a bug introduced by #55937 which started checking user type annotations for associated type patterns. Where lowering a associated constant expression would previously return a `PatternKind::Constant`, it now returns a `PatternKind::AscribeUserType` with a `PatternKind::Constant` inside, this PR unwraps that to access the constant pattern inside and behaves as before. r? @pnkfelix
☀️ Test successful - checks-travis, status-appveyor |
This commit builds on the fix from rust-lang#58161 (which fixed miscompilation caused by the introduction of `AscribeUserType` patterns for associated constants) to start checking these patterns are well-formed for ranges (previous fix just ignored them so that miscompilation wouldn't occur).
Check user type annotations for range patterns. Fixes rust-lang#58299. This PR builds on the fix from rust-lang#58161 (which fixed miscompilation caused by the introduction of `AscribeUserType` patterns for associated constants) to start checking these patterns are well-formed for ranges (previous fix just ignored them so that miscompilation wouldn't occur). r? @arielb1
triage, beta-accepted. |
[beta] Rollup backports Cherry-picked: * #58207: Make `intern_lazy_const` actually intern its argument. * #58161: Lower constant patterns with ascribed types. * #57908: resolve: Fix span arithmetics in the import conflict error * #57835: typeck: remove leaky nested probe during trait object method resolution * #57885: Avoid committing to autoderef in object method probing * #57646: Fixes text becoming invisible when element targetted Rolled up: * #58522: [BETA] Update cargo r? @ghost
[beta] Rollup backports Cherry-picked: * #58207: Make `intern_lazy_const` actually intern its argument. * #58161: Lower constant patterns with ascribed types. * #57908: resolve: Fix span arithmetics in the import conflict error * #57835: typeck: remove leaky nested probe during trait object method resolution * #57885: Avoid committing to autoderef in object method probing * #57646: Fixes text becoming invisible when element targetted Rolled up: * #58522: [BETA] Update cargo r? @ghost
Fixes #57960.
This PR fixes a bug introduced by #55937 which started checking user
type annotations for associated type patterns. Where lowering a
associated constant expression would previously return a
PatternKind::Constant
, it now returns aPatternKind::AscribeUserType
with a
PatternKind::Constant
inside, this PR unwraps that toaccess the constant pattern inside and behaves as before.
r? @pnkfelix