Skip to content

Commit 97814dd

Browse files
committed
Check pre-selfprofile if self.prof.enabled() is true
1 parent 6351247 commit 97814dd

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

compiler/rustc_session/src/utils.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,11 @@ impl Session {
99
}
1010
/// Used by `-Z self-profile`.
1111
pub fn time<R>(&self, what: &'static str, f: impl FnOnce() -> R) -> R {
12-
self.prof.verbose_generic_activity(what).run(f)
12+
if self.prof.enabled() {
13+
return self.prof.verbose_generic_activity(what).run(f)
14+
} else {
15+
return f()
16+
}
1317
}
1418
}
1519

0 commit comments

Comments
 (0)