Skip to content

Commit 26d4226

Browse files
committed
Add comments about a timer.
1 parent 290fc68 commit 26d4226

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

compiler/rustc_interface/src/queries.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,7 @@ impl Compiler {
304304
where
305305
F: for<'tcx> FnOnce(&'tcx Queries<'tcx>) -> T,
306306
{
307+
// Must declare `_timer` first so that it is dropped after `queries`.
307308
let mut _timer = None;
308309
let queries = Queries::new(self);
309310
let ret = f(&queries);
@@ -324,6 +325,8 @@ impl Compiler {
324325
.time("serialize_dep_graph", || gcx.enter(rustc_incremental::save_dep_graph));
325326
}
326327

328+
// The timer's lifetime spans the dropping of `queries`, which contains
329+
// the global context.
327330
_timer = Some(self.session().timer("free_global_ctxt"));
328331

329332
ret

0 commit comments

Comments
 (0)