std uses std::convert::Infallible to indicate cases where an error is expected but can't happen; in particular, it auto-implements TryFrom for all From implementations, with the error type marked as std::convert::Infallible. It's currently implemented as an enum with no variants, so it's statically impossible to create an instance of.
In code that is attempting to be generic over TryFrom implementations, then, you may need to end up proving From<Infallible> for YourErrorType. This is trivial to implement — the rust compiler understands that it's impossible to ever be handed an instance of an enum with zero variants — but due to coherence rules, the impl needs to live next to YourErrorType. In this case, that means it needs to live in http-api-problem.
std
usesstd::convert::Infallible
to indicate cases where an error is expected but can't happen; in particular, it auto-implementsTryFrom
for allFrom
implementations, with the error type marked asstd::convert::Infallible
. It's currently implemented as an enum with no variants, so it's statically impossible to create an instance of.In code that is attempting to be generic over
TryFrom
implementations, then, you may need to end up provingFrom<Infallible> for YourErrorType
. This is trivial to implement — the rust compiler understands that it's impossible to ever be handed an instance of an enum with zero variants — but due to coherence rules, the impl needs to live next toYourErrorType
. In this case, that means it needs to live inhttp-api-problem
.Thanks.