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

Normalize closure signature after construction #101708

Merged
merged 1 commit into from
Sep 23, 2022

Conversation

compiler-errors
Copy link
Member

@compiler-errors compiler-errors commented Sep 12, 2022

Astconv can't normalize inputs or outputs with escaping bound vars (see this), so normalize them after we've wrapped them in a binder.

Fixes #101696

@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Sep 12, 2022
@rust-highfive
Copy link
Collaborator

r? @jackh726

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 12, 2022
@compiler-errors
Copy link
Member Author

compiler-errors commented Sep 12, 2022

Doing a perf run because normalizing always might be too expensive -- also quite possible to just check if the inputs/outputs have escaping bound vars first, then do the normalization only if needed.

@bors try @rust-timer queue

@rust-timer
Copy link
Collaborator

Awaiting bors try build completion.

@rustbot label: +S-waiting-on-perf

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Sep 12, 2022
@bors
Copy link
Contributor

bors commented Sep 12, 2022

⌛ Trying commit 2db0492 with merge 5df914b094598d26bd074278416ca1d1d6f048ad...

@rust-timer
Copy link
Collaborator

Awaiting bors try build completion.

@rustbot label: +S-waiting-on-perf

@bors
Copy link
Contributor

bors commented Sep 12, 2022

☀️ Try build successful - checks-actions
Build commit: 5df914b094598d26bd074278416ca1d1d6f048ad (5df914b094598d26bd074278416ca1d1d6f048ad)

@rust-timer
Copy link
Collaborator

Queued 5df914b094598d26bd074278416ca1d1d6f048ad with parent fa521a4, future comparison URL.

}

fn main() {
foo(|a: <MyType as AsVariantTrait>::Type| {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it worth adding another test for the notation that tries to use the type alias Variant instead?

fn main() {
    foo(|a: Variant<MyType>| { 
        a.field;
    });
}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I can just change this test to use that. I only changed this to the associated type syntax to make sure it wasn't a bug with type aliases.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe just throw both call-sites into main and call it a day. 😆

The type alias notation is what I was originally trying to use when I found the ICE.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (5df914b094598d26bd074278416ca1d1d6f048ad): comparison URL.

Overall result: no relevant changes - no action needed

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.

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

Instruction count

This benchmark run did not return any relevant results for this metric.

Max RSS (memory usage)

Results

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.

mean1 range count2
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.7% [-0.9%, -0.5%] 2
All ❌✅ (primary) - - 0

Cycles

This benchmark run did not return any relevant results for this metric.

Footnotes

  1. the arithmetic mean of the percent change

  2. number of relevant changes

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Sep 12, 2022
@DavidVonDerau
Copy link

Were the perf results on this PR acceptable? I'm wondering if anything is blocking the merge.

@jackh726
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Sep 22, 2022

📌 Commit 2db0492 has been approved by jackh726

It is now in the queue for this repository.

@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 Sep 22, 2022
@bors
Copy link
Contributor

bors commented Sep 23, 2022

⌛ Testing commit 2db0492 with merge 9279c54...

@bors
Copy link
Contributor

bors commented Sep 23, 2022

☀️ Test successful - checks-actions
Approved by: jackh726
Pushing 9279c54 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Sep 23, 2022
@bors bors merged commit 9279c54 into rust-lang:master Sep 23, 2022
@rustbot rustbot added this to the 1.66.0 milestone Sep 23, 2022
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (9279c54): comparison URL.

Overall result: no relevant changes - no action needed

@rustbot label: -perf-regression

Instruction count

This benchmark run did not return any relevant results for this metric.

Max RSS (memory usage)

Results

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.

mean1 range count2
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-2.6% [-3.6%, -1.7%] 2
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -2.6% [-3.6%, -1.7%] 2

Cycles

Results

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.

mean1 range count2
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-2.6% [-3.2%, -2.0%] 2
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -2.6% [-3.2%, -2.0%] 2

Footnotes

  1. the arithmetic mean of the percent change 2

  2. number of relevant changes 2

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Oct 8, 2022
…ackh726

don't ICE when normalizing closure input tys

We were ICEing while rendering diagnostics because `universe_causes` is expected to track every universe created in the typeck's infcx.

`normalize_and_add_constraints` doesn't update `universe_causes`
when creating new universes, causing an ICE. Remove it!

Add spans to better track normalization constraints.

Fix couple places where `universe_causes` is not updated correctly to
track newly added universes.

Fixes rust-lang#102800

~Fixess rust-lang#99665~ (UPDATE: no longer true; the issue has a different failure path than when this PR was created and should be fixed by rust-lang#101708, but the changes in this PR are still correct and should prevent potential future ICEs)
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Oct 8, 2022
…ackh726

don't ICE when normalizing closure input tys

We were ICEing while rendering diagnostics because `universe_causes` is expected to track every universe created in the typeck's infcx.

`normalize_and_add_constraints` doesn't update `universe_causes`
when creating new universes, causing an ICE. Remove it!

Add spans to better track normalization constraints.

Fix couple places where `universe_causes` is not updated correctly to
track newly added universes.

Fixes rust-lang#102800

~Fixess rust-lang#99665~ (UPDATE: no longer true; the issue has a different failure path than when this PR was created and should be fixed by rust-lang#101708, but the changes in this PR are still correct and should prevent potential future ICEs)
notriddle added a commit to notriddle/rust that referenced this pull request Oct 9, 2022
…ackh726

don't ICE when normalizing closure input tys

We were ICEing while rendering diagnostics because `universe_causes` is expected to track every universe created in the typeck's infcx.

`normalize_and_add_constraints` doesn't update `universe_causes`
when creating new universes, causing an ICE. Remove it!

Add spans to better track normalization constraints.

Fix couple places where `universe_causes` is not updated correctly to
track newly added universes.

Fixes rust-lang#102800

~Fixess rust-lang#99665~ (UPDATE: no longer true; the issue has a different failure path than when this PR was created and should be fixed by rust-lang#101708, but the changes in this PR are still correct and should prevent potential future ICEs)
@compiler-errors compiler-errors deleted the issue-101696 branch November 2, 2022 02:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ICE: can't project out of PlaceTy
7 participants