Uh oh!
There was an error while loading. Please reload this page.
Replace uninhabited error enums in std with never - #49039
Conversation
alexcrichton
commented
Mar 15, 2018
@bors: try @rust-lang/infra, mind doing a crater run on this? |
bors
commented
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
bors
commented
Mar 15, 2018
☀️ Test successful - status-travis |
kennytm
commented
Mar 15, 2018
I've inserted it above the two other pending PRs due to the claimed urgency. Still, we'll likely need to wait 9 to 10 days (March 25th) to get a crater result (5 days for the current two to finish, and 5 more days for running this), which is dangerously close to the beta promotion date (March 28th). If this is really urgent we could postpone #48814 (that started just 4 hours ago) and run this immediately. (cc @aidanhs) But since you are changing the stable type |
scottmcm
commented
Mar 15, 2018
@kennytm The thing that I think is I'm fairly confident in this change, so I hope that Mar25 will be fine. |
aidanhs
commented
Mar 20, 2018
Crater run started |
scottmcm
commented
Mar 26, 2018
Any news from crater, @aidanhs? It's now been 6 days. |
aidanhs
commented
Mar 26, 2018
Apologies, I've been pretty busy over the past week. A quick scan of the results shows at least one legit failure (prom-attire) Hi @alexcrichton (crater requester/PR reviewer)! Crater results are at: http://cargobomb-reports.s3.amazonaws.com/pr-49039/index.html. 'Blacklisted' crates (spurious failures etc) can be found here. If you see any spurious failures not on the list, please make a PR against that file. (interested observers: Crater is a tool for testing the impact of changes on the crates.io ecosystem. You can find out more at the repo if you're curious) |
kennytm
commented
Mar 26, 2018
Two minor legit regressions involving custom xkpwgen-0.6.1 (unreachable code in `#[derive(StructOpt)]`)prom-attire-0.1.0 |
alexcrichton
commented
Mar 26, 2018
@scottmcm mind looking into those errors to see what's going on? |
Luckily I only found two, and one of them isn't in beta yet, so can disappear completely :)
scottmcm
commented
Mar 27, 2018
The |
The pubfndemo(x: !) -> Box<std::error::Error>{Box::new(x)}error[E0277]: the trait bound `std::error::Error: std::marker::Sized` is not satisfied
--> src/lib.rs:4:5
|
4 | Box::new(x)
| ^^^^^^^^ `std::error::Error` does not have a constant size known at compile-time
|
= help: the trait `std::marker::Sized` is not implemented for `std::error::Error`
= note: required by `<std::boxed::Box<T>>::new`
Apparently this is just another "coercions and inference hate each other" 😞 Edit 2: FYI @Nemo157: regardless of whether this PR lands, you may still want to update the proc-macro to handle user types with |
eddyb
commented
Mar 27, 2018
@scottmcm I think that's just because |
| #[stable(feature = "str_parse_error", since = "1.5.0")] | ||
| #[derive(Copy)] | ||
| pub enum ParseError {} | ||
| pub type ParseError = !; |
There was a problem hiding this comment.
You can't do this because people can impl it. You should (almost) never change stablenominal types.
There was a problem hiding this comment.
While there's no problem with impl MyTrait for ParseError (you can impl through type aliases and there are no stable impls for !), @eddyb pointed out on IRC that impl MyTrait for fn()->! and impl MyTrait for fn()->ParseError are allowed on stable, so this may not be allowed even though the break found by crater is allowed inference/coercion changes (it's possible to write in a way that works before&after by specifying the type explicitly).
There was a problem hiding this comment.
I was informed on IRC that this could be fine because it's the only such type and you can't impl trait for ! on stable, but that's not enough, e.g.:
traitTrait{}implTraitforfn() -> ! {}implTraitforfn() -> ParseError{}TeXitoi
commented
Mar 27, 2018
Reproduction for the structopt case: #![deny(warnings)]fnfoo() -> Result<(), !>{Ok(())}fnmain(){let bar = foo().map_err(|e| e.to_string());println!("{:?}", bar);} |
Ok, I can see at least four options here:
Thoughts, libs folks? |
SimonSapin
commented
Mar 27, 2018
This compiles: #[allow(unreachable_code)]pubfndemo(x: !) -> Box<std::error::Error>{Box::new(x)as_}So I don’t think that |
SimonSapin
commented
Mar 27, 2018
But then if you actually have that precise signature (rather than something more generic) you can take advantage of the unreachability / universal coercion: pubfndemo(x: !) -> Box<std::error::Error>{
x
} |
scottmcm
commented
Mar 28, 2018
That's an elegant fix, @SimonSapin. The code in the case is macro-generated, like Any thoughts on whether we should take this, #49404, or something else? I think if we're going to do something, it needs to be soon because of things stabilizing in 1.26... |
SimonSapin
commented
Mar 28, 2018
Oh I didn’t consider the macro-generated case. Does the explicit conversion to DST with I’ll bring this up with libs team member today. |
scottmcm
commented
Mar 30, 2018
Any news, @SimonSapin? (Sorry for pinging again, but with where we are in the 1.26 timeline...) |
SimonSapin
commented
Mar 30, 2018
Libs has a dedicated time slot at the Berlin All Hands in ~4 hours. I moved this to near the top of the agenda. My personal opinion is that:
|
Nemo157
commented
Mar 30, 2018
I can confirm |
SimonSapin
commented
Apr 1, 2018
The libs team discussed this and while a work-around is possible for this specific The ideal outcome would be to tweak the language’s coercion rules so that |
alexcrichton
commented
Apr 2, 2018
I've opened a tracking issue for this at #49593 |
I've beta-nominated this in case we can fix the coercion rule easily and decided to keep Also marking as blocked by #49593. |
bors
commented
Apr 13, 2018
☔ The latest upstream changes (presumably #49669) made this pull request unmergeable. Please resolve the merge conflicts. |
alexcrichton
commented
Apr 21, 2018
Given that ! stabilization is being reverted, I'm going to close this for now |
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::LeafOrInternalorstr::pattern::RejectAndMatch.)The unstable
convert::Infallibleis being handled by #49038cc #48950 (comment)
r? @alexcrichton