Page MenuHomePhabricator

rhg: propogate error coming from HgError::Abort to CommandError
ClosedPublic

Authored by pulkit on Jun 7 2021, 8:00 AM.

Diff Detail

Repository
rHG Mercurial
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

pulkit created this revision.Jun 7 2021, 8:00 AM
SimonSapin added inline comments.
rust/rhg/src/error.rs
134–135

I believe this case is unnecessary since it is already handled in impl From<HgError> for CommandError

137

This change looks like a bug. Previously this line was calling into HgError::into which calls impl From<HgError> for CommandError, but now this it calls ConfigError::into such that impl From<ConfigError> for CommandError ends up recursively calling itself until the stack overflows.

The standard library defines this blanket impl to connect the From and Into traits:

impl<T, U> Into<U> for T
where
    U: From<T>,
{
    fn into(self) -> U {
        U::from(self)
    }
}
pulkit updated this revision to Diff 28512.Jun 9 2021, 3:49 AM
Alphare accepted this revision.Jun 9 2021, 5:22 AM
This revision is now accepted and ready to land.Jun 9 2021, 5:22 AM
baymax updated this revision to Diff 28538.Jun 9 2021, 1:22 PM

✅ refresh by Heptapod after a successful CI run (🐙 💚)