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

Move Upvar lowering from THIR to MIR #25

Closed
arora-aman opened this issue Nov 16, 2020 · 0 comments · Fixed by rust-lang/rust#79149
Closed

Move Upvar lowering from THIR to MIR #25

arora-aman opened this issue Nov 16, 2020 · 0 comments · Fixed by rust-lang/rust#79149
Assignees
Projects

Comments

@arora-aman
Copy link
Member

We lower paths that start from an Upvar here.

Essentially what this code does is convert upvars to refer to a field within the desugared ClosureSubsts. We want to refactor this code as follows:

  • Instead of doing the above desugaring we want to return Thir::Expr::UpvarRef(var_hir_id) in case the var_hir_id is mentioned within the closure. (This will allow us to deal with the let _ = x problem in MIR).
  • Move the logic currently in convert_var to rustc_mir_build/as_place
  • Maybe remove Thir::Expr::SelfRef, it's most likely only for Closures.
@arora-aman arora-aman added this to To-do in RFC-2229 via automation Nov 16, 2020
@arora-aman arora-aman moved this from To-do to In progress in RFC-2229 Nov 17, 2020
@arora-aman arora-aman self-assigned this Nov 17, 2020
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this issue Nov 19, 2020
Move capture lowering from THIR to MIR

This allows us to:
- Handle precise Places captured by a closure directly in MIR. Handling
  captures in MIR is easier since we can rely on/ tweak PlaceBuilder to
  generate `mir::Place`s that resemble how we store captures (`hir::Place`).

- Handle `let _ = x` case when feature `capture_disjoint_fields`
  is enabled directly in MIR. This is required to be done in MIR since
  patterns are desugared in MIR.

Closes: rust-lang/project-rfc-2229#25

r? `@nikomatsakis`
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this issue Nov 19, 2020
Move capture lowering from THIR to MIR

This allows us to:
- Handle precise Places captured by a closure directly in MIR. Handling
  captures in MIR is easier since we can rely on/ tweak PlaceBuilder to
  generate `mir::Place`s that resemble how we store captures (`hir::Place`).

- Handle `let _ = x` case when feature `capture_disjoint_fields`
  is enabled directly in MIR. This is required to be done in MIR since
  patterns are desugared in MIR.

Closes: rust-lang/project-rfc-2229#25

r? ``@nikomatsakis``
@arora-aman arora-aman moved this from In progress to In review in RFC-2229 Nov 19, 2020
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this issue Nov 19, 2020
Move capture lowering from THIR to MIR

This allows us to:
- Handle precise Places captured by a closure directly in MIR. Handling
  captures in MIR is easier since we can rely on/ tweak PlaceBuilder to
  generate `mir::Place`s that resemble how we store captures (`hir::Place`).

- Handle `let _ = x` case when feature `capture_disjoint_fields`
  is enabled directly in MIR. This is required to be done in MIR since
  patterns are desugared in MIR.

Closes: rust-lang/project-rfc-2229#25

r? ```@nikomatsakis```
RFC-2229 automation moved this from In review to Done Nov 19, 2020
@nikomatsakis nikomatsakis added this to the Feature complete milestone Feb 17, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
RFC-2229
  
Done
2 participants