-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Conversation
r? @b-naber (rustbot has picked a reviewer for you, use r? to override) |
| | 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 |
There was a problem hiding this comment.
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)
.
@bors r+ rollup |
…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.
💔 Test failed - checks-actions |
d122155
to
976d377
Compare
@bors r=b-naber |
…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
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.
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.