Showing the changes to git-commitgraph/src (2 of 2 files). Show all
Unified · Split
| @@ -1,6 +1,6 @@ | |||
| 1 | use crate::{ | 1 | use crate::{ |
| 2 | file::{self, commit}, | 2 | file::{self, commit}, |
| 3 | graph, Graph, ImpossibleVariantError, GENERATION_NUMBER_MAX, | 3 | graph, Graph, GENERATION_NUMBER_MAX, |
| 4 | }; | 4 | }; |
| 5 | use git_object::owned; | 5 | use git_object::owned; |
| 6 | use std::cmp::{max, min}; | 6 | use std::cmp::{max, min}; |
| @@ -27,8 +27,7 @@ pub enum Error<E: std::error::Error + 'static> { · 20 unmodified lines | |||
| 27 | // `graph::verify::Error::File(file::verify::Error::Processor(...))`, because we are the | 27 | // `graph::verify::Error::File(file::verify::Error::Processor(...))`, because we are the |
| 28 | // file's processor, and we convert`file::verify::Error::Processor<graph::verify::Error>` | 28 | // file's processor, and we convert`file::verify::Error::Processor<graph::verify::Error>` |
| 29 | // variants into direct `graph::verify::Error` values. | 29 | // variants into direct `graph::verify::Error` values. |
| 30 | // TODO: Use never type when it becomes available. | 30 | err: file::verify::Error<std::convert::Infallible>, |
| 31 | err: file::verify::Error<ImpossibleVariantError>, | ||
| 32 | path: PathBuf, | 31 | path: PathBuf, |
| 33 | }, | 32 | }, |
| 34 | #[error("Commit {id}'s generation should be {expected} but is {actual}")] | 33 | #[error("Commit {id}'s generation should be {expected} but is {actual}")] |
| @@ -11,15 +11,3 @@ pub const GENERATION_NUMBER_MAX: u32 = 0x3fff_ffff; · 10 unmodified lines | |||
| 11 | 11 | ||
| 12 | /// The maximum number of commits that can be stored in a commit graph. | 12 | /// The maximum number of commits that can be stored in a commit graph. |
| 13 | pub const MAX_COMMITS: u32 = (1 << 30) + (1 << 29) + (1 << 28) - 1; | 13 | pub const MAX_COMMITS: u32 = (1 << 30) + (1 << 29) + (1 << 28) - 1; |
| 14 | |||
| 15 | // TODO: pub type ImpossibleVariantError = !; | ||
| 16 | #[derive(Debug)] | ||
| 17 | pub struct ImpossibleVariantError; | ||
| 18 | |||
| 19 | impl std::error::Error for ImpossibleVariantError {} | ||
| 20 | |||
| 21 | impl std::fmt::Display for ImpossibleVariantError { | ||
| 22 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
| 23 | f.write_str("this enum was constructed with an invalid variant") | ||
| 24 | } | ||
| 25 | } | ||