Skip to content

Commit 23128c4

Browse files
authored
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.
2 parents 827ad66 + 458d044 commit 23128c4

File tree

7 files changed

+18
-8
lines changed

7 files changed

+18
-8
lines changed

Cargo.lock

+11-2
Original file line numberDiff line numberDiff line change
@@ -2164,6 +2164,15 @@ dependencies = [
21642164
"winapi 0.3.9",
21652165
]
21662166

2167+
[[package]]
2168+
name = "memmap2"
2169+
version = "0.2.1"
2170+
source = "registry+https://github.com/rust-lang/crates.io-index"
2171+
checksum = "04e3e85b970d650e2ae6d70592474087051c11c54da7f7b4949725c5735fbcc6"
2172+
dependencies = [
2173+
"libc",
2174+
]
2175+
21672176
[[package]]
21682177
name = "memoffset"
21692178
version = "0.5.5"
@@ -3782,7 +3791,7 @@ dependencies = [
37823791
"itertools 0.9.0",
37833792
"jobserver",
37843793
"libc",
3785-
"memmap",
3794+
"memmap2",
37863795
"pathdiff",
37873796
"rustc_apfloat",
37883797
"rustc_ast",
@@ -4116,7 +4125,7 @@ name = "rustc_metadata"
41164125
version = "0.0.0"
41174126
dependencies = [
41184127
"libc",
4119-
"memmap",
4128+
"memmap2",
41204129
"rustc_ast",
41214130
"rustc_attr",
41224131
"rustc_data_structures",

compiler/rustc_codegen_ssa/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ test = false
1111
bitflags = "1.2.1"
1212
cc = "1.0.1"
1313
itertools = "0.9"
14-
memmap = "0.7"
14+
memmap2 = "0.2.1"
1515
tracing = "0.1"
1616
libc = "0.2.50"
1717
jobserver = "0.1.11"

compiler/rustc_codegen_ssa/src/back/lto.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ impl<B: WriteBackendMethods> LtoModuleCodegen<B> {
9393
pub enum SerializedModule<M: ModuleBufferMethods> {
9494
Local(M),
9595
FromRlib(Vec<u8>),
96-
FromUncompressedFile(memmap::Mmap),
96+
FromUncompressedFile(memmap2::Mmap),
9797
}
9898

9999
impl<M: ModuleBufferMethods> SerializedModule<M> {

compiler/rustc_codegen_ssa/src/back/write.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1958,7 +1958,7 @@ pub fn submit_pre_lto_module_to_llvm<B: ExtraBackendMethods>(
19581958
.unwrap_or_else(|e| panic!("failed to open bitcode file `{}`: {}", bc_path.display(), e));
19591959

19601960
let mmap = unsafe {
1961-
memmap::Mmap::map(&file).unwrap_or_else(|e| {
1961+
memmap2::Mmap::map(&file).unwrap_or_else(|e| {
19621962
panic!("failed to mmap bitcode file `{}`: {}", bc_path.display(), e)
19631963
})
19641964
};

compiler/rustc_metadata/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ doctest = false
1111
libc = "0.2"
1212
snap = "1"
1313
tracing = "0.1"
14-
memmap = "0.7"
14+
memmap2 = "0.2.1"
1515
smallvec = { version = "1.6.1", features = ["union", "may_dangle"] }
1616
rustc_middle = { path = "../rustc_middle" }
1717
rustc_attr = { path = "../rustc_attr" }

compiler/rustc_metadata/src/locator.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -728,7 +728,7 @@ impl<'a> CrateLocator<'a> {
728728
}
729729

730730
/// A trivial wrapper for `Mmap` that implements `StableDeref`.
731-
struct StableDerefMmap(memmap::Mmap);
731+
struct StableDerefMmap(memmap2::Mmap);
732732

733733
impl Deref for StableDerefMmap {
734734
type Target = [u8];
@@ -779,7 +779,7 @@ fn get_metadata_section(
779779
// mmap the file, because only a small fraction of it is read.
780780
let file = std::fs::File::open(filename)
781781
.map_err(|_| format!("failed to open rmeta metadata: '{}'", filename.display()))?;
782-
let mmap = unsafe { memmap::Mmap::map(&file) };
782+
let mmap = unsafe { memmap2::Mmap::map(&file) };
783783
let mmap = mmap
784784
.map_err(|_| format!("failed to mmap rmeta metadata: '{}'", filename.display()))?;
785785

src/tools/tidy/src/deps.rs

+1
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ const PERMITTED_DEPENDENCIES: &[&str] = &[
123123
"measureme",
124124
"memchr",
125125
"memmap",
126+
"memmap2",
126127
"memoffset",
127128
"miniz_oxide",
128129
"num_cpus",

0 commit comments

Comments
 (0)