Skip to content

refactor ProjectionTy to store def-id of associated item + substs #42171

Closed

Description

@nikomatsakis

In preparation for ATC, we should refactor ProjectionTy to store the DefId of the trait associated item along with a set of substs for that item. (Currently, it stores a trait-ref (trait def-id + substs) and item name.) Currently, these substs will always be the same as the substs for the trait, but once ATC lands they will include additional items.

cc @tschottdorf, who has started in on this
cc @eddyb, who has a vague interest in this :)

Activity

  1. added
    C-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.
    on May 23, 2017
  2. tbg commented on May 27, 2017

    @tbg
    Contributor

    Quick question - for storing substs, would a ProjectionTy start out with a copy of the substs of the corresponding TraitRef at creation time, or is it sharing the substs with it in general?

  3. eddyb commented on May 27, 2017

    @eddyb
    Contributor

    @tschottdorf How would the two options differ? What do you mean by "sharing"?

  4. tbg commented on May 27, 2017

    @tbg
    Contributor

    @eddyb Niko mentioned above that for now, the substs in the TraitRef and those in ProjectionTy will be identical, so making a copy isn't strictly necessary. He also mentioned that they're bound to diverge with ATC, so it seems reasonable not to tie the two together.

  5. eddyb commented on May 27, 2017

    @eddyb
    Contributor

    Maybe he wasn't clear on the fact that TraitRef in ProjectionTy would be replaced, so the end result only has DefId for the associated type and Substs for it (which currently would be the same that you would find in the TraitRef).

  6. tbg commented on May 28, 2017

    @tbg
    Contributor

    Sorry, didn't phrase that well - I'm aware that trait_ref will be dropped, what I'm really asking is: is the intended behavior instead of storing the trait_ref, it will store a copy of the substs that are in the trait_ref at the time the ProjectionTy is constructed. Your last sentence answers it though, so my question has been addressed. Thanks @eddyb!

  7. added a commit that references this issue on Jun 1, 2017
  8. 11 remaining items

  9. added a commit that references this issue on Jul 11, 2017
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-trait-systemArea: Trait 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.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions