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

Explain HRTB + infer limitations of old solver #115625

Merged
merged 1 commit into from
Sep 19, 2023

Conversation

compiler-errors
Copy link
Member

Add a helpful message when we hit the limitation of the old trait solver where we don't properly normalize GATs with infer vars + bound vars, leading to too-eagerly reporting trait errors that would be later satisfied due to inference.

@rustbot
Copy link
Collaborator

rustbot commented Sep 7, 2023

r? @b-naber

(rustbot has picked a reviewer for you, use r? to override)

@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 Sep 7, 2023
Comment on lines +16 to +17
| | the trait solver is unable to infer the generic types that should be inferred from this argument
| add turbofish arguments to this call to specify the types manually, even if it's redundant
Copy link
Member Author

Choose a reason for hiding this comment

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

This is a half-lie. It's not that Rust isn't able to infer the generic types constrained from this arg, but instead that Rust is attempting to prove predicates before constraining any generics that would be constrained by this argument.

I chose to state it like this because it's a bit clearer to the user. Not everyone knows the exact order the typeck does signature instantiation -> normalization -> unification of args -> fulfillment, nor do I think they need to. They just need to know that if they have a signature like:

fn foo<T: Trait>(t: T) where for<'a> T::Gat<'a>: Send {}

They should turbofish foo::<MyTypeGoesHere>(t).

@b-naber
Copy link
Contributor

b-naber commented Sep 12, 2023

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Sep 12, 2023

📌 Commit d122155 has been approved by b-naber

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 12, 2023
@bors
Copy link
Contributor

bors commented Sep 12, 2023

⌛ Testing commit d122155 with merge e03aed3...

bors added a commit to rust-lang-ci/rust that referenced this pull request Sep 12, 2023
…naber

Explain HRTB + infer limitations of old solver

Add a helpful message when we hit the limitation of the old trait solver where we don't properly normalize GATs with infer vars + bound vars, leading to too-eagerly reporting trait errors that would be later satisfied due to inference.
@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Contributor

bors commented Sep 12, 2023

💔 Test failed - checks-actions

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Sep 12, 2023
@compiler-errors
Copy link
Member Author

@bors r=b-naber

@bors
Copy link
Contributor

bors commented Sep 19, 2023

📌 Commit 976d377 has been approved by b-naber

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 19, 2023
bors added a commit to rust-lang-ci/rust that referenced this pull request Sep 19, 2023
…llaumeGomez

Rollup of 6 pull requests

Successful merges:

 - rust-lang#112725 (rustdoc-search: add support for type parameters)
 - rust-lang#114941 (Don't resolve generic impls that may be shadowed by dyn built-in impls)
 - rust-lang#115625 (Explain HRTB + infer limitations of old solver)
 - rust-lang#115839 (Bump libc to 0.2.148)
 - rust-lang#115924 (Don't complain on a single non-exhaustive 1-ZST)
 - rust-lang#115946 (panic when encountering an illegal cpumask in thread::available_parallelism)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit c452090 into rust-lang:master Sep 19, 2023
@rustbot rustbot added this to the 1.74.0 milestone Sep 19, 2023
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Sep 19, 2023
Rollup merge of rust-lang#115625 - compiler-errors:hrtb-infer-err, r=b-naber

Explain HRTB + infer limitations of old solver

Add a helpful message when we hit the limitation of the old trait solver where we don't properly normalize GATs with infer vars + bound vars, leading to too-eagerly reporting trait errors that would be later satisfied due to inference.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

5 participants