Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2229: Fix issues with move closures and mutability #80092

Merged
merged 9 commits into from
Feb 1, 2021

Commits on Jan 29, 2021

  1. Restrict precision of captures with capture_disjoint_fields set

    - No Derefs in move closure, this will result in value behind a reference getting moved.
    - No projections are applied to raw pointers, since these require unsafe blocks. We capture
      them completely.
    
    Motivations for these are recorded here: https://hackmd.io/71qq-IOpTNqzMkPpAI1dVg?view
    arora-aman committed Jan 29, 2021
    Configuration menu
    Copy the full SHA
    b421cd5 View commit details
    Browse the repository at this point in the history
  2. Compute mutability of closure captures

    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 committed Jan 29, 2021
    Configuration menu
    Copy the full SHA
    3488082 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    1373f98 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    0897db5 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    604cbdc View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    c748f32 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    ffd5327 View commit details
    Browse the repository at this point in the history
  8. Fix typos

    arora-aman committed Jan 29, 2021
    Configuration menu
    Copy the full SHA
    fadf03e View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    0f4bab2 View commit details
    Browse the repository at this point in the history