Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/vfs/src/lib.rs')
| -rw-r--r-- | crates/vfs/src/lib.rs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/crates/vfs/src/lib.rs b/crates/vfs/src/lib.rs index 7badb1c363..afc9a0fa6f 100644 --- a/crates/vfs/src/lib.rs +++ b/crates/vfs/src/lib.rs @@ -59,9 +59,16 @@ pub use paths::{AbsPath, AbsPathBuf}; /// Handle to a file in [`Vfs`] /// /// Most functions in rust-analyzer use this when they need to refer to a file. -#[derive(Copy, Clone, Debug, Ord, PartialOrd, Eq, PartialEq, Hash)] +#[derive(Copy, Clone, Debug, Ord, PartialOrd, Eq, PartialEq)] pub struct FileId(pub u32); +impl stdx::hash::NoHashHashable for FileId {} +impl std::hash::Hash for FileId { + fn hash<H: std::hash::Hasher>(&self, state: &mut H) { + self.0.hash(state); + } +} + /// Storage for all files read by rust-analyzer. /// /// For more information see the [crate-level](crate) documentation. |