replace convert::Infallible with !#49038
Conversation
|
r? @sfackler (rust_highfive has picked a reviewer for you, use r? to override) |
scottmcm
left a comment
There was a problem hiding this comment.
Horray! One step closer to stable TryFrom...
| } | ||
|
|
||
| #[unstable(feature = "try_from", issue = "33417")] | ||
| impl From<Infallible> for TryFromIntError { |
There was a problem hiding this comment.
Maybe leave this as impl From<!> For TryFromIntError? This is here so that you can use u32: TryFrom<u16> in a method returning Result<_, TryFromIntError>, which I think is still wanted. (Not for those types literally, but for when they're c_whatever aliases.)
There was a problem hiding this comment.
I removed it thinking that we'd have impl<T> From<!> for T, but since we won't have that until we have specialization with intersection impls I guess I'd better add it back.
| /// signals to both the compiler and the user that the error case is impossible. | ||
| #[unstable(feature = "try_from", issue = "33417")] | ||
| #[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] | ||
| pub enum Infallible {} |
There was a problem hiding this comment.
Looking through that list of derives, are we missing Copy and Clone for !? They're not in the rustdoc, at least: https://doc.rust-lang.org/nightly/std/primitive.never.html#implementations
(Not a blocker for this PR, of course.)
There was a problem hiding this comment.
They're implemented. No idea why they're not showing up in rustdoc.
There was a problem hiding this comment.
Ah, looks like this is a nearing-three-year-old bug with primitives: #25893
|
It looks like the travis failure here had nothing to do with this PR. |
Replace uninhabited error enums in std with never Luckily I only found two, and one of them isn't in beta yet, so can disappear completely 😎 Are there any others I forgot? (There are lots in things like liblibc and libstd/sys, but AFAIK those don't matter, nor do things like `btree::node::LeafOrInternal` or `str::pattern::RejectAndMatch`.) The unstable `convert::Infallible` is being handled by #49038⚠️ This change may be a 1.26-or-never one. cc #48950 (comment) r? @alexcrichton
|
edb2fdb to
15bab45
Compare
|
Oops, thanks for pointing that out. |
This looks like the same as #48265 (comment), you may need to swap the order of bounds in the expected rustdoc output in the comment in Something like |
|
I’ve filed #49123 for that rustdoc test failure. |
|
📌 Commit 15bab45 has been approved by |
…ver, r=SimonSapin replace `convert::Infallible` with `!`
|
There are several empty enum types in std. For example: impl FromStr for String {
type Err = ParseError;
}My question is, are they going to be replaced by |
|
This is being discussed at #49039 |
No description provided.