Skip to content

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

Open
@compiler-errors

Description

@compiler-errors

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions