Upgrade ProjectionTy's Name to a DefId#42297
Conversation
|
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @nikomatsakis (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
nikomatsakis
left a comment
There was a problem hiding this comment.
This looks pretty good. I left a few requests for changes. The main question is whether we care about hygiene for these item lookups (as you noted) -- I would guess no, but perhaps @jseyfried or @petrochenkov knows better?
src/librustc/ty/structural_impls.rs
Outdated
There was a problem hiding this comment.
this is correct as is
src/librustc/ty/sty.rs
Outdated
There was a problem hiding this comment.
I would say "The DefId of the TraitItem for the associated type N."
There was a problem hiding this comment.
PS kudos to you for commenting :)
src/librustc/ty/sty.rs
Outdated
There was a problem hiding this comment.
Nit: formatting. I think that in this case, the -> goes on next line, and I personally would put { indented with pub (so that body is clearly distinguished from the signature). But we don't have hard-and-fast rules here. You could also align with the open (.
src/librustc/ty/sty.rs
Outdated
There was a problem hiding this comment.
Yeah, bother, I don't know how hygiene and "associated item lookup" are supposed to interact here. @jseyfried may have thoughts.
There was a problem hiding this comment.
Removed as per comment on main thread.
src/librustc/ty/sty.rs
Outdated
There was a problem hiding this comment.
Maybe add a comment here?
"Construct a ProjectionTy by searching the trait from trait_ref for the associated item named item_name."
src/librustc/ty/util.rs
Outdated
There was a problem hiding this comment.
we don't actually need the first hash (of data.trait_ref.def_id); the second should suffice, I think.
There was a problem hiding this comment.
this is fine for now; eventually, though, we could make lang-items for the associated types from "well known" traits like this
There was a problem hiding this comment.
Ack, feel free to throw that my way at some point. I'm not sure what it would entail.
|
@arielb1 writes on IRC that we don't use hygiene for associated item lookup at present (which is also what I thought). This suggests @tschottdorf that the code for |
Part of rust-lang#42171, in preparation for downgrading the contained `TraitRef` to only its `substs`.
|
Thanks for the review! Comments addressed. |
|
@bors r+ |
|
📌 Commit e5e664f has been approved by |
Upgrade ProjectionTy's Name to a DefId Part of rust-lang#42171, in preparation for downgrading the contained `TraitRef` to only its `substs`. Some inline questions in the diff. Look for `FIXME(tschottdorf)`. These comments should be addressed before merging.
Upgrade ProjectionTy's Name to a DefId Part of rust-lang#42171, in preparation for downgrading the contained `TraitRef` to only its `substs`. Some inline questions in the diff. Look for `FIXME(tschottdorf)`. These comments should be addressed before merging.
Part of #42171, in preparation for downgrading the contained
TraitReftoonly its
substs.Some inline questions in the diff. Look for
FIXME(tschottdorf). These commentsshould be addressed before merging.