about summary refs log tree commit diff
path: root/compiler/rustc_data_structures/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-08-25 03:30:23 +0000
committerbors <bors@rust-lang.org>2023-08-25 03:30:23 +0000
commitc9228aeaba61f57d425593f4cbbc26e4a6750a9d (patch)
tree38ee55c4d07de28ea5fe9b93f67f90340f46e349 /compiler/rustc_data_structures/src
parentc75b6bdb3751630f73d4d241338d2570a83dc3bd (diff)
parenteee76d955502b65d243551a4904aa2db531bba78 (diff)
downloadrust-c9228aeaba61f57d425593f4cbbc26e4a6750a9d.tar.gz
rust-c9228aeaba61f57d425593f4cbbc26e4a6750a9d.zip
Auto merge of #115193 - weihanglo:rollup-6s3mz06, r=weihanglo
Rollup of 9 pull requests

Successful merges:

 - #114987 (elaborate a bit on the (lack of) safety in 'Mmap::map')
 - #115084 (Add smir `predicates_of`)
 - #115117 (Detect and report nix shell)
 - #115124 (kmc-solid: Import `std::sync::PoisonError` in `std::sys::solid::os`)
 - #115152 (refactor(lint): translate `RenamedOrRemovedLint`)
 - #115154 (Move some ui tests to subdirectories)
 - #115167 (Fix ub-int-array test for big-endian platforms)
 - #115172 (Add more tests for if_let_guard)
 - #115177 (Add symbols for Clippy usage)

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_data_structures/src')
-rw-r--r--compiler/rustc_data_structures/src/memmap.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/compiler/rustc_data_structures/src/memmap.rs b/compiler/rustc_data_structures/src/memmap.rs
index ca908671ae5..30403a61442 100644
--- a/compiler/rustc_data_structures/src/memmap.rs
+++ b/compiler/rustc_data_structures/src/memmap.rs
@@ -11,9 +11,14 @@ pub struct Mmap(Vec<u8>);
 
 #[cfg(not(target_arch = "wasm32"))]
 impl Mmap {
+    /// # Safety
+    ///
+    /// The given file must not be mutated (i.e., not written, not truncated, ...) until the mapping is closed.
+    ///
+    /// However in practice most callers do not ensure this, so uses of this function are likely unsound.
     #[inline]
     pub unsafe fn map(file: File) -> io::Result<Self> {
-        // Safety: this is in fact not safe.
+        // Safety: the caller must ensure that this is safe.
         unsafe { memmap2::Mmap::map(&file).map(Mmap) }
     }
 }