diff rust/hg-core/src/repo.rs @ 48005:d1d9510f73f0

rust: Update the memmap2 crate to version 0.4.0 This version: * Optionally implements the `StableDeref` trait, removing the need for a wrapper type doing that * Adds support for mapping empty files, which can routinely happen for dirstate-v2 data files. This was a cause of some failing tests when running with `run-tests.py --rhg --extra-config-opt rhg.status=1` Differential Revision: https://phab.mercurial-scm.org/D11446
author Simon Sapin <simon.sapin@octobus.net>
date Fri, 17 Sep 2021 08:57:12 +0200
parents 87e3f878e65f
children 3d0a9c6e614d
line wrap: on
line diff
--- a/rust/hg-core/src/repo.rs	Thu Sep 16 16:42:16 2021 -0700
+++ b/rust/hg-core/src/repo.rs	Fri Sep 17 08:57:12 2021 +0200
@@ -290,7 +290,7 @@
                 .mmap_open(docket.data_filename())
                 .io_not_found_as_none()?
             {
-                OwningDirstateMap::new_empty(MmapWrapper(data_mmap))
+                OwningDirstateMap::new_empty(data_mmap)
             } else {
                 OwningDirstateMap::new_empty(Vec::new())
             };
@@ -407,16 +407,3 @@
         Ok(RefMut::map(borrowed, |option| option.as_mut().unwrap()))
     }
 }
-
-// TODO: remove this when https://github.com/RazrFalcon/memmap2-rs/pull/22 is on crates.io
-struct MmapWrapper(memmap2::Mmap);
-
-impl std::ops::Deref for MmapWrapper {
-    type Target = [u8];
-
-    fn deref(&self) -> &[u8] {
-        self.0.deref()
-    }
-}
-
-unsafe impl stable_deref_trait::StableDeref for MmapWrapper {}