-
Notifications
You must be signed in to change notification settings - Fork 13k
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
rustc_skip_during_method_dispatch: decouple receiver & edition #129871
rustc_skip_during_method_dispatch: decouple receiver & edition #129871
Conversation
This comment has been minimized.
This comment has been minimized.
51788be
to
66d44ce
Compare
These commits modify the If this was unintentional then you should revert the changes before this PR is merged. This PR changes Stable MIR |
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.
Thanks for putting in the effort for generalizing this attribute, but given its inherently hacky nature, I personally don't believe it warrants generalization at the moment. I think the right point at which to decide is when we add another hack implementation in edition 2027, since there's no guarantee that this change is actually well suited for whatever receiver/trait pair we'd need to apply this to next, and the current design is suitable for the two existing implementations at moment.
Sounds reasonable. I will look into whether it is possible to move this from trait declarations to implementations, as this might reduce the "hackiness". But it is probably very not trivial, because otherwise it would've likely already been done. But until then, |
☔ The latest upstream changes (presumably #130016) made this pull request unmergeable. Please resolve the merge conflicts. |
since this is now in draft status, i'll move it back to waiting-on-author @rustbot author |
@GrigorenkoPV any updates of this? |
I initially created this as a step forward to #129872, which, similarly to However, #129872 should probably go through an ACP first, which I am yet to write. (Then the ACP itself will probably also take ages to get accepted/declined.) |
@GrigorenkoPV thanks. I'm going to close this then since this is blocked on a pr that requires an ACP to be written and merged and that's going to take a while which could cause this to bitrot. |
// FIXME: We could probably do way better attribute validation here.
array
andboxed_slice
away to aGatedReceiver
enum, offering a more convenient extension point for when we run into the "add this impl now, but gate the method call syntax behind an edition" situation again.Receiver
+Edition
pairs.#[non_exhaustive]
enum for Editions.Would be cool if this attribute could be applied inside of an impl instead of to the entire trait declaration. This would eliminate the need for the
receiver
in the first place. But that's either something that had already been tried and failed, or a story for another day.Footnotes
An alternative would be to use a HashMap from receivers to editions, but 99.999% of the time it would be empty (currently
IntoIterator
is the only trait in existence to have this attribute) and the remaining 0.001% it has like two elements, so any asymptotic improvements would probably be crushed by the constant multiplier. AlsoThinVec
is just 1 pointer wide, whileFxHashMap
is 4, IIRC. A bit wasteful. ↩