Skip to content

Cleanup and consolidate operator/method dispatch code #18741

Open
@nikomatsakis

Description

@nikomatsakis
Contributor

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.

Activity

added
E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.
C-cleanupCategory: PRs that clean code up or issues documenting cleanup.
on Nov 7, 2014
nikomatsakis

nikomatsakis commented on Nov 7, 2014

@nikomatsakis
ContributorAuthor

I am happy to mentor.

steveklabnik

steveklabnik commented on Dec 31, 2015

@steveklabnik
Member

@nikomatsakis is this ticket still valid?

nikomatsakis

nikomatsakis commented on Jan 4, 2016

@nikomatsakis
ContributorAuthor

On Thu, Dec 31, 2015 at 10:26:12AM -0800, Steve Klabnik wrote:

@nikomatsakis is this ticket still valid?

yes

Phyllostachys

Phyllostachys commented on Jan 13, 2016

@Phyllostachys

Inspired by this and having been a long time fan of Rust and wanting to contribute, I'm interested in solving this issue. With that said, is there anything I need to know to get started? Also, where can I start looking?

nikomatsakis

nikomatsakis commented on Jan 13, 2016

@nikomatsakis
ContributorAuthor

@Phyllostachys to be honest it's a bit out of cache for me. I'd have to go read into the code some to see where things stand. Anyway, usually a good place to start is to try and touch base at some point on IRC or over e-mail.

Phyllostachys

Phyllostachys commented on Jan 13, 2016

@Phyllostachys

I'll have to jump on IRC tonight. Who would I email if I emailed someone?

nikomatsakis

nikomatsakis commented on Jan 14, 2016

@nikomatsakis
ContributorAuthor

@Phyllostachys me, my e-mail is on my github page

ahmedcharles

ahmedcharles commented on Aug 27, 2016

@ahmedcharles
Contributor

@nikomatsakis Are you still willing to mentor this?

Mark-Simulacrum

Mark-Simulacrum commented on May 13, 2017

@Mark-Simulacrum
Member

@ahmedcharles Are you still interested? We can try to connect you with niko if so

nikomatsakis

nikomatsakis commented on May 25, 2017

@nikomatsakis
ContributorAuthor

Well, it's quite out of cache, but let me start by giving a few very basic pointers. The relevant code is now found at src/librustc_typeck/check/method/mod.rs -- the fns in question are lookup_method() and lookup_method_in_trait_adjusted(). You may find the README.md in that same directory useful.

14 remaining items

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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

        Participants

        @steveklabnik@citizen428@nikomatsakis@koivunej@Phyllostachys

        Issue actions

          Cleanup and consolidate operator/method dispatch code · Issue #18741 · rust-lang/rust