diff options
Diffstat (limited to 'vendor/gix-hashtable')
-rw-r--r-- | vendor/gix-hashtable/.cargo-checksum.json | 2 | ||||
-rw-r--r-- | vendor/gix-hashtable/Cargo.toml | 4 | ||||
-rw-r--r-- | vendor/gix-hashtable/src/lib.rs | 24 |
3 files changed, 27 insertions, 3 deletions
diff --git a/vendor/gix-hashtable/.cargo-checksum.json b/vendor/gix-hashtable/.cargo-checksum.json index 8fdb7129f..3b008af94 100644 --- a/vendor/gix-hashtable/.cargo-checksum.json +++ b/vendor/gix-hashtable/.cargo-checksum.json @@ -1 +1 @@ -{"files":{"Cargo.toml":"9abbc611ecef09f9b709e86303afac73ecbe0af12dc6ff81fabece8454c12207","src/lib.rs":"735d08f7852539e0c50e99220535db407800392c0b61ed05c31181747e7f4dd1"},"package":"9609c1b8f36f12968e6a6098f7cdb52004f7d42d570f47a2d6d7c16612f19acb"}
\ No newline at end of file +{"files":{"Cargo.toml":"df8541193c305150429743f576969deb9563c75ec90f8ddaebf7dd44bada17b8","src/lib.rs":"ad0657cc3bf0458a274b61e4b87fefa0e28866789b536651432075d34d4bf893"},"package":"afebb85691c6a085b114e01a27f4a61364519298c5826cb87a45c304802299bc"}
\ No newline at end of file diff --git a/vendor/gix-hashtable/Cargo.toml b/vendor/gix-hashtable/Cargo.toml index 7ff4013fb..4c168fc6f 100644 --- a/vendor/gix-hashtable/Cargo.toml +++ b/vendor/gix-hashtable/Cargo.toml @@ -13,7 +13,7 @@ edition = "2021" rust-version = "1.64" name = "gix-hashtable" -version = "0.1.2" +version = "0.2.0" authors = ["Pascal Kuthe <pascal.kuthe@semimod.de>"] include = ["src/**/*"] description = "A crate that provides hashtable based data structures optimized to utilize ObjectId keys" @@ -24,7 +24,7 @@ repository = "https://github.com/Byron/gitoxide" doctest = false [dependencies.gix-hash] -version = "^0.10.2" +version = "^0.11.1" [dependencies.hashbrown] version = "0.13.1" diff --git a/vendor/gix-hashtable/src/lib.rs b/vendor/gix-hashtable/src/lib.rs index 6392a9a5c..476600578 100644 --- a/vendor/gix-hashtable/src/lib.rs +++ b/vendor/gix-hashtable/src/lib.rs @@ -40,6 +40,15 @@ pub mod hash { #[derive(Default, Clone, Copy)] pub struct Hasher(u64); + macro_rules! panic_other_writers { + ($func:ident, $type:ty) => { + #[cold] + fn $func(&mut self, _i: $type) { + panic!("This hasher only supports manually verified `Hash` implementations") + } + }; + } + impl std::hash::Hasher for Hasher { fn finish(&self) -> u64 { self.0 @@ -49,6 +58,21 @@ pub mod hash { fn write(&mut self, bytes: &[u8]) { self.0 = u64::from_ne_bytes(bytes[..8].try_into().unwrap()); } + + // Panic if someone tries to use this with a different function, + // only manually verified types should be used with this hasher + panic_other_writers!(write_u8, u8); + panic_other_writers!(write_u16, u16); + panic_other_writers!(write_u32, u32); + panic_other_writers!(write_u64, u64); + panic_other_writers!(write_u128, u128); + panic_other_writers!(write_usize, usize); + panic_other_writers!(write_i8, i8); + panic_other_writers!(write_i16, i16); + panic_other_writers!(write_i32, i32); + panic_other_writers!(write_i64, i64); + panic_other_writers!(write_i128, i128); + panic_other_writers!(write_isize, isize); } /// A Hasher for usage with HashMap keys that are already robust hashes (like an `ObjectId`). |