{"record":{"id":"0a748742a5b8f7dc","repo":"GitoxideLabs/gitoxide","slug":"this-impl-is-needed-to-allow-passing-a-known-valid-0a7487","errorCode":null,"errorMessage":"this impl is needed to allow passing a known valid partial path as parameter","messagePattern":"this impl is needed to allow passing a known valid partial path as parameter","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"info","filePath":"gix-ref/src/store/general/handle/find.rs","lineNumber":18,"sourceCode":"use crate::{PartialNameRef, Reference, store};\n\nmod error {\n    use std::convert::Infallible;\n\n    /// The error returned by [`crate::file::Store::find_loose()`].\n    #[derive(Debug, thiserror::Error)]\n    #[expect(missing_docs)]\n    pub enum Error {\n        #[error(\"An error occurred while finding a reference in the loose file database\")]\n        Loose(#[from] crate::file::find::Error),\n        #[error(\"The ref name or path is not a valid ref name\")]\n        RefnameValidation(#[from] crate::name::Error),\n    }\n\n    impl From<Infallible> for Error {\n        fn from(_: Infallible) -> Self {\n            unreachable!(\"this impl is needed to allow passing a known valid partial path as parameter\")\n        }\n    }\n}\n\npub use error::Error;\n\nuse crate::store::handle;\n\nimpl store::Handle {\n    /// TODO: actually implement this with handling of the packed buffer.\n    pub fn try_find<'a, Name, E>(&self, partial: Name) -> Result<Option<Reference>, Error>\n    where\n        Name: TryInto<&'a PartialNameRef, Error = E>,\n        Error: From<E>,\n    {\n        let _name = partial.try_into()?;\n        match &self.state {\n            handle::State::Loose { .. } => {","sourceCodeStart":1,"sourceCodeEnd":36,"githubUrl":"https://github.com/GitoxideLabs/gitoxide/blob/e73179060badf27222d790981fac3f84c1830a7e/gix-ref/src/store/general/handle/find.rs#L1-L36","documentation":"This is not a real runtime error: it is a `From<Infallible>` impl on the `gix-ref` general-store find error enum whose body calls `unreachable!()`. It exists only so callers can pass anything convertible to a `&PartialNameRef` (including infallible conversions like `&str`) to `Handle::try_find`. Since `Infallible` can never be instantiated, the panic branch is unreachable by construction.","triggerScenarios":"Never triggered at runtime. The only way to reach it is a library-internal bug that manufactures an `Infallible` value, or directly calling `Error::from(Infallible)` in test code with a `match _ {}` workaround.","commonSituations":"Developers may encounter this line while reading or debugging the ref lookup code, or when a generic caller fails to compile because the `Error: From<E>` bound is not satisfied — the impl exists to satisfy that bound.","solutions":["Do nothing; this error can never be produced at runtime.","If you see this panic, file a bug against gix-ref — it indicates a broken internal invariant.","If your own code fails to compile due to a missing `From` bound, use the same `From<Infallible>` trick for infallible conversions."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":"fn is_real_error(err: &gix_ref::store::handle::find::Error) -> bool { !matches!(err, _ /* Infallible branch is uninhabitable */) }","tryCatchPattern":null,"preventionTips":["Trust the type system: `Infallible` has no values, so this error cannot occur at runtime.","If you see this panic in a crash log, treat it as a library bug and report it upstream."],"tags":["rust","unreachable","type-system","gix-ref"],"backgroundTag":"internal-invariant-violation","analyzedSha":"e73179060badf27222d790981fac3f84c1830a7e","analyzedAt":"2026-09-08T11:26:50.865Z","contentChangedAt":"2026-09-08T11:26:50.865Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}