-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Add support for default trait implementations #21689
Conversation
(rust_highfive has picked a reviewer for you, use r? to override) |
d2f1332
to
c45dc30
Compare
Since void structs are warned to be changed into |
@nagisa if we allow that, we should also allow |
c45dc30
to
2f3c2b5
Compare
@@ -126,6 +126,7 @@ enum Family { | |||
TupleVariant, // v | |||
StructVariant, // V | |||
Impl, // i | |||
DefTrait, // d |
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.
Let's call this DefaultedTrait
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.
Never mind, let's call it DefaultImpl
or something like that.
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.
I'm terrible with naming things. If we rename this to DefaultImpl
, we should probably also rename the Item_
as DefaultImpl
instead of DefaultTrait
0f05cde
to
5c78f48
Compare
This is looking really good. Here is a checklist of things I noticed while reading (it's hard to leave comments on individual commits because I was reading the collapsed diff):
UPDATED the supertrait bullet point |
Some further comments from IRC:
|
892c4fd
to
a163c23
Compare
⌛ Testing commit 3dcc631 with merge d15a06a... |
💔 Test failed - auto-win-64-nopt-t |
@bors : retry |
⌛ Testing commit 3dcc631 with merge 812dd9f... |
💔 Test failed - auto-linux-32-nopt-t |
💔 Test failed - auto-linux-32-opt |
💔 Test failed - auto-win-64-opt |
💔 Test failed - auto-win-32-opt |
@bors: retry |
⌛ Testing commit 3dcc631 with merge ca9b37e... |
💔 Test failed - auto-mac-64-nopt-t |
@bors retry curse you! |
⌛ Testing commit 3dcc631 with merge dc6e06e... |
This is one more step towards completing #13231 This series of commits add support for default trait implementations. The changes in this PR don't break existing code and they are expected to preserve the existing behavior in the compiler as far as built-in bounds checks go. The PR adds negative implementations of `Send`/`Sync` for some types and it removes the special cases for `Send`/`Sync` during the trait obligations checks. That is, it now fully relies on the traits check rather than lang items. Once this patch lands and a new snapshot is created, it'll be possible to add default impls for `Send` and `Sync` and remove entirely the use of `BuiltinBound::{BoundSend,BoundSync}` for positive implementations as well. This PR also removes the restriction on negative implementations. That is, it is now possible to add negative implementations for traits other than `Send`/`Sync`
💔 Test failed - auto-win-32-nopt-t |
@bors: retry |
This is one more step towards completing #13231 This series of commits add support for default trait implementations. The changes in this PR don't break existing code and they are expected to preserve the existing behavior in the compiler as far as built-in bounds checks go. The PR adds negative implementations of `Send`/`Sync` for some types and it removes the special cases for `Send`/`Sync` during the trait obligations checks. That is, it now fully relies on the traits check rather than lang items. Once this patch lands and a new snapshot is created, it'll be possible to add default impls for `Send` and `Sync` and remove entirely the use of `BuiltinBound::{BoundSend,BoundSync}` for positive implementations as well. This PR also removes the restriction on negative implementations. That is, it is now possible to add negative implementations for traits other than `Send`/`Sync`
This... renamed |
I am not killing the build because the rest of this patch is important, but someone will have to revert that change. |
@eddyb that change was obviously unintentional and no-one noticed because the patch is quite big and the rename came in the middle. In other words, assume good faith ;) I'll revert that change. |
@flaper87 I realized it was sed gone wrong. My UFCS patch is rebased on top of a revert, otherwise rebasing would've been much more painful. I guess I noticed only because I was looking for potential conflicts. |
@eddyb oh awesome, thanks for fixing it, you saved me some revert time :D |
Hey, it landed! 👯 |
🎆 |
This is one more step towards completing #13231
This series of commits add support for default trait implementations. The changes in this PR don't break existing code and they are expected to preserve the existing behavior in the compiler as far as built-in bounds checks go.
The PR adds negative implementations of
Send
/Sync
for some types and it removes the special cases forSend
/Sync
during the trait obligations checks. That is, it now fully relies on the traits check rather than lang items.Once this patch lands and a new snapshot is created, it'll be possible to add default impls for
Send
andSync
and remove entirely the use ofBuiltinBound::{BoundSend,BoundSync}
for positive implementations as well.This PR also removes the restriction on negative implementations. That is, it is now possible to add negative implementations for traits other than
Send
/Sync