Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upBox::new(!) doesn't coerce to `Box<Error>` successfully #49593
Comments
alexcrichton
added
T-lang
T-libs
regression-from-stable-to-beta
labels
Apr 2, 2018
alexcrichton
added this to the 1.26 milestone
Apr 2, 2018
alexcrichton
referenced this issue
Apr 2, 2018
Closed
Replace uninhabited error enums in std with never #49039
This comment has been minimized.
This comment has been minimized.
|
@nikomatsakis, @dtolnay and I discussed this at the Rust all hands, and our preliminary opinion was that we should roll back the stabilization of As far as the error itself, this is happening because inference works backwards from the return type to assume that use std::error::Error;
fn foo(x: !) -> Box<Error> {
Box::new(x)
}
We discussed the possibility of disabling inference where it would produce unsized argument types, but this would interact poorly with future changes to remove the |
This comment has been minimized.
This comment has been minimized.
|
Is it possible to make the I really hope we can find a solution similar to this, in time for 1.26 |
This comment has been minimized.
This comment has been minimized.
|
I talked to @nikomatsakis as well and looking at the example again it's plausible we could try unsizing coercion before the |
nikomatsakis
added
T-compiler
I-nominated
labels
Apr 4, 2018
This was referenced Apr 4, 2018
This comment has been minimized.
This comment has been minimized.
|
I opened #49691 to track specifically the rollback part. |
nikomatsakis
removed
the
regression-from-stable-to-beta
label
Apr 5, 2018
This comment has been minimized.
This comment has been minimized.
|
I'm removing the regression tag since this is not a regression, and we have #49691 to track that part. This issue should be added to the various spreadsheets tracking Rust 2018 progress though. |
This comment has been minimized.
This comment has been minimized.
|
Starting at #35121 (comment) is some discussion of |
This comment has been minimized.
This comment has been minimized.
|
Is keeping things as-is and introducing the coercion properly later on gonna cause some sort of pain or backcompat issues? |
nikomatsakis
removed
the
I-nominated
label
Apr 12, 2018
This comment has been minimized.
This comment has been minimized.
|
Removing from milestone now that ! is destabilized |
alexcrichton
removed this from the 1.26 milestone
Apr 24, 2018
XAMPPRocky
added
the
C-enhancement
label
Jun 29, 2018
This comment has been minimized.
This comment has been minimized.
|
I am wondering if there is an explanation somewhere as to why functions that take Similarly for any branches that involve creation or matching of never values, I suppose... |
This comment has been minimized.
This comment has been minimized.
|
At the codegen (LLVM backend) level, the "presence" of an uninhabited value makes the code unreachable and I assume that no code is generated. But in my opinion it’s much less obvious that we should skip type-checking. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
mxmerz
commented
Nov 20, 2018
|
Has there been any progress on this issue in the last months? |
arielb1
added a commit
to arielb1/rust
that referenced
this issue
Nov 25, 2018
arielb1
referenced this issue
Nov 25, 2018
Merged
trigger unsized coercions keyed on Sized bounds #56219
arielb1
added a commit
to arielb1/rust
that referenced
this issue
Nov 25, 2018
arielb1
added a commit
to arielb1/rust
that referenced
this issue
Nov 25, 2018
arielb1
added a commit
to arielb1/rust
that referenced
this issue
Dec 15, 2018
arielb1
added a commit
to arielb1/rust
that referenced
this issue
Dec 16, 2018
bors
added a commit
that referenced
this issue
Dec 19, 2018
bors
added a commit
that referenced
this issue
Dec 19, 2018
bors
added a commit
that referenced
this issue
Dec 20, 2018
bors
closed this
in
#56219
Dec 20, 2018
This comment has been minimized.
This comment has been minimized.
|
Does this mean |
This comment has been minimized.
This comment has been minimized.
|
Confirmed that the code below now compiles on #![feature(never_type)]
pub fn foo(x: !) -> Box<std::error::Error> {
Box::new(x)
} |
alexcrichton commentedApr 2, 2018
Discovered in #49039 the recent stabilization of
!unfortunately has some hazards related to coercion on the libs side of things. We discussed this at the work week and decided that we can't land PRs like #49039 which would also mean that the libs team wouldn't be able to actually recommend using!as an error type (bummer!)This is intended to be a tracking issue for sorting this out. I'm tagging it as a regression to mainly keep track of it, but it's not strictly speaking a regression.
cc @rust-lang/libs
cc @rust-lang/lang