-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove unnecessary self_ty
parameter to get_blanket_impls
#81349
Conversation
r? @ollie27 (rust-highfive has picked a reviewer for you, use r? to override) |
d09b3c6
to
d5c7273
Compare
@eddyb you have this fixme in rustdoc:
Why is param_env_def_id wrong? Why would there need to be a better way? |
This comment has been minimized.
This comment has been minimized.
918315a
to
dd6130a
Compare
@camelid this is finally ready for review again :) |
I may not be able to review this PR since I'm not very familiar with the code, but I'll assign myself so I don't forget about it altogether :) @ollie27 Feel free to review/approve this if you want to — I just assigned myself because otherwise I'll never remember to look at it. |
This comment has been minimized.
This comment has been minimized.
dd6130a
to
3dfdce3
Compare
3dfdce3
to
85917f4
Compare
This comment has been minimized.
This comment has been minimized.
85917f4
to
880e8f4
Compare
param_env_def_id: DefId, | ||
item_def_id: DefId, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why was this change made? Did the meaning change, or is item_def_id
closer to the meaning than param_env_def_id
? Do ParamEnv
s even have DefId
s?
Sorry for all the questions; I know almost nothing about ParamEnv
:)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
item_def_id
is closer to the meaning. All items have a ParamEnv, but the same ParamEnv may be used for things other than items (e.g. each expression in the body of a function). Before, there was a semantic mismatch in the representation: it passed in a Ty
, but not all types are items (for example &T
). So to get the param env of the type it had to pass in the DefId too. Now it passes in the DefId only, which allows getting both the param env and the type without any additional info.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How will get_blanket_impls
behave now for blanket impls like impl Foo for &Struct
where the type is &Struct
but the type_of
the item_def_id
is Struct
? (Unless I'm misunderstanding what the item_def_id
is referring to.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The same as it did before, all this does is rename the parameter and move the type_of
into the function. I don't know exactly how it worked before.
Could you take a look at #81349 (comment)? @rustbot label: -S-waiting-on-review +S-waiting-on-author |
Do you want to follow up with eddyb or someone else about this? |
I would rather not block on it, eddyb is very behind on github notifications. |
I'm not sure if I'd feel comfortable approving this on my own given my lack of familiarity with |
r? @lcnr |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some nits
r=me after that
It can be calculated when necessary at the callsite, there's no need to pass it separately. This also renames `param_env_def_id` to `item_def_id`.
0914acb
to
c47c2c6
Compare
@bors r=lcnr |
📌 Commit c47c2c6 has been approved by |
☀️ Test successful - checks-actions |
It can be calculated when necessary at the callsite, there's no need to
pass it separately.
This also renames
param_env_def_id
toitem_def_id
.cc @eddyb