Skip to content
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

Merged
merged 2 commits into from
Mar 22, 2018

Conversation

canndrew
Copy link
Contributor

No description provided.

@rust-highfive
Copy link
Collaborator

r? @sfackler

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Mar 15, 2018
Copy link
Member

@scottmcm scottmcm left a 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...

@@ -3595,20 +3595,12 @@ impl fmt::Display for TryFromIntError {
}
}

#[unstable(feature = "try_from", issue = "33417")]
impl From<Infallible> for TryFromIntError {
Copy link
Member

@scottmcm scottmcm Mar 15, 2018

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.)

Copy link
Contributor Author

@canndrew canndrew Mar 15, 2018

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 {}
Copy link
Member

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.)

Copy link
Contributor Author

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.

Copy link
Member

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

@canndrew
Copy link
Contributor Author

It looks like the travis failure here had nothing to do with this PR.

bors added a commit that referenced this pull request Mar 15, 2018
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
@SimonSapin
Copy link
Contributor

tidy error: /checkout/src/libcore/num/mod.rs:3598: trailing whitespace

@canndrew canndrew force-pushed the replace-infallible-with-never branch from edb2fdb to 15bab45 Compare March 16, 2018 15:38
@canndrew
Copy link
Contributor Author

Oops, thanks for pointing that out.

@SimonSapin
Copy link
Contributor

[01:27:14] ---- [rustdoc] rustdoc/synthetic_auto/no-redundancy.rs stdout ----
[01:27:14] 	
[01:27:14] error: htmldocck failed!
[01:27:14] status: exit code: 1
[01:27:14] command: "/usr/bin/python2.7" "/checkout/src/etc/htmldocck.py" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/rustdoc/synthetic_auto/no-redundancy.stage2-x86_64-unknown-linux-gnu" "/checkout/src/test/rustdoc/synthetic_auto/no-redundancy.rs"
[01:27:14] stdout:
[01:27:14] ------------------------------------------
[01:27:14] 
[01:27:14] ------------------------------------------
[01:27:14] stderr:
[01:27:14] ------------------------------------------
[01:27:14] 22: @has check failed
[01:27:14] thread 'main' panicked at 'Some tests failed', tools/compiletest/src/main.rs:478:22
[01:27:14] 	`XPATH PATTERN` did not match
[01:27:14] 	// @has - '//*[@id="synthetic-implementations-list"]/*[@class="impl"]/*/code' "impl<T> Send for Outer<T> where T: Copy + Send"
[01:27:14] 
[01:27:14] Encountered 1 errors
[01:27:14] 
[01:27:14] ------------------------------------------
[01:27:14] 
[01:27:14] thread '[rustdoc] rustdoc/synthetic_auto/no-redundancy.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:2903:9
[01:27:14] 
[01:27:14] 
[01:27:14] failures:
[01:27:14]     [rustdoc] rustdoc/synthetic_auto/no-redundancy.rs

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 src/test/rustdoc/synthetic_auto/no-redundancy.rs.

Something like ./x.py test src/test/rustdoc --test-args no-redundancy should run just this test.

@SimonSapin
Copy link
Contributor

I’ve filed #49123 for that rustdoc test failure.

@SimonSapin
Copy link
Contributor

#49058 disabled that failing test.

@bors: r+

@bors
Copy link
Contributor

bors commented Mar 21, 2018

📌 Commit 15bab45 has been approved by SimonSapin

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 21, 2018
kennytm added a commit to kennytm/rust that referenced this pull request Mar 22, 2018
…ver, r=SimonSapin

replace `convert::Infallible` with `!`
bors added a commit that referenced this pull request Mar 22, 2018
@alexcrichton alexcrichton merged commit 15bab45 into rust-lang:master Mar 22, 2018
@F001
Copy link
Contributor

F001 commented Mar 29, 2018

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 ! type ?
The type pub enum ParseError {} has been stabilized. Is it a breaking change if we replace it by ! ?

@SimonSapin
Copy link
Contributor

This is being discussed at #49039

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants