-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
replace convert::Infallible
with !
#49038
replace convert::Infallible
with !
#49038
Conversation
r? @sfackler (rust_highfive has picked a reviewer for you, use r? to override) |
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.
Horray! One step closer to stable TryFrom
...
src/libcore/num/mod.rs
Outdated
@@ -3595,20 +3595,12 @@ impl fmt::Display for TryFromIntError { | |||
} | |||
} | |||
|
|||
#[unstable(feature = "try_from", issue = "33417")] | |||
impl From<Infallible> for TryFromIntError { |
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They're implemented. No idea why they're not showing up in rustdoc.
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.
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.