Closed
Description
The following code:
use std::convert::{TryFrom, Infallible};
struct E;
impl From<Infallible> for E {
fn from(_: Infallible) -> E {
E
}
}
fn foo() -> Result<(), E> {
u32::try_from(1u32)?;
Ok(())
}
compiles on stable but fails to compile on nightly with:
error[E0277]: `?` couldn't convert the error to `E`
--> src/lib.rs:13:24
|
13 | u32::try_from(1u32)?;
| ^ the trait `std::convert::From<()>` is not implemented for `E`
|
= note: the question mark operation (`?`) implicitly performs a conversion on the error value using the `From` trait
= help: the following implementations were found:
<E as std::convert::From<!>>
= note: required by `std::convert::From::from`
This was discovered through bytecodealliance/wasmtime#633
Metadata
Metadata
Assignees
Labels
High priorityRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the language team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.Performance or correctness regression from stable to nightly.