-
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
Make ThinBox<T>
covariant in T
#98585
Conversation
Just like `Box<T>`, we want `ThinBox<T>` to be covariant in `T`, but the projection in `WithHeader<<T as Pointee>::Metadata>` was making it invariant. This is now hidden as `WithOpaqueHeader`, which we type-cast whenever the real `WithHeader<H>` type is needed.
Hey! It looks like you've submitted a new PR for the library teams! If this PR contains changes to any Examples of
|
r? @thomcc (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.
Very clever. IMO ideally there would be really nice if there were a way to do this with more "naive" use of Pointee, but this is a nice solution
@bors r+ |
📌 Commit e67e165 has been approved by |
Ah crap, should this have gone through t-libs-api? Since it's a change to an unstable API? |
@rustbot label -S-waiting-on-author +S-waiting-on-review |
So wait, what was the outcome of the meeting today? Is it okay to r+ this? I mean, it's desirable (IMO), and people have had time to weigh in (probably). |
Yeah, I think it's fine, especially since the tracking issue was asking "can we", not "should we", and it's still unstable. |
Alright! @bors r+ |
📌 Commit e67e165 has been approved by |
Rollup of 6 pull requests Successful merges: - rust-lang#97488 (Suggest blanket impl to the local traits) - rust-lang#98585 (Make `ThinBox<T>` covariant in `T`) - rust-lang#98644 (fix ICE with -Wrust-2021-incompatible-closure-captures) - rust-lang#98739 (fix grammar in useless doc comment lint) - rust-lang#98741 (Many small deriving cleanups) - rust-lang#98756 (Use const instead of function and make it private) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Just like
Box<T>
, we wantThinBox<T>
to be covariant inT
, but theprojection in
WithHeader<<T as Pointee>::Metadata>
was making itinvariant. This is now hidden as
WithOpaqueHeader
, which we type-castwhenever the real
WithHeader<H>
type is needed.Fixes the problem noted in #92791 (comment).