-
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
Fix checking of auto trait bounds in trait objects. #45772
Fix checking of auto trait bounds in trait objects. #45772
Conversation
Any auto trait is allowed in trait object bounds. Fix duplicate check of type and lifetime parameter count.
(rust_highfive has picked a reviewer for you, use r? to override) |
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.
Code looks nice.
} else { | ||
false | ||
} | ||
Def::Trait(trait_did) if tcx.trait_is_auto(trait_did) => { |
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.
In principle we could easily extend this to arbitrary marker traits, I suppose?
Oh, I guess that's annoying, for same reason as before. Forgive me, old habits die hard. =) |
OK -- thought this over. I don't think extending to arbitrary marker traits is something we can do without an RFC. But auto traits should be ok, since defining new auto traits is still unstable. |
Well, there are a few auto traits that are stable and are not |
@bors fcp merge I'd like to propose that we merge this PR. It has the effect of enabling trait objects with arbitrary auto traits composed together. So, whereas before you could only do I don't feel an RFC is needed for this particular PR. However, to go further and support composition of arbitrary object-safe traits, I would like to have an RFC. This is not because I expect us to be against the basic idea, but just because there are various approaches we might take (e.g., I favor multiple vtables, but a case can be made for a single composed vtable) and I think it would benefit from a proper design cycle. The change as implemented is "insta-stable". If we wanted, we could also make arbitrary extensions to the capabilities here, but require a feature-gate to go beyond |
@nikomatsakis I think you meant to invoke @rfcbot. |
@rfcbot fcp merge |
Team member @withoutboats has proposed to merge this. The next step is review by the rest of the tagged teams: No concerns currently listed. Once these reviewers reach consensus, this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! See this document for info about what commands tagged team members can give me. |
Wait, what's the explanation here? |
@eddyb If we do it I imagine that when the |
@leodasvacas But that's standard procedure - whoever updates the bootstrap compiler removes all the |
@eddyb Ah, I was ignorant on the process here. I'll do it then. |
@rfcbot reviewed |
It's completely unused.
Removed the |
🔔 This is now entering its final comment period, as per the review above. 🔔 |
@bors r+ |
📌 Commit 7995f87 has been approved by |
@bors r- |
Guess I should show some decorum and wait a bit for FCP. |
@bors r+ I'm impatient. We can always back it out if something dramatic comes up. |
📌 Commit 7995f87 has been approved by |
⌛ Testing commit 7995f87 with merge e33731286e7e57b67375218bb3024caa93d4a530... |
💔 Test failed - status-travis |
@bors retry
|
…r=nikomatsakis Fix checking of auto trait bounds in trait objects. Any auto trait is allowed in trait object bounds. Fix duplicate check of type and lifetime parameter count, which we were [emitting twice](https://play.rust-lang.org/?gist=37dbbdbbec62dec423bb8f6d92f137cc&version=stable). Note: This was the last use of `Send` in the compiler, meaning after a new `stage0` we could remove the `send` lang item.
💔 Test failed - status-travis |
@bors retry
|
…r=nikomatsakis Fix checking of auto trait bounds in trait objects. Any auto trait is allowed in trait object bounds. Fix duplicate check of type and lifetime parameter count, which we were [emitting twice](https://play.rust-lang.org/?gist=37dbbdbbec62dec423bb8f6d92f137cc&version=stable). Note: This was the last use of `Send` in the compiler, meaning after a new `stage0` we could remove the `send` lang item.
☀️ Test successful - status-appveyor, status-travis |
@gbutler69 It was removed because it was no longer in use. Keeping lang items to a minimal is good. |
Any auto trait is allowed in trait object bounds. Fix duplicate check of type and lifetime parameter count, which we were emitting twice.
Note: This was the last use of
Send
in the compiler, meaning after a newstage0
we could remove thesend
lang item.