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

Normalization can indirectly observe a method's own predicates in method probing #134

Open
compiler-errors opened this issue Nov 27, 2024 · 0 comments

Comments

@compiler-errors
Copy link
Member

cc rust-lang/rust#133519

Method probing in the old solver is stronger than the new solver because eagerly normalizing types causes us to check their corresponding trait goals. This is important because we don't end up checking all of the where clauses of a method when method probing; just the where clauses of the impl. i.e., for:

impl Foo
where
   WC1,
{
    fn method()
    where
        WC2,
    {}
}

We only check WC1 and not WC2. This is because at this point in probing the method is instantiated w/ infer vars, and checking the where clauses in WC2 will lead to cycles if we were to check them (at least that's my understanding; I could investigate changing that in general, incl. in the old solver, but I don't have much confidence that it won't lead to really bad overflows.)


Currently, we're checking the xform_ret_ty for WF to emulate this behavior in the new solver. However, we should probably eventually move onto just checking all the method predicates in consider_probe, probably once we've moved onto the new solver for good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant