Skip to content

Commit 51e62a0

Browse files
committed
coverage: Remove -Zcoverage-options=no-mir-spans
This flag turned out to be less useful than anticipated, and interferes with work towards expansion support.
1 parent 16843ce commit 51e62a0

File tree

9 files changed

+5
-226
lines changed

9 files changed

+5
-226
lines changed

compiler/rustc_interface/src/tests.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -778,8 +778,8 @@ fn test_unstable_options_tracking_hash() {
778778
coverage_options,
779779
CoverageOptions {
780780
level: CoverageLevel::Mcdc,
781-
no_mir_spans: true,
782-
discard_all_spans_in_codegen: true
781+
// (don't collapse test-only options onto the same line)
782+
discard_all_spans_in_codegen: true,
783783
}
784784
);
785785
tracked!(crate_attr, vec!["abc".to_string()]);

compiler/rustc_mir_transform/src/coverage/mappings.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,15 +82,11 @@ pub(super) fn extract_all_mapping_info_from_mir<'tcx>(
8282
let mut mcdc_degraded_branches = vec![];
8383
let mut mcdc_mappings = vec![];
8484

85-
if hir_info.is_async_fn || tcx.sess.coverage_no_mir_spans() {
85+
if hir_info.is_async_fn {
8686
// An async function desugars into a function that returns a future,
8787
// with the user code wrapped in a closure. Any spans in the desugared
8888
// outer function will be unhelpful, so just keep the signature span
8989
// and ignore all of the spans in the MIR body.
90-
//
91-
// When debugging flag `-Zcoverage-options=no-mir-spans` is set, we need
92-
// to give the same treatment to _all_ functions, because `llvm-cov`
93-
// seems to ignore functions that don't have any ordinary code spans.
9490
if let Some(span) = hir_info.fn_sig_span {
9591
code_mappings.push(CodeMapping { span, bcb: START_BCB });
9692
}

compiler/rustc_session/src/config.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -182,14 +182,6 @@ pub enum InstrumentCoverage {
182182
pub struct CoverageOptions {
183183
pub level: CoverageLevel,
184184

185-
/// `-Zcoverage-options=no-mir-spans`: Don't extract block coverage spans
186-
/// from MIR statements/terminators, making it easier to inspect/debug
187-
/// branch and MC/DC coverage mappings.
188-
///
189-
/// For internal debugging only. If other code changes would make it hard
190-
/// to keep supporting this flag, remove it.
191-
pub no_mir_spans: bool,
192-
193185
/// `-Zcoverage-options=discard-all-spans-in-codegen`: During codegen,
194186
/// discard all coverage spans as though they were invalid. Needed by
195187
/// regression tests for #133606, because we don't have an easy way to

compiler/rustc_session/src/options.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -755,8 +755,7 @@ mod desc {
755755
pub(crate) const parse_linker_flavor: &str = ::rustc_target::spec::LinkerFlavorCli::one_of();
756756
pub(crate) const parse_dump_mono_stats: &str = "`markdown` (default) or `json`";
757757
pub(crate) const parse_instrument_coverage: &str = parse_bool;
758-
pub(crate) const parse_coverage_options: &str =
759-
"`block` | `branch` | `condition` | `mcdc` | `no-mir-spans`";
758+
pub(crate) const parse_coverage_options: &str = "`block` | `branch` | `condition` | `mcdc`";
760759
pub(crate) const parse_instrument_xray: &str = "either a boolean (`yes`, `no`, `on`, `off`, etc), or a comma separated list of settings: `always` or `never` (mutually exclusive), `ignore-loops`, `instruction-threshold=N`, `skip-entry`, `skip-exit`";
761760
pub(crate) const parse_unpretty: &str = "`string` or `string=string`";
762761
pub(crate) const parse_treat_err_as_bug: &str = "either no value or a non-negative number";
@@ -1460,7 +1459,6 @@ pub mod parse {
14601459
"branch" => slot.level = CoverageLevel::Branch,
14611460
"condition" => slot.level = CoverageLevel::Condition,
14621461
"mcdc" => slot.level = CoverageLevel::Mcdc,
1463-
"no-mir-spans" => slot.no_mir_spans = true,
14641462
"discard-all-spans-in-codegen" => slot.discard_all_spans_in_codegen = true,
14651463
_ => return false,
14661464
}

compiler/rustc_session/src/session.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -359,11 +359,6 @@ impl Session {
359359
&& self.opts.unstable_opts.coverage_options.level >= CoverageLevel::Mcdc
360360
}
361361

362-
/// True if `-Zcoverage-options=no-mir-spans` was passed.
363-
pub fn coverage_no_mir_spans(&self) -> bool {
364-
self.opts.unstable_opts.coverage_options.no_mir_spans
365-
}
366-
367362
/// True if `-Zcoverage-options=discard-all-spans-in-codegen` was passed.
368363
pub fn coverage_discard_all_spans_in_codegen(&self) -> bool {
369364
self.opts.unstable_opts.coverage_options.discard_all_spans_in_codegen

tests/coverage/branch/no-mir-spans.cov-map

Lines changed: 0 additions & 63 deletions
This file was deleted.

tests/coverage/branch/no-mir-spans.coverage

Lines changed: 0 additions & 77 deletions
This file was deleted.

tests/coverage/branch/no-mir-spans.rs

Lines changed: 0 additions & 62 deletions
This file was deleted.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
error: incorrect value `bad` for unstable option `coverage-options` - `block` | `branch` | `condition` | `mcdc` | `no-mir-spans` was expected
1+
error: incorrect value `bad` for unstable option `coverage-options` - `block` | `branch` | `condition` | `mcdc` was expected
22

0 commit comments

Comments
 (0)