Skip to content
This repository was archived by the owner on Apr 5, 2024. It is now read-only.
This repository was archived by the owner on Apr 5, 2024. It is now read-only.

Handle patterns within closures with the feature gate enabled #24

Closed
rust-lang/rust
#82536
@arora-aman

Description

@arora-aman

When capture_disjoint_fields is enabled we see that the compiler ICEs when closure contains something like

let x = 10;
let tup = (1, 2);
let p = Point { x: 10, y: 20 };

let c = || {
    let _ = x;
    let Point { x, y } = p; // 1
    let (_, _) = tup; // 2
};

The problem here is that in case 1 p[0] and p[1] are captured, but when we build MIR we need to get information about the initializer which is p in this case which is missing since p 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 to tup, which we don't have.

Ensure ui/closures/2229_closure_analysis/wild_patterns passes

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions