diff options
| author | Dylan MacKenzie <ecstaticmorse@gmail.com> | 2021-11-29 19:09:01 -0800 |
|---|---|---|
| committer | Dylan MacKenzie <ecstaticmorse@gmail.com> | 2021-12-02 17:12:59 -0800 |
| commit | a0de6346dec84ca663026e44ef102f4d229bfb38 (patch) | |
| tree | ce631b987d04b4c964bf29f113ea8ecbe670c6ea | |
| parent | 386b1c5f5760ae35610598969d16382e67160ff2 (diff) | |
| download | rust-a0de6346dec84ca663026e44ef102f4d229bfb38.tar.gz rust-a0de6346dec84ca663026e44ef102f4d229bfb38.zip | |
Move instrument coverage config getters to `Options`
| -rw-r--r-- | compiler/rustc_session/src/options.rs | 15 | ||||
| -rw-r--r-- | compiler/rustc_session/src/session.rs | 9 |
2 files changed, 18 insertions, 6 deletions
diff --git a/compiler/rustc_session/src/options.rs b/compiler/rustc_session/src/options.rs index 06120160c42..20ef1afaab2 100644 --- a/compiler/rustc_session/src/options.rs +++ b/compiler/rustc_session/src/options.rs @@ -107,6 +107,21 @@ impl Options { .mir_opt_level .unwrap_or_else(|| if self.optimize != OptLevel::No { 2 } else { 1 }) } + + pub fn instrument_coverage(&self) -> bool { + self.debugging_opts.instrument_coverage.unwrap_or(InstrumentCoverage::Off) + != InstrumentCoverage::Off + } + + pub fn instrument_coverage_except_unused_generics(&self) -> bool { + self.debugging_opts.instrument_coverage.unwrap_or(InstrumentCoverage::Off) + == InstrumentCoverage::ExceptUnusedGenerics + } + + pub fn instrument_coverage_except_unused_functions(&self) -> bool { + self.debugging_opts.instrument_coverage.unwrap_or(InstrumentCoverage::Off) + == InstrumentCoverage::ExceptUnusedFunctions + } } top_level_options!( diff --git a/compiler/rustc_session/src/session.rs b/compiler/rustc_session/src/session.rs index 72219bedb61..52a92de842f 100644 --- a/compiler/rustc_session/src/session.rs +++ b/compiler/rustc_session/src/session.rs @@ -1044,18 +1044,15 @@ impl Session { } pub fn instrument_coverage(&self) -> bool { - self.opts.debugging_opts.instrument_coverage.unwrap_or(config::InstrumentCoverage::Off) - != config::InstrumentCoverage::Off + self.opts.instrument_coverage() } pub fn instrument_coverage_except_unused_generics(&self) -> bool { - self.opts.debugging_opts.instrument_coverage.unwrap_or(config::InstrumentCoverage::Off) - == config::InstrumentCoverage::ExceptUnusedGenerics + self.opts.instrument_coverage_except_unused_generics() } pub fn instrument_coverage_except_unused_functions(&self) -> bool { - self.opts.debugging_opts.instrument_coverage.unwrap_or(config::InstrumentCoverage::Off) - == config::InstrumentCoverage::ExceptUnusedFunctions + self.opts.instrument_coverage_except_unused_functions() } pub fn is_proc_macro_attr(&self, attr: &Attribute) -> bool { |
