You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 5, 2024. It is now read-only.
let foo = [1,2,3];let c = || match foo { _ => ()};
the match foo winds up registering a read of foo in the ExprUseVisitor. Note that the behavior here is different from let _ = foo. This is also somewhat inconsistent with the borrow checker, which considers match foo { _ => () } to not be a use (i.e., this code compiles, playground):
letmut x = 1;let y = &x;match x { _ => ()}drop(y);
The text was updated successfully, but these errors were encountered:
When it's not enabled, since we capture everything that is mentioned inside the closure, we will end up capturing
the discriminant as well, similar to how we have been doing things so far.
What remains is to see if this breaks clippy. If it does, how they use it will define how we end up handling the problem.
…=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
Closesrust-lang/project-rfc-2229/issues/27Closesrust-lang/project-rfc-2229/issues/24
r? `@nikomatsakis`
…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
Closesrust-lang/project-rfc-2229/issues/27Closesrust-lang/project-rfc-2229/issues/24
r? `@nikomatsakis`
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
edge-casesThings we should remember when documenting
In this example playground:
the
match foo
winds up registering a read offoo
in theExprUseVisitor
. Note that the behavior here is different fromlet _ = foo
. This is also somewhat inconsistent with the borrow checker, which considersmatch foo { _ => () }
to not be a use (i.e., this code compiles, playground):The text was updated successfully, but these errors were encountered: