about summary refs log tree commit diff
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2023-11-30 11:58:13 +1100
committerNicholas Nethercote <n.nethercote@gmail.com>2023-12-01 08:00:56 +1100
commit275b793c33ef16d873a056cbdb1100ce3f87f7ad (patch)
treeffe867a1750d79e223194b05d37ceb1e747a1706
parente065d96b08c8437f496ee68697fe77e1a4db56a8 (diff)
downloadrust-275b793c33ef16d873a056cbdb1100ce3f87f7ad.tar.gz
rust-275b793c33ef16d873a056cbdb1100ce3f87f7ad.zip
Clarify the `lockfile` field in `IncrCompSession`.
-rw-r--r--compiler/rustc_session/src/session.rs9
1 files changed, 6 insertions, 3 deletions
diff --git a/compiler/rustc_session/src/session.rs b/compiler/rustc_session/src/session.rs
index 35572378de6..bd32180da44 100644
--- a/compiler/rustc_session/src/session.rs
+++ b/compiler/rustc_session/src/session.rs
@@ -822,7 +822,8 @@ impl Session {
             panic!("Trying to initialize IncrCompSession `{:?}`", *incr_comp_session)
         }
 
-        *incr_comp_session = IncrCompSession::Active { session_directory: session_dir, lock_file };
+        *incr_comp_session =
+            IncrCompSession::Active { session_directory: session_dir, _lock_file: lock_file };
     }
 
     pub fn finalize_incr_comp_session(&self, new_directory_path: PathBuf) {
@@ -1679,8 +1680,10 @@ enum IncrCompSession {
     /// needed.
     NotInitialized,
     /// This is the state during which the session directory is private and can
-    /// be modified.
-    Active { session_directory: PathBuf, lock_file: flock::Lock },
+    /// be modified. `_lock_file` is never directly used, but its presence
+    /// alone has an effect, because the file will unlock when the session is
+    /// dropped.
+    Active { session_directory: PathBuf, _lock_file: flock::Lock },
     /// This is the state after the session directory has been finalized. In this
     /// state, the contents of the directory must not be modified any more.
     Finalized { session_directory: PathBuf },