# Include the type of Err variant when there's a type error in a Result

**URL:** <https://internals.rust-lang.org/t/include-the-type-of-err-variant-when-theres-a-type-error-in-a-result/15027>\
**Category:** compiler\
**Created:** [July 15, 2021, 12:28am UTC](https://internals.rust-lang.org/t/include-the-type-of-err-variant-when-theres-a-type-error-in-a-result/15027 "2021-07-15T00:28:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jfhbrook](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/jfhbrook/32/8365_2.png) [@jfhbrook](https://internals.rust-lang.org/u/jfhbrook)\
**Post date:** [July 15, 2021, 12:28am UTC](https://internals.rust-lang.org/t/include-the-type-of-err-variant-when-theres-a-type-error-in-a-result/15027/1 "2021-07-15T00:28:36Z")

</div>

A couple of weeks ago I was playing with rust and I ran into a type error where I had a mismatch between the Err type in a Result and the compiler wasn't being very forthcoming in what the expected type was. I mentioned this off-hand on Twitter while live-tweeting my experience writing my first non-trivial rust project (successful, 4/5 stars) and someone suggested that I file a feature request:

> <https://twitter.com/ekuber/status/1406330111549267970>

It seems like this is less of a bug and more of a known gap in what the rust compiler is capable of reporting on due to some specifics of how Results are implemented, so when I was on GitHub I clicked "Feature Request" instead of "Bug Report", but I don't actually know what would be more useful. Either way, I appreciated the idea that osmeone might actually look into this, and while I don't understand the issue well enough to explain it all that well I'm going to do my best to get it on paper and in a ticketing system anyway.

I don't really have the time or knowledge to engage with this further, but I hope this was helpful.

---

<div class="post-metadata">

**Author:** ![scottmcm](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/scottmcm/32/2355_2.png) [@scottmcm](https://internals.rust-lang.org/u/scottmcm)\
**Post date:** [July 15, 2021, 5:55am UTC](https://internals.rust-lang.org/t/include-the-type-of-err-variant-when-theres-a-type-error-in-a-result/15027/2 "2021-07-15T05:55:31Z")

</div>

Is it the one in here?

> <https://twitter.com/jfhbrook/status/1404607724185427968>
>
> Korben the Budgie @korbenisabird

I think the error type you have there is `egg_mode::error::Error`? It shows in the `From<...>` part, though that's not necessarily obvious.

There's another issue in a related area recently: [Confusing compiler error when returning a `Result\<Result\>` via `?`-operator · Issue #86547 · rust-lang/rust · GitHub](https://github.com/rust-lang/rust/issues/86547)

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/system/32/14092_2.png) [@system](https://internals.rust-lang.org/u/system)\
**Post date:** [October 13, 2021, 5:55am UTC](https://internals.rust-lang.org/t/include-the-type-of-err-variant-when-theres-a-type-error-in-a-result/15027/3 "2021-10-13T05:55:43Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
