Skip to content

Conversation

arora-aman
Copy link
Member

@arora-aman arora-aman commented Dec 13, 2020

When capture_disjoint_fields is not enabled, checking if the root variable
binding is mutable would suffice.

However, with the feature enabled, the captured place might be mutable
because it dereferences a mutable reference.

This PR computes the mutability of each capture after capture analysis
in rustc_typeck. We store this in ty::CapturedPlace and then use
ty::CapturedPlace::mutability in mir_build and borrow_check.


This change is Reviewable

When `capture_disjoint_fields` is not enabled, checking if the root variable
binding is mutable would suffice.

However with the feature enabled, the captured place might be mutable
because it dereferences a mutable reference.

This PR computes the mutability of each capture after capture analysis
in rustc_typeck. We store this in `ty::CapturedPlace` and then use
`ty::CapturedPlace::mutability` in mir_build and borrow_check.
@arora-aman
Copy link
Member Author

rust-lang#80092

@arora-aman arora-aman closed this Feb 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant