-
Notifications
You must be signed in to change notification settings - Fork 13.8k
arbitrary_self_types: Split the Autoderef chain #146095
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
base: master
Are you sure you want to change the base?
arbitrary_self_types: Split the Autoderef chain #146095
Conversation
This PR changes a file inside |
This comment has been minimized.
This comment has been minimized.
bef5ba5
to
f3e8785
Compare
This comment has been minimized.
This comment has been minimized.
f3e8785
to
31788b7
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@rustbot label +F-arbitrary_self_types |
31788b7
to
1a2dbf8
Compare
The Miri subtree was changed cc @rust-lang/miri Some changes occurred in compiler/rustc_codegen_gcc |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Is this waiting on discussion and a decision from the lang team? |
@jackh726 Sorry I was not very clear. Indeed it would need a lang team discussion. To support the discussion, I am writing a report to describe what changes this would bring to the feature. |
☔ The latest upstream changes (presumably #145993) made this pull request unmergeable. Please resolve the merge conflicts. |
The report is a bit overdue. I would like to just publish a partial text while I need more time to restore some diagnostics. Acceptable receiversLanding #146095 means that types implementing
Library changesThis patch demonstrates that we now explicitly mark types like This is particularly important for ShadowingAfter careful consideration and testing, I believe that splitting the two traits do not change the fundamental reasoning behind method shadowing diagnostics. Before this change, concerns about shadowing items through |
I'm going to go ahead and nominate. This is just a vibe check. We're not making a binding decision at this time. The question on the table is only whether we might have such opposition to this direction that we'd block or discourage its exploration. For my part, I want to see this explored so we can fully consider it. |
1a2dbf8
to
32146f8
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
32146f8
to
423792b
Compare
Some changes occurred in compiler/rustc_codegen_cranelift cc @bjorn3 |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
423792b
to
962a737
Compare
This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
This comment has been minimized.
This comment has been minimized.
Receiver chain has been an extension of Deref chain, but the consequence has been questioned as this would admit method signatures that are deemed dubious. It is also debatable that Receiver trait which determines applicable `Self` type should have anything to do with dereference operation in general. This patch separate the two traits and isolate their use in the language. This means that in method probing, we will chase down a Deref chain for an applicable type for the variable `self`, from which we additionally chase down a Receiver chain for an applicable `Self` type from a list of methods that accepts one of these possible types of `self`.
962a737
to
0bd9ecd
Compare
We talked about this, for a vibe check, in the lang meeting this past week. People certainly aren't yet sold on this approach -- I'm not yet sold myself. However, I feel that the way to work out whether this approach is viable and desirable is to let @dingxiangfei2009 land this and explore it further -- experimentation will hopefully help to answer the kind of questions this approach raises and support the writing of comprehensive design documents for this -- and that went without objection. Putting on the hat of the lang champion here, then, this PR is OK to land as far as lang is concerned. We'll want to be careful, in how we do this experimentation, that we still support experimentation of and the ability to answer important design questions for the other model, e.g. to support work on evolving trait hierarchies, reborrowing, autoref, projection, etc., where we might want to compare how the complete solution would look either in the |
The job Click to see the possible cause of the failure (guessed by this bot)
|
Receiver chain has been an extension of Deref chain, but the consequence has been questioned as this would admit method signatures that are deemed dubious.
It is also debatable that Receiver trait which determines applicable
Self
type should have anything to do with dereference operation in general.This patch separate the two traits and isolate their use in the language. This means that in method probing, we will chase down a Deref chain for an applicable type for the variable
self
, from which we additionally chase down a Receiver chain for an applicableSelf
type from a list of methods that accepts one of these possible types ofself
.To facilitate discussion, we can use the Zulip thread #t-lang > Consequences of making Deref a subtrait of Receiver.
Pending items
arbitrary_self_types
gate again.