Skip to content

Cleanup and consolidate operator/method dispatch code #18741

Open
@nikomatsakis

Description

@nikomatsakis

Once upon a time, both operator dispatch and method lookup went through the same tangled, twisty paths. It was a mess. But lo, they were severed and made two. Each could follow its own path. Overall, this is progress. But there is still room for improvement:

  1. The second half of "operator dispatch" is basically the same as confirm::confirm, but with some slight differences.
  2. The autoderef loop for [] is basically the same as probe, but with some slight differences (e.g., at each step it consists builtin [] as well).
  3. The probe loop, which uses check::autoderef, isn't able to be part of an inference transaction between check::autoderef uses operator dispatch which adds things into the main fulfillment context, thus leaking inference types etc outside the transaction.

It feels like things could still be cleaned up a bit further, allowing for more code reuse and happiness all around.

Some FIXMEs are scattered about at relevant points of the code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-type-systemArea: Type systemC-cleanupCategory: PRs that clean code up or issues documenting cleanup.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.T-typesRelevant to the types 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