Skip to content

Type inference problems during method probing #89650

Open
@b-naber

Description

@b-naber

While postponing the normalization of the return type as done in #86506 does fix #85671 there is likely some deeper underlying bug that causes this specific bug.

As mentioned by @jackh726:

Now that I'm looking at this, I actually understand the problem here. It's a bit weird. Because of the Self: AsSlice<Element = Coef> bound, we end up with a predicate <A as AsSlice>::Element = Coef in the param_env when type checking failing. Then, later, we try to normalize <A<_#3t> as AsSlice>::Element. We then use that predicate in the param_env as a candidate, unifying _#3t with Cont and getting a result of Coef.

That also causes our self_ty to gets inferred to be &ReErased A. This doesn't match &ReErased A<&'_#1r [Coef]>.

Delaying normalization of the return type does work, but I think that it hides a deeper bug. Ideally, I think the problem is the param_env itself. The clauses here probably shouldn't have Params, but instead either fresh vars or maybe just be canonicalized.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-inferenceArea: Type inferenceT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions