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 mutablity because of a mut reference #30

Closed
@arora-aman

Description

@arora-aman

Consider the following codesample:

#![feature(capture_disjoint_fields)]

fn main() {
    let mut t = (10, 10);

    let t1 = (&mut t, 10);

    let mut c = || {
        t1.0.0 += 10;
    };

    c();
}

The code sample is valid because t1.0 is a mutable reference to t. However today this results in an error saying t1.0.0 is not mutable.

This is because the two things that are looked at are t1 or t1.0.0 which are &(&mut, i32) and i32 respectively which are both immutable.

We need to add extra information in ty::CapturePlace storing if the place can be mutated.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions