about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDylan DPC <dylan.dpc@gmail.com>2021-03-19 15:03:28 +0100
committerGitHub <noreply@github.com>2021-03-19 15:03:28 +0100
commit23128c41839fda23548da1cb16730de87d703ea6 (patch)
treec1abb2d081f63307c17226baed99b7d3dd081457
parent827ad66801ad83666192bfbda2de538dc87a710c (diff)
parent458d044c5be4d86d39de894f7051bb023e2c2c40 (diff)
downloadrust-23128c41839fda23548da1cb16730de87d703ea6.tar.gz
rust-23128c41839fda23548da1cb16730de87d703ea6.zip
Rollup merge of #83236 - cjgillot:memmap, r=joshtriplett
Upgrade memmap to memmap2

memmap is no longer maintained. memmap2 is a fork that is still maintained. https://rustsec.org/advisories/RUSTSEC-2020-0077.html

The remaining use of memmap is through measureme.
-rw-r--r--Cargo.lock13
-rw-r--r--compiler/rustc_codegen_ssa/Cargo.toml2
-rw-r--r--compiler/rustc_codegen_ssa/src/back/lto.rs2
-rw-r--r--compiler/rustc_codegen_ssa/src/back/write.rs2
-rw-r--r--compiler/rustc_metadata/Cargo.toml2
-rw-r--r--compiler/rustc_metadata/src/locator.rs4
-rw-r--r--src/tools/tidy/src/deps.rs1
7 files changed, 18 insertions, 8 deletions
diff --git a/Cargo.lock b/Cargo.lock
index fd6fffe980b..e5a7b7d9b60 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -2165,6 +2165,15 @@ dependencies = [
 ]
 
 [[package]]
+name = "memmap2"
+version = "0.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "04e3e85b970d650e2ae6d70592474087051c11c54da7f7b4949725c5735fbcc6"
+dependencies = [
+ "libc",
+]
+
+[[package]]
 name = "memoffset"
 version = "0.5.5"
 source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -3782,7 +3791,7 @@ dependencies = [
  "itertools 0.9.0",
  "jobserver",
  "libc",
- "memmap",
+ "memmap2",
  "pathdiff",
  "rustc_apfloat",
  "rustc_ast",
@@ -4116,7 +4125,7 @@ name = "rustc_metadata"
 version = "0.0.0"
 dependencies = [
  "libc",
- "memmap",
+ "memmap2",
  "rustc_ast",
  "rustc_attr",
  "rustc_data_structures",
diff --git a/compiler/rustc_codegen_ssa/Cargo.toml b/compiler/rustc_codegen_ssa/Cargo.toml
index 5e2f01b2c9d..15dbbbd49aa 100644
--- a/compiler/rustc_codegen_ssa/Cargo.toml
+++ b/compiler/rustc_codegen_ssa/Cargo.toml
@@ -11,7 +11,7 @@ test = false
 bitflags = "1.2.1"
 cc = "1.0.1"
 itertools = "0.9"
-memmap = "0.7"
+memmap2 = "0.2.1"
 tracing = "0.1"
 libc = "0.2.50"
 jobserver = "0.1.11"
diff --git a/compiler/rustc_codegen_ssa/src/back/lto.rs b/compiler/rustc_codegen_ssa/src/back/lto.rs
index 0d7f4447696..c6aea22a63e 100644
--- a/compiler/rustc_codegen_ssa/src/back/lto.rs
+++ b/compiler/rustc_codegen_ssa/src/back/lto.rs
@@ -93,7 +93,7 @@ impl<B: WriteBackendMethods> LtoModuleCodegen<B> {
 pub enum SerializedModule<M: ModuleBufferMethods> {
     Local(M),
     FromRlib(Vec<u8>),
-    FromUncompressedFile(memmap::Mmap),
+    FromUncompressedFile(memmap2::Mmap),
 }
 
 impl<M: ModuleBufferMethods> SerializedModule<M> {
diff --git a/compiler/rustc_codegen_ssa/src/back/write.rs b/compiler/rustc_codegen_ssa/src/back/write.rs
index 854aaac757f..490b3d33112 100644
--- a/compiler/rustc_codegen_ssa/src/back/write.rs
+++ b/compiler/rustc_codegen_ssa/src/back/write.rs
@@ -1958,7 +1958,7 @@ pub fn submit_pre_lto_module_to_llvm<B: ExtraBackendMethods>(
         .unwrap_or_else(|e| panic!("failed to open bitcode file `{}`: {}", bc_path.display(), e));
 
     let mmap = unsafe {
-        memmap::Mmap::map(&file).unwrap_or_else(|e| {
+        memmap2::Mmap::map(&file).unwrap_or_else(|e| {
             panic!("failed to mmap bitcode file `{}`: {}", bc_path.display(), e)
         })
     };
diff --git a/compiler/rustc_metadata/Cargo.toml b/compiler/rustc_metadata/Cargo.toml
index 2aabc2c407b..48effed9274 100644
--- a/compiler/rustc_metadata/Cargo.toml
+++ b/compiler/rustc_metadata/Cargo.toml
@@ -11,7 +11,7 @@ doctest = false
 libc = "0.2"
 snap = "1"
 tracing = "0.1"
-memmap = "0.7"
+memmap2 = "0.2.1"
 smallvec = { version = "1.6.1", features = ["union", "may_dangle"] }
 rustc_middle = { path = "../rustc_middle" }
 rustc_attr = { path = "../rustc_attr" }
diff --git a/compiler/rustc_metadata/src/locator.rs b/compiler/rustc_metadata/src/locator.rs
index a9f58b08f58..39a39917f57 100644
--- a/compiler/rustc_metadata/src/locator.rs
+++ b/compiler/rustc_metadata/src/locator.rs
@@ -728,7 +728,7 @@ impl<'a> CrateLocator<'a> {
 }
 
 /// A trivial wrapper for `Mmap` that implements `StableDeref`.
-struct StableDerefMmap(memmap::Mmap);
+struct StableDerefMmap(memmap2::Mmap);
 
 impl Deref for StableDerefMmap {
     type Target = [u8];
@@ -779,7 +779,7 @@ fn get_metadata_section(
             // mmap the file, because only a small fraction of it is read.
             let file = std::fs::File::open(filename)
                 .map_err(|_| format!("failed to open rmeta metadata: '{}'", filename.display()))?;
-            let mmap = unsafe { memmap::Mmap::map(&file) };
+            let mmap = unsafe { memmap2::Mmap::map(&file) };
             let mmap = mmap
                 .map_err(|_| format!("failed to mmap rmeta metadata: '{}'", filename.display()))?;
 
diff --git a/src/tools/tidy/src/deps.rs b/src/tools/tidy/src/deps.rs
index 06dc16f7676..96a02038638 100644
--- a/src/tools/tidy/src/deps.rs
+++ b/src/tools/tidy/src/deps.rs
@@ -123,6 +123,7 @@ const PERMITTED_DEPENDENCIES: &[&str] = &[
     "measureme",
     "memchr",
     "memmap",
+    "memmap2",
     "memoffset",
     "miniz_oxide",
     "num_cpus",