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

Move capture lowering from THIR to MIR #79149

Merged
merged 2 commits into from
Nov 19, 2020
Merged

Conversation

arora-aman
Copy link
Member

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::Places 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

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`).
- Allows us to 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.
ExprKind::SelfRef was used to express accessing `self` in
the desugared Closure/Generator struct when lowering captures in THIR.

Since we handle captures in MIR now, we don't need `ExprKind::Self`.
@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Nov 17, 2020
@nikomatsakis
Copy link
Contributor

@bors r_

@nikomatsakis
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented Nov 17, 2020

📌 Commit 9f70e78 has been approved by nikomatsakis

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 17, 2020
@arora-aman arora-aman changed the title Move capture lowering from THIR to MIR #30 Move capture lowering from THIR to MIR Nov 18, 2020
@arora-aman arora-aman changed the title Move capture lowering from THIR to MIR Move capture lowering from THIR to MIR #30 Nov 18, 2020
@arora-aman arora-aman changed the title Move capture lowering from THIR to MIR #30 Move capture lowering from THIR to MIR Nov 18, 2020
@oli-obk oli-obk added the A-mir-opt Area: MIR optimizations label Nov 18, 2020
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request 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 pull request 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``
bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 19, 2020
Rollup of 14 pull requests

Successful merges:

 - rust-lang#78961 (Make bad "rust-call" arguments no longer ICE)
 - rust-lang#79082 (Improve the diagnostic for when an `fn` contains qualifiers inside an `extern` block.)
 - rust-lang#79090 (libary: Forward compiler-builtins "asm"  and "mangled-names" feature)
 - rust-lang#79094 (Add //ignore-macos to pretty-std-collections.rs)
 - rust-lang#79101 (Don't special case constant operands when lowering intrinsics)
 - rust-lang#79102 (Add two regression tests)
 - rust-lang#79110 (Remove redundant notes in E0275)
 - rust-lang#79116 (compiletest: Fix a warning in debuginfo tests on windows-gnu)
 - rust-lang#79117 (add optimization fuel checks to some mir passes)
 - rust-lang#79147 (Highlight MIR as Rust on GitHub)
 - rust-lang#79149 (Move capture lowering from THIR to MIR)
 - rust-lang#79155 (fix handling the default config for profiler and sanitizers)
 - rust-lang#79156 (Allow using `download-ci-llvm` from directories other than the root)
 - rust-lang#79164 (Permit standalone generic parameters as const generic arguments in macros)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 5c7d530 into rust-lang:master Nov 19, 2020
@rustbot rustbot added this to the 1.50.0 milestone Nov 19, 2020
@arora-aman arora-aman deleted the upvar_ref branch November 22, 2020 09:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-mir-opt Area: MIR optimizations S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Move Upvar lowering from THIR to MIR
6 participants