Skip to content

Commit b319715

Browse files
committed
Disable the self-profiler unless the -Z self-profile flag is set
Related to #51648
1 parent dae6c93 commit b319715

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/librustc/session/mod.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -826,8 +826,10 @@ impl Session {
826826
}
827827

828828
pub fn profiler<F: FnOnce(&mut SelfProfiler) -> ()>(&self, f: F) {
829-
let mut profiler = self.self_profiling.borrow_mut();
830-
f(&mut profiler);
829+
if self.opts.debugging_opts.self_profile {
830+
let mut profiler = self.self_profiling.borrow_mut();
831+
f(&mut profiler);
832+
}
831833
}
832834

833835
pub fn print_profiler_results(&self) {

0 commit comments

Comments
 (0)