chalk icon indicating copy to clipboard operation
chalk copied to clipboard

Split fallible infallible folding

Open eggyal opened this issue 2 years ago • 0 comments

For folding operations that cannot fail, the existing fallible folding trait is a little unergonomic. This PR introduces an infallible folder trait that can be used as a more ergonomic alternative in such cases, reflecting the status quo in rustc.

Infallible folders must however also implement the fallible trait (it's a supertrait of the infallible one), but such implementation should merely delegate to the infallible trait. Coherence rules unfortunately do not permit this to be provided by blanket implementation, however delegating implementations can be simply derived on infallible folders via the chalk_derive::FallibleTypeFolder macro.

r? @jackh726

eggyal avatar Jun 22 '22 09:06 eggyal