-
Notifications
You must be signed in to change notification settings - Fork 628
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
Never vs. PhantomData #32
Comments
Oh man I'd love to make use of Right now though this library does compile on stable Rust, and I'd personally prefer to require that, but as soon as How's that sound? |
Sounds great! I'll keep an eye out on the Did you have any thoughts about changing the name of |
The ergonomics of this feature didn't work out due to restrictions around default type parameters and missing trait impls for |
An RFC was recently approved for the
!
(Never
) type, which represents the type of a value that can never exist.Several structs in of
futures-rs
usePhantomData
to mark the type of values that can't exist, such as theError
type ofFinished
, theItem
type ofFailed
, and theItem
andError
types ofEmpty
. I believe that, once this PR lands (and then makes its way to stable), these structs should be rewritten to use theNever
type.Empty
, for example, could be written as follows:Unfortunately, this feature has yet to land on nightly, let alone stable. Therefore, a transition to
Never
is likely a ways off. As this library is already getting lots of attention, I believe there should be a plan for how and if to structure the library so that a future (hehe 😃 ) transition toNever
is possible.In order to be more consistent with terminology, I also think that
Empty
should be renamed toNever
.!
is calledNever
rather thanEmpty
orVoid
as a result of the discussion at the end of theNever
PR. The gist of it is thatEmpty
isn't a future for anEmpty
value, it's a future for a value that canNever
exist (i.e. itNever
completes).P.S. Great work on this library, @alexcrichton & company! I'm excited to use this in my future Rust projects.
The text was updated successfully, but these errors were encountered: