Rust incorrectly infers the generic type if used with failure::ResultExt and the try macro. #55928
Labels
A-inference
Area: Type inference
A-traits
Area: Trait system
C-bug
Category: This is a bug.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
When trying to compile the following code, the compiler will incorrectly infer the type as
()
.It shouldn't happen, since the returned type is
Result<U, _>
andcontext
doesn't change the generic value type inResult.
The dependencies in
Cargo.toml
:This happens on both Rust 1.30.1 and 1.32.0-nightly (65204a9 2018-11-12)
It is clearly a compiler bug: if both
()
andString
are correct types, then the type inference should fail.The text was updated successfully, but these errors were encountered: