about summary refs log tree commit diff
path: root/compiler/rustc_interface/src
diff options
context:
space:
mode:
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