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

Projects
None yet
8 participants
@canndrew
Copy link
Contributor

canndrew commented Mar 15, 2018

No description provided.

@rust-highfive

This comment has been minimized.

Copy link
Collaborator

rust-highfive commented Mar 15, 2018

r? @sfackler

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

@scottmcm
Copy link
Member

scottmcm left a comment

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 {

This comment has been minimized.

@scottmcm

scottmcm Mar 15, 2018

Member

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

This comment has been minimized.

@canndrew

canndrew Mar 15, 2018

Contributor

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 {}

This comment has been minimized.

@scottmcm

scottmcm Mar 15, 2018

Member

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

This comment has been minimized.

@canndrew

canndrew Mar 15, 2018

Contributor

They're implemented. No idea why they're not showing up in rustdoc.

This comment has been minimized.

@scottmcm

scottmcm Mar 15, 2018

Member

Ah, looks like this is a nearing-three-year-old bug with primitives: #25893

@canndrew

This comment has been minimized.

Copy link
Contributor

canndrew commented Mar 15, 2018

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

Auto merge of #49039 - scottmcm:never-aliases, r=<try>
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

This comment has been minimized.

Copy link
Contributor

SimonSapin commented Mar 16, 2018

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

@canndrew canndrew force-pushed the canndrew:replace-infallible-with-never branch from edb2fdb to 15bab45 Mar 16, 2018

@canndrew

This comment has been minimized.

Copy link
Contributor

canndrew commented Mar 16, 2018

Oops, thanks for pointing that out.

@SimonSapin

This comment has been minimized.

Copy link
Contributor

SimonSapin commented Mar 17, 2018

[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

This comment has been minimized.

Copy link
Contributor

SimonSapin commented Mar 17, 2018

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

@SimonSapin

This comment has been minimized.

Copy link
Contributor

SimonSapin commented Mar 21, 2018

#49058 disabled that failing test.

@bors: r+

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Mar 21, 2018

📌 Commit 15bab45 has been approved by SimonSapin

kennytm added a commit to kennytm/rust that referenced this pull request Mar 22, 2018

Rollup merge of rust-lang#49038 - canndrew:replace-infallible-with-ne…
…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

1 check failed

continuous-integration/travis-ci/pr The Travis CI build failed
Details
@F001

This comment has been minimized.

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

This comment has been minimized.

Copy link
Contributor

SimonSapin commented Mar 29, 2018

This is being discussed at #49039

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment