Skip to content

support revealing uses of opaques in closures #139587

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

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

lcnr
Copy link
Contributor

@lcnr lcnr commented Apr 9, 2025

I extracted self-contained changes to #139666.

the following now works, needs a bit of cleanup to actually land :3

fn foo(x: &u32) -> impl Sized + '_ {
    let _ = || {
        let temp = 1;
        // normalization of the return type results
        // in `opaque<'local1> = &'local2 u32`.
        foo(&temp);
    };
    x
}

r? @compiler-errors

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Apr 9, 2025
@rust-log-analyzer

This comment has been minimized.

@lcnr lcnr added the WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver) label Apr 9, 2025
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 9, 2025
[DO NOT MERGE] bootstrap with `-Znext-solver=globally`

A revival of rust-lang#124812.

Current status:

~~`./x.py b --stage 2` passes 🎉~~

`try` builds succeed 🎉 🎉 🎉

[first perf run](rust-lang#133502 (comment)) 👻

### in-flight changes

- rust-lang#124852, unsure whether I actually want to land this PR for now
- rust-lang#139587
- https://github.com/lcnr/rust/tree/opaque-type-method-call

r? `@ghost`
@lcnr lcnr force-pushed the revealing-use-closures branch from f83cf4b to b796696 Compare April 10, 2025 07:26
@rust-log-analyzer

This comment has been minimized.

bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 10, 2025
[DO NOT MERGE] bootstrap with `-Znext-solver=globally`

A revival of rust-lang#124812.

Current status:

~~`./x.py b --stage 2` passes 🎉~~

`try` builds succeed 🎉 🎉 🎉

[first perf run](rust-lang#133502 (comment)) 👻

### in-flight changes

- rust-lang#124852, unsure whether I actually want to land this PR for now
- rust-lang#139587
- https://github.com/lcnr/rust/tree/opaque-type-method-call

r? `@ghost`
@lcnr
Copy link
Contributor Author

lcnr commented Apr 10, 2025

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Apr 10, 2025
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 10, 2025
support revealing uses of opaques in closures

based on rust-lang#139484

the following now works, needs **a bit** of cleanup to actually land :3
```rust
fn foo(x: &u32) -> impl Sized + '_ {
    let _ = || {
        let temp = 1;
        // normalization of the return type results
        // in `opaque<'local1> = &'local2 u32`.
        foo(&temp);
    };
    x
}
```

r? `@compiler-errors`
@bors
Copy link
Collaborator

bors commented Apr 10, 2025

⌛ Trying commit 22d34c4 with merge 14ea441...

@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Collaborator

bors commented Apr 10, 2025

☀️ Try build successful - checks-actions
Build commit: 14ea441 (14ea4416942169f85851de68119f43a59ef8801f)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (14ea441): comparison URL.

Overall result: ❌✅ regressions and improvements - please read the text below

Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf.

Next Steps: If you can justify the regressions found in this try perf run, please indicate this with @rustbot label: +perf-regression-triaged along with sufficient written justification. If you cannot justify the regressions please fix the regressions and do another perf run. If the next run shows neutral or positive results, the label will be automatically removed.

@bors rollup=never
@rustbot label: -S-waiting-on-perf +perf-regression

Instruction count

This is the most reliable metric that we have; it was used to determine the overall result at the top of this comment. However, even this metric can sometimes exhibit noise.

mean range count
Regressions ❌
(primary)
0.6% [0.2%, 1.1%] 62
Regressions ❌
(secondary)
0.5% [0.3%, 0.8%] 16
Improvements ✅
(primary)
-0.3% [-0.3%, -0.2%] 2
Improvements ✅
(secondary)
-0.5% [-1.1%, -0.2%] 27
All ❌✅ (primary) 0.5% [-0.3%, 1.1%] 64

Max RSS (memory usage)

Results (primary 2.0%, secondary -1.3%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
2.0% [1.2%, 2.8%] 5
Regressions ❌
(secondary)
3.1% [2.5%, 3.6%] 2
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-3.0% [-7.2%, -1.2%] 5
All ❌✅ (primary) 2.0% [1.2%, 2.8%] 5

Cycles

Results (primary 1.1%, secondary 1.5%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
1.1% [0.8%, 1.3%] 12
Regressions ❌
(secondary)
1.5% [1.2%, 1.9%] 10
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 1.1% [0.8%, 1.3%] 12

Binary size

Results (secondary -0.1%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.1% [-0.1%, -0.1%] 6
All ❌✅ (primary) - - 0

Bootstrap: 780.245s -> 782.612s (0.30%)
Artifact size: 366.19 MiB -> 366.30 MiB (0.03%)

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Apr 10, 2025
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 10, 2025
[DO NOT MERGE] bootstrap with `-Znext-solver=globally`

A revival of rust-lang#124812.

Current status:

~~`./x.py b --stage 2` passes 🎉~~

`try` builds succeed 🎉 🎉 🎉

[first perf run](rust-lang#133502 (comment)) 👻

### in-flight changes

- rust-lang#124852, unsure whether I actually want to land this PR for now
- rust-lang#139587
- https://github.com/lcnr/rust/tree/opaque-type-method-call

r? `@ghost`
@lcnr lcnr mentioned this pull request Apr 11, 2025
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 11, 2025
cleanup `mir_borrowck`

Cleanup pulled out of rust-lang#139587. Best reviewed commit by commit.

r? compiler-errors
@lcnr lcnr force-pushed the revealing-use-closures branch 2 times, most recently from 17793b6 to e354bf9 Compare April 11, 2025 11:16
@rust-log-analyzer

This comment has been minimized.

bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 11, 2025
[DO NOT MERGE] bootstrap with `-Znext-solver=globally`

A revival of rust-lang#124812.

Current status:

~~`./x.py b --stage 2` passes 🎉~~

`try` builds succeed 🎉 🎉 🎉

[first perf run](rust-lang#133502 (comment)) 👻

### in-flight changes

- rust-lang#124852, unsure whether I actually want to land this PR for now
- rust-lang#139587
- https://github.com/lcnr/rust/tree/opaque-type-method-call
- rust-lang#138845
- https://gist.github.com/lcnr/86f3e56c3b25a7892d8dbfa28c84e1a8

r? `@ghost`
@lcnr lcnr force-pushed the revealing-use-closures branch 2 times, most recently from b34b851 to 092d8ce Compare April 11, 2025 13:23
@rust-log-analyzer

This comment has been minimized.

ChrisDenton added a commit to ChrisDenton/rust that referenced this pull request Apr 13, 2025
…compiler-errors

cleanup `mir_borrowck`

Cleanup pulled out of rust-lang#139587. Best reviewed commit by commit.

r? compiler-errors
ChrisDenton added a commit to ChrisDenton/rust that referenced this pull request Apr 13, 2025
…compiler-errors

cleanup `mir_borrowck`

Cleanup pulled out of rust-lang#139587. Best reviewed commit by commit.

r? compiler-errors
jhpratt added a commit to jhpratt/rust that referenced this pull request Apr 14, 2025
…compiler-errors

cleanup `mir_borrowck`

Cleanup pulled out of rust-lang#139587. Best reviewed commit by commit.

r? compiler-errors
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Apr 14, 2025
Rollup merge of rust-lang#139666 - lcnr:pre-revealing-use-cleanup, r=compiler-errors

cleanup `mir_borrowck`

Cleanup pulled out of rust-lang#139587. Best reviewed commit by commit.

r? compiler-errors
@bors
Copy link
Collaborator

bors commented Apr 14, 2025

☔ The latest upstream changes (presumably #139781) made this pull request unmergeable. Please resolve the merge conflicts.

@lcnr lcnr force-pushed the revealing-use-closures branch from 092d8ce to 05e2166 Compare April 15, 2025 15:02
@rust-log-analyzer

This comment has been minimized.

@lcnr lcnr force-pushed the revealing-use-closures branch from 05e2166 to dbc90dc Compare April 16, 2025 14:18
@lcnr lcnr force-pushed the revealing-use-closures branch from dbc90dc to cfb3ede Compare April 16, 2025 14:35
@rust-log-analyzer
Copy link
Collaborator

The job mingw-check failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
error: using `.clone()` on a ref-counted pointer
  --> compiler/rustc_borrowck/src/nll.rs:91:9
   |
91 |         location_map.clone(),
   |         ^^^^^^^^^^^^^^^^^^^^ help: try: `Rc::<rustc_mir_dataflow::points::DenseLocationMap>::clone(&location_map)`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_ref_ptr
   = note: requested on the command line with `-D clippy::clone-on-ref-ptr`

[RUSTC-TIMING] rustc_passes test:false 2.266

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
perf-regression Performance regression. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants