This is an archive of the discontinued Mercurial Phabricator instance.

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
Branch
default
Lint
No Linters Available
Unit
No Unit Test Coverage

Event Timeline

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

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

134

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 (🐙 💚)