-
Notifications
You must be signed in to change notification settings - Fork 643
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Replace empty enums with Never type #1681
Conversation
Depending on the state of rust-lang/rust#57012, I think we can use cc @Nemo157 Any thoughts? |
rust-lang/rust#58733 is tempting... |
It is certainly tempting but feels potentially unstable because it seems that some versions cannot compile (although they are not versions supported by this crate...). I was thinking of copying "Future compatibility" section of Use |
298f633
to
a5a7225
Compare
Currently this PR does this. |
😕 This seems to happen frequently today.
|
It seems that the total build time has been greatly reduced with a943d65. |
r? @cramertj |
/// | ||
/// [never]: https://doc.rust-lang.org/nightly/std/primitive.never.html | ||
/// [infallible]: https://doc.rust-lang.org/nightly/std/convert/enum.Infallible.html#future-compatibility | ||
pub type Never = core::convert::Infallible; |
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.
would it make sense to impl std::error::Error
for this so that it can be used as a Never error type? I know so far we've used a bunch of bounds in tower like so S::Error: Into<Box<std::error::Error>>
and this would make it compat with that.
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.
@LucioFranco , but Infallible
does not implement std::error::Error
Into<Box<std::error::Error>>
you mentioned seems to work. https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=cda064b0d4459549673d30c79d70c886
EDIT: see #1681 (comment)
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.
Awesome, thank you!
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.
Infallible
seems to implement std::error::Error
via std::string::ParseError
.
We have two empty enums. It should be preferable to unify this.