-
Notifications
You must be signed in to change notification settings - Fork 0
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
old solver doesn't check normalization constraints in compare_impl_item
#166
Comments
I don't think this is necessarily unsound as calling the trait method should end up having us prove (and normalize) the trait predicates again. So if normalization in the impl results in an error, it should also error when trying to use the impl in these cases. I believe that we should try to break this code in the old solver. I am unsure how we'd best hack around this in the new solver and would be quite unhappy if we have to. |
I think the analysis in this issue is a bit misguided -- the "root cause" here is that applying a param-env candidate for a projection bound doesn't register the GAT wf obligations in the old solver (just impl candidates). Removing this fixes the issue: We could perhaps check GAT where clauses on all candidates in the old solver, or make the new solver only check GAT where clauses for impls. |
Actually, I was the one who was misguided. We do register GAT wf clauses for param-env candidates 🤔 but this is ignored (i.e. doesn't turn into a region error) in the old solver due to the |
|
https://github.com/rust-lang/rust/blob/aaa861493456e8a10e552dd208f85486de772007/compiler/rustc_hir_analysis/src/check/compare_impl_item.rs#L238-L239
The new solver doesn't eagerly normalize the hybrid env in
compare_impl_item
, so it actually ends up normalizing<&'b u32 as Trait>::Assoc<'a>
in the 'main' infcx, checking the resulting region constraintsThis requires the associated type to be rigid in the trait method and normalizeable in the hybrid env. To do that, the trait bound proving
T: Trait
needs to be on the trait instead of the method. Alternatively, we could probably use a where-bound which ends up global after instantiating with the impl args.affected tests
The text was updated successfully, but these errors were encountered: