about summary refs log tree commit diff
path: root/compiler/rustc_interface/src
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2023-11-20 13:12:07 +1100
committerNicholas Nethercote <n.nethercote@gmail.com>2023-11-22 13:20:56 +1100
commitcf561904dbf4c2d8be6547b827af3a7387212580 (patch)
tree08936ef33d2e29d229d777b4cabd04132f57a4f6 /compiler/rustc_interface/src
parentfec80b4475c871ad3e4d70d29d1781ee771fe631 (diff)
downloadrust-cf561904dbf4c2d8be6547b827af3a7387212580.tar.gz
rust-cf561904dbf4c2d8be6547b827af3a7387212580.zip
Add comments about a timer.
Diffstat (limited to 'compiler/rustc_interface/src')
-rw-r--r--compiler/rustc_interface/src/queries.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/compiler/rustc_interface/src/queries.rs b/compiler/rustc_interface/src/queries.rs
index 3fee2d28981..416ffeba4c7 100644
--- a/compiler/rustc_interface/src/queries.rs
+++ b/compiler/rustc_interface/src/queries.rs
@@ -304,6 +304,7 @@ impl Compiler {
     where
         F: for<'tcx> FnOnce(&'tcx Queries<'tcx>) -> T,
     {
+        // Must declare `_timer` first so that it is dropped after `queries`.
         let mut _timer = None;
         let queries = Queries::new(self);
         let ret = f(&queries);
@@ -324,6 +325,8 @@ impl Compiler {
                 .time("serialize_dep_graph", || gcx.enter(rustc_incremental::save_dep_graph));
         }
 
+        // The timer's lifetime spans the dropping of `queries`, which contains
+        // the global context.
         _timer = Some(self.session().timer("free_global_ctxt"));
 
         ret