coverage: Remove -Zcoverage-options=no-mir-spans
This flag turned out to be less useful than anticipated, and interferes with work towards expansion support.
This commit is contained in:
@@ -778,8 +778,8 @@ fn test_unstable_options_tracking_hash() {
|
||||
coverage_options,
|
||||
CoverageOptions {
|
||||
level: CoverageLevel::Mcdc,
|
||||
no_mir_spans: true,
|
||||
discard_all_spans_in_codegen: true
|
||||
// (don't collapse test-only options onto the same line)
|
||||
discard_all_spans_in_codegen: true,
|
||||
}
|
||||
);
|
||||
tracked!(crate_attr, vec!["abc".to_string()]);
|
||||
|
||||
@@ -82,15 +82,11 @@ pub(super) fn extract_all_mapping_info_from_mir<'tcx>(
|
||||
let mut mcdc_degraded_branches = vec![];
|
||||
let mut mcdc_mappings = vec![];
|
||||
|
||||
if hir_info.is_async_fn || tcx.sess.coverage_no_mir_spans() {
|
||||
if hir_info.is_async_fn {
|
||||
// An async function desugars into a function that returns a future,
|
||||
// with the user code wrapped in a closure. Any spans in the desugared
|
||||
// outer function will be unhelpful, so just keep the signature span
|
||||
// and ignore all of the spans in the MIR body.
|
||||
//
|
||||
// When debugging flag `-Zcoverage-options=no-mir-spans` is set, we need
|
||||
// to give the same treatment to _all_ functions, because `llvm-cov`
|
||||
// seems to ignore functions that don't have any ordinary code spans.
|
||||
if let Some(span) = hir_info.fn_sig_span {
|
||||
code_mappings.push(CodeMapping { span, bcb: START_BCB });
|
||||
}
|
||||
|
||||
@@ -182,14 +182,6 @@ pub enum InstrumentCoverage {
|
||||
pub struct CoverageOptions {
|
||||
pub level: CoverageLevel,
|
||||
|
||||
/// `-Zcoverage-options=no-mir-spans`: Don't extract block coverage spans
|
||||
/// from MIR statements/terminators, making it easier to inspect/debug
|
||||
/// branch and MC/DC coverage mappings.
|
||||
///
|
||||
/// For internal debugging only. If other code changes would make it hard
|
||||
/// to keep supporting this flag, remove it.
|
||||
pub no_mir_spans: bool,
|
||||
|
||||
/// `-Zcoverage-options=discard-all-spans-in-codegen`: During codegen,
|
||||
/// discard all coverage spans as though they were invalid. Needed by
|
||||
/// regression tests for #133606, because we don't have an easy way to
|
||||
|
||||
@@ -755,8 +755,7 @@ mod desc {
|
||||
pub(crate) const parse_linker_flavor: &str = ::rustc_target::spec::LinkerFlavorCli::one_of();
|
||||
pub(crate) const parse_dump_mono_stats: &str = "`markdown` (default) or `json`";
|
||||
pub(crate) const parse_instrument_coverage: &str = parse_bool;
|
||||
pub(crate) const parse_coverage_options: &str =
|
||||
"`block` | `branch` | `condition` | `mcdc` | `no-mir-spans`";
|
||||
pub(crate) const parse_coverage_options: &str = "`block` | `branch` | `condition` | `mcdc`";
|
||||
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`";
|
||||
pub(crate) const parse_unpretty: &str = "`string` or `string=string`";
|
||||
pub(crate) const parse_treat_err_as_bug: &str = "either no value or a non-negative number";
|
||||
@@ -1460,7 +1459,6 @@ pub mod parse {
|
||||
"branch" => slot.level = CoverageLevel::Branch,
|
||||
"condition" => slot.level = CoverageLevel::Condition,
|
||||
"mcdc" => slot.level = CoverageLevel::Mcdc,
|
||||
"no-mir-spans" => slot.no_mir_spans = true,
|
||||
"discard-all-spans-in-codegen" => slot.discard_all_spans_in_codegen = true,
|
||||
_ => return false,
|
||||
}
|
||||
|
||||
@@ -359,11 +359,6 @@ impl Session {
|
||||
&& self.opts.unstable_opts.coverage_options.level >= CoverageLevel::Mcdc
|
||||
}
|
||||
|
||||
/// True if `-Zcoverage-options=no-mir-spans` was passed.
|
||||
pub fn coverage_no_mir_spans(&self) -> bool {
|
||||
self.opts.unstable_opts.coverage_options.no_mir_spans
|
||||
}
|
||||
|
||||
/// True if `-Zcoverage-options=discard-all-spans-in-codegen` was passed.
|
||||
pub fn coverage_discard_all_spans_in_codegen(&self) -> bool {
|
||||
self.opts.unstable_opts.coverage_options.discard_all_spans_in_codegen
|
||||
|
||||
Reference in New Issue
Block a user