This repository has been archived by the owner on Apr 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
Handle patterns within closures with the feature gate enabled #24
Comments
7 tasks
arora-aman
changed the title
Handle
Handle Wildcard pattern within closures with the feature gate enabled
Dec 2, 2020
let _ = x
within closures with the feature gate enabled
arora-aman
changed the title
Handle Wildcard pattern within closures with the feature gate enabled
Handle patterns within closures with the feature gate enabled
Dec 4, 2020
Once this is implemented, also modify the following test so the closure body is:
|
Iniital ideas: https://hackmd.io/fgc31ECfQnaxfP9DmjgVNw?view |
More detailed ideas using fake reads for "upvars": https://hackmd.io/fgc31ECfQnaxfP9DmjgVNw |
bors
added a commit
to rust-lang-ci/rust
that referenced
this issue
Mar 16, 2021
…=nikomatsakis 2229: Handle patterns within closures correctly when `capture_disjoint_fields` is enabled This PR fixes several issues related to handling patterns within closures when `capture_disjoint_fields` is enabled. 1. Matching is always considered a use of the place, even with `_` patterns 2. Compiler ICE when capturing fields in closures through `let` assignments To do so, we - Introduced new Fake Reads - Delayed use of `Place` in favor of `PlaceBuilder` - Ensured that `PlaceBuilder` can be resolved before attempting to extract `Place` in any of the pattern matching code Closes rust-lang/project-rfc-2229/issues/27 Closes rust-lang/project-rfc-2229/issues/24 r? `@nikomatsakis`
flip1995
pushed a commit
to flip1995/rust-clippy
that referenced
this issue
Mar 25, 2021
…akis 2229: Handle patterns within closures correctly when `capture_disjoint_fields` is enabled This PR fixes several issues related to handling patterns within closures when `capture_disjoint_fields` is enabled. 1. Matching is always considered a use of the place, even with `_` patterns 2. Compiler ICE when capturing fields in closures through `let` assignments To do so, we - Introduced new Fake Reads - Delayed use of `Place` in favor of `PlaceBuilder` - Ensured that `PlaceBuilder` can be resolved before attempting to extract `Place` in any of the pattern matching code Closes rust-lang/project-rfc-2229/issues/27 Closes rust-lang/project-rfc-2229/issues/24 r? `@nikomatsakis`
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
When
capture_disjoint_fields
is enabled we see that the compiler ICEs when closure contains something likeThe problem here is that in case 1
p[0]
andp[1]
are captured, but when we build MIR we need to get information about the initializer which isp
in this case which is missing sincep
itself isn't captured.The issue with 2 is that since nothing from
tup
is used, nothing is captured. Nothing will be read when MIR is built either, but to build MIR we need access totup
, which we don't have.Ensure
ui/closures/2229_closure_analysis/wild_patterns
passesThe text was updated successfully, but these errors were encountered: