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

Make sure to instantiate placeholders correctly in old solver #119947

Merged

Conversation

compiler-errors
Copy link
Member

@compiler-errors compiler-errors commented Jan 13, 2024

When creating the query substitution guess for an input placeholder type like !1_T (in universe 1), we were guessing the response substitution with something like !0_T. This failed to unify with !1_T, causing an ICE.

This PR reworks the query substitution guess code to work a bit more like the new solver. I'm pretty sure this is correct, though I'd really appreciate some scrutiny from someone (cough lcnr) who knows a bit more about query instantiation :)

Fixes #119941

r? lcnr

@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 Jan 13, 2024
trait Everyone {}
impl<T: ?Sized> Everyone for T {}

fn hello() where for<T> <T as Id>::Output: Everyone {}
Copy link
Member Author

Choose a reason for hiding this comment

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

I'm somewhat concerned that this doesn't fail if we, for example, replace with this for<'a> <&'a () as Id>::Output, which should have this same issue? 🤔

Copy link
Contributor

Choose a reason for hiding this comment

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

I think this is also an issue for regions, but we may never canonicalize placeholders from a non-root universe?

in MIR typeck we instantiate the binder in the query, so it doesn't contain placeholders.

Method probing also only has root variables 🤔

Where else do we use the old canonicalizer?

@lcnr
Copy link
Contributor

lcnr commented Jan 15, 2024

@bors try @rust-timer queue

r=me after perf

@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 Jan 15, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 15, 2024
…te-response, r=<try>

Make sure to instantiate placeholders correctly in old solver

When creating the query substitution guess for an input placeholder type like `!1_T` (in universe 1), we were guessing the response substitution with something like `!0_T`. This failed to unify with `!1_T`, causing an ICE.

This PR reworks the query substitution guess code to work a bit more like the new solver. I'm *pretty* sure this is correct, though I'd really appreciate some scrutiny from someone (*cough* lcnr) who knows a bit more about query instantiation :)

Fixes rust-lang#119941

r? lcnr
@bors
Copy link
Contributor

bors commented Jan 15, 2024

⌛ Trying commit 985e1e0 with merge 4d4360e...

@bors
Copy link
Contributor

bors commented Jan 15, 2024

☀️ Try build successful - checks-actions
Build commit: 4d4360e (4d4360e59012da0d069cde10bc04cedf525bdd48)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (4d4360e): 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-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.

mean range count
Regressions ❌
(primary)
3.0% [2.4%, 3.7%] 2
Regressions ❌
(secondary)
1.6% [1.6%, 1.6%] 2
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 3.0% [2.4%, 3.7%] 2

Cycles

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

Binary size

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

Bootstrap: 666.737s -> 667.157s (0.06%)
Artifact size: 308.19 MiB -> 308.14 MiB (-0.02%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jan 15, 2024
@compiler-errors
Copy link
Member Author

uwu

@bors r=lcnr

@bors
Copy link
Contributor

bors commented Jan 15, 2024

📌 Commit 985e1e0 has been approved by lcnr

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 Jan 15, 2024
@bors
Copy link
Contributor

bors commented Jan 16, 2024

⌛ Testing commit 985e1e0 with merge 533cfde...

@bors
Copy link
Contributor

bors commented Jan 16, 2024

☀️ Test successful - checks-actions
Approved by: lcnr
Pushing 533cfde to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Jan 16, 2024
@bors bors merged commit 533cfde into rust-lang:master Jan 16, 2024
12 checks passed
@rustbot rustbot added this to the 1.77.0 milestone Jan 16, 2024
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (533cfde): 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.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-2.6% [-2.6%, -2.6%] 1
Improvements ✅
(secondary)
-1.3% [-1.3%, -1.3%] 1
All ❌✅ (primary) -2.6% [-2.6%, -2.6%] 1

Cycles

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

Binary size

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

Bootstrap: 664.881s -> 664.25s (-0.09%)
Artifact size: 308.33 MiB -> 308.27 MiB (-0.02%)

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 with feature(non_lifetime_binders)
5 participants