-
Notifications
You must be signed in to change notification settings - Fork 632
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
Prevent double boxing in boxed
#511
Comments
boxed
in a way it prevents double boxingboxed
This possibly can be implemented without RTTI using something like |
First, Second, if you know how to implement it with |
I'm not sure (but likely so). Docs/ASM proof?
If I understood the issue correctly, here is the proof of concept: #513. |
Your tests from #512 passes. Decided not to copy/paste them nevertheless. |
Thanks. It doesn't work in stable though. |
Specialisation would be much nicer. |
@Kixunil it doesn't work in stable. Anyway, it doesn't matter how it is implemented internally, from user point view nothing will change when in couple of months implementation will be changed to specialization. |
@stjepang I know. I feel like everything is blocked on specialisation these days... I agree with implementing it with |
Closing due to #512 (comment) |
future.boxed()
creates a new box even iffuture
itself is already aBox<Future>
.This can be inconvenient in this use case:
If
SomeFuture
is an alias forBox<Future>
thenaccept_future
makes aBox<Box<Future>>
. Which could be worked around (e. g. by creating another function likebut that would be inconvenient, and still won't prevent accidental wrapping futures in double boxes.
boxed
could implemented like this:PR #512 implements
boxed
inFuture
andStream
this way.The text was updated successfully, but these errors were encountered: