Add From for int types by clarfonthey · Pull Request #50554 · rust-lang/rust (original) (raw)
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fn try_result_ok() -> Result<u8, u8> { let val = Ok(1)?; Ok(val) }
Ok(x)? for Result<_, u8> (as well as variations like return Err(u8::from(unimplemented!()));) sound like an edge case for me - I don't think realistically anyone would write code like this. This can be written as x, and I think this inference failure is not a practical issue. The test here could be changed to use a type other than u8, for example fn try_result_ok() -> Result<u8, bool>.
Additionally, according to https://github.com/rust-lang/rfcs/blob/master/text/1105-api-evolution.md, this would be a minor change.