-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
EUV: fix place of deref pattern's interior's scrutinee #138442
Conversation
Can you give this a better test name? I don't think it's describing much about what was going on here. |
Also can you copy the commit description into the PR description? Given this is a one commit PR and all, it's a bit of indirection to tell what this does lol |
@@ -1,6 +1,8 @@ | |||
//@ known-bug: rust-lang/rust#125059 | |||
//@ run-pass |
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.
//@ run-pass | |
//@ check-pass |
Given that this doesn't actually execute anything meaningful
The place previously used here was that of the temporary holding the reference returned by `Deref::deref` or `DerefMut::deref_mut`. However, since the inner pattern of `deref!(inner)` expects the deref-target type itself, this would ICE when that type was inspected (e.g. by the EUV case for slice patterns). This adds a deref projection to fix that. Since current in-tree consumers of EUV (upvar inference and clippy) don't care about Rvalues, the place could be simplified to `self.cat_rvalue(pat.hir_id, self.pat_ty_adjusted(subpat)?)` to save some cycles. I personally find EUV to be a bit fragile, so I've opted for pedantic correctness. Maybe a `HACK` comment would suffice though?
2c0889c
to
36ff87e
Compare
This PR changes a file inside |
I've amended the test with your suggestions (plus a little extra description in the test comment) and edited the PR description. ty! |
@bors r+ rollup |
Rollup of 16 pull requests Successful merges: - rust-lang#136001 (Overhaul examples for PermissionsExt) - rust-lang#136230 (Reword incorrect documentation about SocketAddr having varying layout) - rust-lang#136892 (Sync Fuchsia target spec with clang Fuchsia driver) - rust-lang#136911 (Add documentation URL to selected jobs) - rust-lang#137870 ( Improve HashMap docs for const and static initializers) - rust-lang#138179 (Add `src/tools/x` to the main workspace) - rust-lang#138389 (use `expect` instead of `allow`) - rust-lang#138396 (Enable metrics and verbose tests in PR CI) - rust-lang#138398 (atomic intrinsics: clarify which types are supported and (if applicable) what happens with provenance) - rust-lang#138432 (fix: remove the check of lld not supporting `@response-file)` - rust-lang#138434 (Visit `PatField` when collecting lint levels) - rust-lang#138441 (update error message) - rust-lang#138442 (EUV: fix place of deref pattern's interior's scrutinee) - rust-lang#138457 (Remove usage of legacy scheme paths on RedoxOS) - rust-lang#138461 (Remove an outdated line from a test comment) - rust-lang#138466 (Remove myself from libs review) Failed merges: - rust-lang#138452 (Remove `RUN_CHECK_WITH_PARALLEL_QUERIES`) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#138442 - dianne:deref-pat-euv-fix, r=compiler-errors EUV: fix place of deref pattern's interior's scrutinee The place previously used here was that of the temporary holding the reference returned by `Deref::deref` or `DerefMut::deref_mut`. However, since the inner pattern of `deref!(inner)` expects the deref-target type itself, this would ICE when that type was inspected (e.g. by the EUV case for slice patterns). This adds a deref projection to fix that. Since current in-tree consumers of EUV (upvar inference and clippy) don't care about Rvalues, the place could be simplified to `self.cat_rvalue(pat.hir_id, self.pat_ty_adjusted(subpat)?)` to save some cycles. I personally find EUV to be a bit fragile, so I've opted for pedantic correctness. Maybe a `HACK` comment would suffice though? Fixes rust-lang#125059 r? `@compiler-errors`
Rollup of 16 pull requests Successful merges: - rust-lang#136001 (Overhaul examples for PermissionsExt) - rust-lang#136230 (Reword incorrect documentation about SocketAddr having varying layout) - rust-lang#136892 (Sync Fuchsia target spec with clang Fuchsia driver) - rust-lang#136911 (Add documentation URL to selected jobs) - rust-lang#137870 ( Improve HashMap docs for const and static initializers) - rust-lang#138179 (Add `src/tools/x` to the main workspace) - rust-lang#138389 (use `expect` instead of `allow`) - rust-lang#138396 (Enable metrics and verbose tests in PR CI) - rust-lang#138398 (atomic intrinsics: clarify which types are supported and (if applicable) what happens with provenance) - rust-lang#138432 (fix: remove the check of lld not supporting `@response-file)` - rust-lang#138434 (Visit `PatField` when collecting lint levels) - rust-lang#138441 (update error message) - rust-lang#138442 (EUV: fix place of deref pattern's interior's scrutinee) - rust-lang#138457 (Remove usage of legacy scheme paths on RedoxOS) - rust-lang#138461 (Remove an outdated line from a test comment) - rust-lang#138466 (Remove myself from libs review) Failed merges: - rust-lang#138452 (Remove `RUN_CHECK_WITH_PARALLEL_QUERIES`) r? `@ghost` `@rustbot` modify labels: rollup
The place previously used here was that of the temporary holding the reference returned by
Deref::deref
orDerefMut::deref_mut
. However, since the inner pattern ofderef!(inner)
expects the deref-target type itself, this would ICE when that type was inspected (e.g. by the EUV case for slice patterns). This adds a deref projection to fix that.Since current in-tree consumers of EUV (upvar inference and clippy) don't care about Rvalues, the place could be simplified to
self.cat_rvalue(pat.hir_id, self.pat_ty_adjusted(subpat)?)
to save some cycles. I personally find EUV to be a bit fragile, so I've opted for pedantic correctness. Maybe aHACK
comment would suffice though?Fixes #125059
r? @compiler-errors