Open
Description
openedon Mar 17, 2020
The following code:
fn bar() -> Result<(), std::num::ParseIntError> {
let a = "Hello".parse()?;
Ok(())
}
fn main() {}
gives the following error message:
error[E0277]: the trait bound `(): std::str::FromStr` is not satisfied
--> src/main.rs:2:21
|
2 | let a = "Hello".parse()?;
| ^^^^^ the trait `std::str::FromStr` is not implemented for `()`
error: aborting due to previous error
The bound (): std::str::FromStr
appears seemingly out of thin air. We should explain where the type ()
and trait std::str::FromStr
come from.
The ()
appears to be produced by never-type fallback, which was quite surprising to me.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment