-
Notifications
You must be signed in to change notification settings - Fork 209
Re-introduce covariance for containers #502
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
Conversation
b17927e
to
aff1351
Compare
aff1351
to
ddf4f84
Compare
1a65947
to
b862172
Compare
b862172
to
df28ab0
Compare
Rebased. CI is failing only because of CHANGELOG. |
df28ab0
to
166583d
Compare
40a7fd3
to
21dd498
Compare
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!
This looks logical, but I'm not confident enough to merge this on my review alone, will wait for another review from @rust-embedded/libs to merge.
21dd498
to
dc5ed62
Compare
It doesn't mean much because I'm not a member of the libs team, and also don't know much about the internals of heapless. But I was curious and spent some time to understand both the issue and the proposed solution. The key information not obvious from other parts of the documentation was https://rustc-dev-guide.rust-lang.org/variance.html#variance-and-associated-types. After I found that, I'm convinced your proposal is a good solution. It's unfortunate that it complicates the code a bit, but it's probably worth it. I tried to measure the effect on binary sizes and compiled the embassy uart_r503 example with heapless 0.8.0 and with this branch, and the version from this branch was actually 20 bytes smaller than with 0.8.0. |
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.
Looking great to me.
MpMc
andspsc::Queue
are not migrated to the new pattern because they were already invariant due to theUnsafeCell
.Fix #501