[Updated] D11446: rust: Update the memmap2 crate to version 0.4.0

SimonSapin phabricator at mercurial-scm.org
Mon Sep 20 09:11:35 UTC 2021


Closed by commit rHGd1d9510f73f0: rust: Update the memmap2 crate to version 0.4.0 (authored by SimonSapin).
This revision was automatically updated to reflect the committed changes.

CHANGED PRIOR TO COMMIT
  https://phab.mercurial-scm.org/D11446?vs=30284&id=30303#toc

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D11446?vs=30284&id=30303

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D11446/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D11446

AFFECTED FILES
  rust/Cargo.lock
  rust/hg-core/Cargo.toml
  rust/hg-core/src/repo.rs

CHANGE DETAILS

diff --git a/rust/hg-core/src/repo.rs b/rust/hg-core/src/repo.rs
--- a/rust/hg-core/src/repo.rs
+++ b/rust/hg-core/src/repo.rs
@@ -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 {}
diff --git a/rust/hg-core/Cargo.toml b/rust/hg-core/Cargo.toml
--- a/rust/hg-core/Cargo.toml
+++ b/rust/hg-core/Cargo.toml
@@ -29,7 +29,7 @@
 crossbeam-channel = "0.4"
 micro-timer = "0.3.0"
 log = "0.4.8"
-memmap2 = "0.3.1"
+memmap2 = {version = "0.4", features = ["stable_deref_trait"]}
 zstd = "0.5.3"
 format-bytes = "0.2.2"
 
diff --git a/rust/Cargo.lock b/rust/Cargo.lock
--- a/rust/Cargo.lock
+++ b/rust/Cargo.lock
@@ -1,5 +1,6 @@
 # This file is automatically @generated by Cargo.
 # It is not intended for manual editing.
+
 [[package]]
 name = "adler"
 version = "0.2.3"
@@ -511,11 +512,12 @@
 
 [[package]]
 name = "memmap2"
-version = "0.3.1"
+version = "0.4.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "00b6c2ebff6180198788f5db08d7ce3bc1d0b617176678831a7510825973e357"
+checksum = "de5d3112c080d58ce560081baeaab7e1e864ca21795ddbf533d5b1842bb1ecf8"
 dependencies = [
  "libc",
+ "stable_deref_trait",
 ]
 
 [[package]]



To: SimonSapin, #hg-reviewers, Alphare
Cc: mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20210920/899c03b6/attachment-0002.html>


More information about the Mercurial-patches mailing list