Explain HRTB + infer limitations of old solver#115625
Merged
bors merged 1 commit intorust-lang:masterfrom Sep 19, 2023
Merged
Conversation
Collaborator
|
r? @b-naber (rustbot has picked a reviewer for you, use r? to override) |
compiler-errors
commented
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 |
Contributor
Author
There was a problem hiding this comment.
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).
This was referenced Sep 7, 2023
Open
Contributor
|
@bors r+ rollup |
Collaborator
Collaborator
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.
This comment has been minimized.
This comment has been minimized.
Collaborator
|
💔 Test failed - checks-actions |
d122155 to
976d377
Compare
Contributor
Author
|
@bors r=b-naber |
Collaborator
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
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.