GitoxideLabs/gitoxide · info

this impl is needed to allow passing a known valid partial…

Error message

this impl is needed to allow passing a known valid partial path as parameter

What it means

Identical pattern to the general-store variant: a `From<Infallible>` impl on the packed-ref find error enum in `gix-ref` whose body is `unreachable!()`. It allows infallibly-convertible types (e.g. `&str`) to be passed where a `TryInto<&PartialNameRef>` is expected, satisfying the `Error: From<E>` bound. It can never actually be invoked because `Infallible` has no values.

Solutions

  1. Do nothing; this error can never be produced at runtime.
  2. If this panic is ever observed, it is a compiler-level impossibility indicating a serious bug — report it to the gitoxide project.
Defensive patterns

Strategy: validation

Prevention

When it happens

Trigger: Never triggered at runtime. Reaching it would require constructing an `Infallible` value, which the type system forbids.

Common situations: Seen when reading gix-ref packed-ref lookup code or when explaining why a generic call site with an infallible conversion compiles.

Understand the failure class

Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.

Related errors


AI-assisted analysis of GitoxideLabs/gitoxide@e73179060b (2026-09-08). Data as JSON: /api/errors/96797e843b78cf76. Report an issue: GitHub.

Appendix: source

Thrown at gix-ref/src/store/packed/find.rs:115

    }
}

mod error {
    use std::convert::Infallible;

    /// The error returned by [`find()`][super::packed::Buffer::find()]
    #[derive(Debug, thiserror::Error)]
    #[expect(missing_docs)]
    pub enum Error {
        #[error("The ref name or path is not a valid ref name")]
        RefnameValidation(#[from] crate::name::Error),
        #[error("The reference could not be parsed")]
        Parse,
    }

    impl From<Infallible> for Error {
        fn from(_: Infallible) -> Self {
            unreachable!("this impl is needed to allow passing a known valid partial path as parameter")
        }
    }
}
pub use error::Error;

///
pub mod existing {

    /// The error returned by [`find_existing()`][super::packed::Buffer::find()]
    #[derive(Debug, thiserror::Error)]
    #[expect(missing_docs)]
    pub enum Error {
        #[error("The find operation failed")]
        Find(#[from] super::Error),
        #[error("The reference did not exist even though that was expected")]
        NotFound,
    }
}

View on GitHub (pinned to e73179060b)