diff --git a/compiler/rustc_ast_lowering/src/expr.rs b/compiler/rustc_ast_lowering/src/expr.rs index 314e5103cc2de..e0e78a4d60953 100644 --- a/compiler/rustc_ast_lowering/src/expr.rs +++ b/compiler/rustc_ast_lowering/src/expr.rs @@ -347,7 +347,7 @@ impl<'hir> LoweringContext<'_, 'hir> { // `_ => else_block` where `else_block` is `{}` if there's `None`: let else_pat = self.pat_wild(span); let (else_expr, contains_else_clause) = match else_opt { - None => (self.expr_block_empty(span), false), + None => (self.expr_block_empty(span.shrink_to_hi()), false), Some(els) => (self.lower_expr(els), true), }; let else_arm = self.arm(else_pat, else_expr); diff --git a/compiler/rustc_codegen_llvm/src/attributes.rs b/compiler/rustc_codegen_llvm/src/attributes.rs index 62a7986c194f0..97c38e04bc182 100644 --- a/compiler/rustc_codegen_llvm/src/attributes.rs +++ b/compiler/rustc_codegen_llvm/src/attributes.rs @@ -127,9 +127,6 @@ fn set_probestack(cx: &CodegenCx<'ll, '_>, llfn: &'ll Value) { return; } - // FIXME(richkadel): Make sure probestack plays nice with `-Z instrument-coverage` - // or disable it if not, similar to above early exits. - // Flag our internal `__rust_probestack` function as the stack probe symbol. // This is defined in the `compiler-builtins` crate for each architecture. llvm::AddFunctionAttrStringValue( diff --git a/compiler/rustc_codegen_llvm/src/coverageinfo/mapgen.rs b/compiler/rustc_codegen_llvm/src/coverageinfo/mapgen.rs index 85aaa7e8893bf..1c7e727f9b0b9 100644 --- a/compiler/rustc_codegen_llvm/src/coverageinfo/mapgen.rs +++ b/compiler/rustc_codegen_llvm/src/coverageinfo/mapgen.rs @@ -3,11 +3,14 @@ use crate::coverageinfo; use crate::llvm; use llvm::coverageinfo::CounterMappingRegion; -use rustc_codegen_ssa::coverageinfo::map::{Counter, CounterExpression}; +use rustc_codegen_ssa::coverageinfo::map::{Counter, CounterExpression, FunctionCoverage}; use rustc_codegen_ssa::traits::ConstMethods; -use rustc_data_structures::fx::FxIndexSet; +use rustc_data_structures::fx::{FxHashMap, FxHashSet, FxIndexSet}; +use rustc_hir::def_id::{DefId, DefIdSet, LOCAL_CRATE}; use rustc_llvm::RustString; use rustc_middle::mir::coverage::CodeRegion; +use rustc_middle::ty::{Instance, TyCtxt}; +use rustc_span::Symbol; use std::ffi::CString; @@ -26,14 +29,17 @@ use tracing::debug; /// undocumented details in Clang's implementation (that may or may not be important) were also /// replicated for Rust's Coverage Map. pub fn finalize<'ll, 'tcx>(cx: &CodegenCx<'ll, 'tcx>) { + let tcx = cx.tcx; // Ensure LLVM supports Coverage Map Version 4 (encoded as a zero-based value: 3). // If not, the LLVM Version must be less than 11. let version = coverageinfo::mapping_version(); if version != 3 { - cx.tcx.sess.fatal("rustc option `-Z instrument-coverage` requires LLVM 11 or higher."); + tcx.sess.fatal("rustc option `-Z instrument-coverage` requires LLVM 11 or higher."); } - let function_coverage_map = match cx.coverage_context() { + debug!("Generating coverage map for CodegenUnit: `{}`", cx.codegen_unit.name()); + + let mut function_coverage_map = match cx.coverage_context() { Some(ctx) => ctx.take_function_coverage_map(), None => return, }; @@ -42,14 +48,15 @@ pub fn finalize<'ll, 'tcx>(cx: &CodegenCx<'ll, 'tcx>) { return; } + add_unreachable_coverage(tcx, &mut function_coverage_map); + let mut mapgen = CoverageMapGenerator::new(); // Encode coverage mappings and generate function records let mut function_data = Vec::new(); for (instance, function_coverage) in function_coverage_map { - debug!("Generate coverage map for: {:?}", instance); - - let mangled_function_name = cx.tcx.symbol_name(instance).to_string(); + debug!("Generate function coverage for {}, {:?}", cx.codegen_unit.name(), instance); + let mangled_function_name = tcx.symbol_name(instance).to_string(); let function_source_hash = function_coverage.source_hash(); let (expressions, counter_regions) = function_coverage.get_expressions_and_counter_regions(); @@ -228,3 +235,156 @@ fn save_function_record( let is_used = true; coverageinfo::save_func_record_to_mod(cx, func_name_hash, func_record_val, is_used); } + +/// When finalizing the coverage map, `FunctionCoverage` only has the `CodeRegion`s and counters for +/// the functions that went through codegen; such as public functions and "used" functions +/// (functions referenced by other "used" or public items). Any other functions considered unused, +/// or "Unreachable" were still parsed and processed through the MIR stage. +/// +/// We can find the unreachable functions by the set different of all MIR `DefId`s (`tcx` query +/// `mir_keys`) minus the codegenned `DefId`s (`tcx` query `collect_and_partition_mono_items`). +/// +/// *HOWEVER* the codegenned `DefId`s are partitioned across multiple `CodegenUnit`s (CGUs), and +/// this function is processing a `function_coverage_map` for the functions (`Instance`/`DefId`) +/// allocated to only one of those CGUs. We must NOT inject any "Unreachable" functions's +/// `CodeRegion`s more than once, so we have to pick which CGU's `function_coverage_map` to add +/// each "Unreachable" function to. +/// +/// Some constraints: +/// +/// 1. The file name of an "Unreachable" function must match the file name of the existing +/// codegenned (covered) function to which the unreachable code regions will be added. +/// 2. The function to which the unreachable code regions will be added must not be a genaric +/// function (must not have type parameters) because the coverage tools will get confused +/// if the codegenned function has more than one instantiation and additional `CodeRegion`s +/// attached to only one of those instantiations. +fn add_unreachable_coverage<'tcx>( + tcx: TyCtxt<'tcx>, + function_coverage_map: &mut FxHashMap, FunctionCoverage<'tcx>>, +) { + // FIXME(#79622): Can this solution be simplified and/or improved? Are there other sources + // of compiler state data that might help (or better sources that could be exposed, but + // aren't yet)? + + // Note: If the crate *only* defines generic functions, there are no codegenerated non-generic + // functions to add any unreachable code to. In this case, the unreachable code regions will + // have no coverage, instead of having coverage with zero executions. + // + // This is probably still an improvement over Clang, which does not generate any coverage + // for uninstantiated template functions. + + let has_non_generic_def_ids = + function_coverage_map.keys().any(|instance| instance.def.attrs(tcx).len() == 0); + + if !has_non_generic_def_ids { + // There are no non-generic functions to add unreachable `CodeRegion`s to + return; + } + + let all_def_ids: DefIdSet = + tcx.mir_keys(LOCAL_CRATE).iter().map(|local_def_id| local_def_id.to_def_id()).collect(); + + let (codegenned_def_ids, _) = tcx.collect_and_partition_mono_items(LOCAL_CRATE); + + let mut unreachable_def_ids_by_file: FxHashMap> = FxHashMap::default(); + for &non_codegenned_def_id in all_def_ids.difference(codegenned_def_ids) { + // Make sure the non-codegenned (unreachable) function has a file_name + if let Some(non_codegenned_file_name) = tcx.covered_file_name(non_codegenned_def_id) { + let def_ids = unreachable_def_ids_by_file + .entry(*non_codegenned_file_name) + .or_insert_with(|| Vec::new()); + def_ids.push(non_codegenned_def_id); + } + } + + if unreachable_def_ids_by_file.is_empty() { + // There are no unreachable functions with file names to add (in any CGU) + return; + } + + // Since there may be multiple `CodegenUnit`s, some codegenned_def_ids may be codegenned in a + // different CGU, and will be added to the function_coverage_map for each CGU. Determine which + // function_coverage_map has the responsibility for publishing unreachable coverage + // based on file name: + // + // For each covered file name, sort ONLY the non-generic codegenned_def_ids, and if + // covered_def_ids.contains(the first def_id) for a given file_name, add the unreachable code + // region in this function_coverage_map. Otherwise, ignore it and assume another CGU's + // function_coverage_map will be adding it (because it will be first for one, and only one, + // of them). + let mut sorted_codegenned_def_ids: Vec = + codegenned_def_ids.iter().map(|def_id| *def_id).collect(); + sorted_codegenned_def_ids.sort_unstable(); + + let mut first_covered_def_id_by_file: FxHashMap = FxHashMap::default(); + for &def_id in sorted_codegenned_def_ids.iter() { + // Only consider non-generic functions, to potentially add unreachable code regions + if tcx.generics_of(def_id).count() == 0 { + if let Some(covered_file_name) = tcx.covered_file_name(def_id) { + // Only add files known to have unreachable functions + if unreachable_def_ids_by_file.contains_key(covered_file_name) { + first_covered_def_id_by_file.entry(*covered_file_name).or_insert(def_id); + } + } + } + } + + // Get the set of def_ids with coverage regions, known by *this* CoverageContext. + let cgu_covered_def_ids: DefIdSet = + function_coverage_map.keys().map(|instance| instance.def.def_id()).collect(); + + let mut cgu_covered_files: FxHashSet = first_covered_def_id_by_file + .iter() + .filter_map( + |(&file_name, def_id)| { + if cgu_covered_def_ids.contains(def_id) { Some(file_name) } else { None } + }, + ) + .collect(); + + // Find the first covered, non-generic function (instance) for each cgu_covered_file. Take the + // unreachable code regions for that file, and add them to the function. + // + // There are three `for` loops here, but (a) the lists have already been reduced to the minimum + // required values, the lists are further reduced (by `remove()` calls) when elements are no + // longer needed, and there are several opportunities to branch out of loops early. + for (instance, function_coverage) in function_coverage_map.iter_mut() { + if instance.def.attrs(tcx).len() > 0 { + continue; + } + // The covered function is not generic... + let covered_def_id = instance.def.def_id(); + if let Some(covered_file_name) = tcx.covered_file_name(covered_def_id) { + if !cgu_covered_files.remove(&covered_file_name) { + continue; + } + // The covered function's file is one of the files with unreachable code regions, so + // all of the unreachable code regions for this file will be added to this function. + for def_id in + unreachable_def_ids_by_file.remove(&covered_file_name).into_iter().flatten() + { + // Note, this loop adds an unreachable code regions for each MIR-derived region. + // Alternatively, we could add a single code region for the maximum span of all + // code regions here. + // + // Observed downsides of this approach are: + // + // 1. The coverage results will appear inconsistent compared with the same (or + // similar) code in a function that is reached. + // 2. If the function is unreachable from one crate but reachable when compiling + // another referencing crate (such as a cross-crate reference to a + // generic function or inlined function), actual coverage regions overlaid + // on a single larger code span of `Zero` coverage can appear confusing or + // wrong. Chaning the unreachable coverage from a `code_region` to a + // `gap_region` can help, but still can look odd with `0` line counts for + // lines between executed (> 0) lines (such as for blank lines or comments). + for ®ion in tcx.covered_code_regions(def_id) { + function_coverage.add_unreachable_region(region.clone()); + } + } + if cgu_covered_files.is_empty() { + break; + } + } + } +} diff --git a/compiler/rustc_codegen_ssa/src/lib.rs b/compiler/rustc_codegen_ssa/src/lib.rs index 70b92b234e94c..8ec1eed440456 100644 --- a/compiler/rustc_codegen_ssa/src/lib.rs +++ b/compiler/rustc_codegen_ssa/src/lib.rs @@ -2,6 +2,7 @@ #![feature(bool_to_option)] #![feature(option_expect_none)] #![feature(box_patterns)] +#![feature(drain_filter)] #![feature(try_blocks)] #![feature(in_band_lifetimes)] #![feature(nll)] diff --git a/compiler/rustc_middle/src/arena.rs b/compiler/rustc_middle/src/arena.rs index 672073b1d3472..9a42bbe7bacdd 100644 --- a/compiler/rustc_middle/src/arena.rs +++ b/compiler/rustc_middle/src/arena.rs @@ -32,6 +32,7 @@ macro_rules! arena_types { [decode] borrowck_result: rustc_middle::mir::BorrowCheckResult<$tcx>, [decode] unsafety_check_result: rustc_middle::mir::UnsafetyCheckResult, + [decode] code_region: rustc_middle::mir::coverage::CodeRegion, [] const_allocs: rustc_middle::mir::interpret::Allocation, // Required for the incremental on-disk cache [few] mir_keys: rustc_hir::def_id::DefIdSet, diff --git a/compiler/rustc_middle/src/hir/map/mod.rs b/compiler/rustc_middle/src/hir/map/mod.rs index 5e36362ec5916..598e28c1a3ab0 100644 --- a/compiler/rustc_middle/src/hir/map/mod.rs +++ b/compiler/rustc_middle/src/hir/map/mod.rs @@ -47,7 +47,7 @@ fn fn_decl<'hir>(node: Node<'hir>) -> Option<&'hir FnDecl<'hir>> { } } -fn fn_sig<'hir>(node: Node<'hir>) -> Option<&'hir FnSig<'hir>> { +pub fn fn_sig<'hir>(node: Node<'hir>) -> Option<&'hir FnSig<'hir>> { match &node { Node::Item(Item { kind: ItemKind::Fn(sig, _, _), .. }) | Node::TraitItem(TraitItem { kind: TraitItemKind::Fn(sig, _), .. }) diff --git a/compiler/rustc_middle/src/query/mod.rs b/compiler/rustc_middle/src/query/mod.rs index 7822ecc2c1f76..1b5f7a2c12e72 100644 --- a/compiler/rustc_middle/src/query/mod.rs +++ b/compiler/rustc_middle/src/query/mod.rs @@ -346,6 +346,21 @@ rustc_queries! { cache_on_disk_if { key.is_local() } } + /// Returns the name of the file that contains the function body, if instrumented for coverage. + query covered_file_name(key: DefId) -> Option { + desc { |tcx| "retrieving the covered file name, if instrumented, for `{}`", tcx.def_path_str(key) } + storage(ArenaCacheSelector<'tcx>) + cache_on_disk_if { key.is_local() } + } + + /// Returns the `CodeRegions` for a function that has instrumented coverage, in case the + /// function was optimized out before codegen, and before being added to the Coverage Map. + query covered_code_regions(key: DefId) -> Vec<&'tcx mir::coverage::CodeRegion> { + desc { |tcx| "retrieving the covered `CodeRegion`s, if instrumented, for `{}`", tcx.def_path_str(key) } + storage(ArenaCacheSelector<'tcx>) + cache_on_disk_if { key.is_local() } + } + /// The `DefId` is the `DefId` of the containing MIR body. Promoteds do not have their own /// `DefId`. This function returns all promoteds in the specified body. The body references /// promoteds by the `DefId` and the `mir::Promoted` index. This is necessary, because diff --git a/compiler/rustc_middle/src/ty/codec.rs b/compiler/rustc_middle/src/ty/codec.rs index 1def4936860f1..b2fc3710cd673 100644 --- a/compiler/rustc_middle/src/ty/codec.rs +++ b/compiler/rustc_middle/src/ty/codec.rs @@ -162,7 +162,8 @@ encodable_via_deref! { ty::Region<'tcx>, &'tcx mir::Body<'tcx>, &'tcx mir::UnsafetyCheckResult, - &'tcx mir::BorrowCheckResult<'tcx> + &'tcx mir::BorrowCheckResult<'tcx>, + &'tcx mir::coverage::CodeRegion } pub trait TyDecoder<'tcx>: Decoder { @@ -376,7 +377,8 @@ impl_decodable_via_ref! { &'tcx Allocation, &'tcx mir::Body<'tcx>, &'tcx mir::UnsafetyCheckResult, - &'tcx mir::BorrowCheckResult<'tcx> + &'tcx mir::BorrowCheckResult<'tcx>, + &'tcx mir::coverage::CodeRegion } #[macro_export] diff --git a/compiler/rustc_mir/src/transform/coverage/graph.rs b/compiler/rustc_mir/src/transform/coverage/graph.rs index 9d375633dcf51..f79f0d3253899 100644 --- a/compiler/rustc_mir/src/transform/coverage/graph.rs +++ b/compiler/rustc_mir/src/transform/coverage/graph.rs @@ -118,18 +118,8 @@ impl CoverageGraph { match term.kind { TerminatorKind::Return { .. } - // FIXME(richkadel): Add test(s) for `Abort` coverage. | TerminatorKind::Abort - // FIXME(richkadel): Add test(s) for `Assert` coverage. - // Should `Assert` be handled like `FalseUnwind` instead? Since we filter out unwind - // branches when creating the BCB CFG, aren't `Assert`s (without unwinds) just like - // `FalseUnwinds` (which are kind of like `Goto`s)? - | TerminatorKind::Assert { .. } - // FIXME(richkadel): Add test(s) for `Yield` coverage, and confirm coverage is - // sensible for code using the `yield` keyword. | TerminatorKind::Yield { .. } - // FIXME(richkadel): Also add coverage tests using async/await, and threading. - | TerminatorKind::SwitchInt { .. } => { // The `bb` has more than one _outgoing_ edge, or exits the function. Save the // current sequence of `basic_blocks` gathered to this point, as a new @@ -147,6 +137,16 @@ impl CoverageGraph { // `Terminator`s `successors()` list) checking the number of successors won't // work. } + + // The following `TerminatorKind`s are either not expected outside an unwind branch, + // or they should not (under normal circumstances) branch. Coverage graphs are + // simplified by assuring coverage results are accurate for program executions that + // don't panic. + // + // Programs that panic and unwind may record slightly inaccurate coverage results + // for a coverage region containing the `Terminator` that began the panic. This + // is as intended. (See Issue #78544 for a possible future option to support + // coverage in test programs that panic.) TerminatorKind::Goto { .. } | TerminatorKind::Resume | TerminatorKind::Unreachable @@ -154,6 +154,7 @@ impl CoverageGraph { | TerminatorKind::DropAndReplace { .. } | TerminatorKind::Call { .. } | TerminatorKind::GeneratorDrop + | TerminatorKind::Assert { .. } | TerminatorKind::FalseEdge { .. } | TerminatorKind::FalseUnwind { .. } | TerminatorKind::InlineAsm { .. } => {} @@ -278,6 +279,7 @@ rustc_index::newtype_index! { /// A node in the [control-flow graph][CFG] of CoverageGraph. pub(super) struct BasicCoverageBlock { DEBUG_FORMAT = "bcb{}", + const START_BCB = 0, } } diff --git a/compiler/rustc_mir/src/transform/coverage/mod.rs b/compiler/rustc_mir/src/transform/coverage/mod.rs index 192bb6680e420..10f522d67465d 100644 --- a/compiler/rustc_mir/src/transform/coverage/mod.rs +++ b/compiler/rustc_mir/src/transform/coverage/mod.rs @@ -88,6 +88,7 @@ struct Instrumentor<'a, 'tcx> { pass_name: &'a str, tcx: TyCtxt<'tcx>, mir_body: &'a mut mir::Body<'tcx>, + fn_sig_span: Span, body_span: Span, basic_coverage_blocks: CoverageGraph, coverage_counters: CoverageCounters, @@ -95,14 +96,19 @@ struct Instrumentor<'a, 'tcx> { impl<'a, 'tcx> Instrumentor<'a, 'tcx> { fn new(pass_name: &'a str, tcx: TyCtxt<'tcx>, mir_body: &'a mut mir::Body<'tcx>) -> Self { - let hir_body = hir_body(tcx, mir_body.source.def_id()); + let (some_fn_sig, hir_body) = fn_sig_and_body(tcx, mir_body.source.def_id()); let body_span = hir_body.value.span; + let fn_sig_span = match some_fn_sig { + Some(fn_sig) => fn_sig.span.with_hi(body_span.lo()), + None => body_span.shrink_to_lo(), + }; let function_source_hash = hash_mir_source(tcx, hir_body); let basic_coverage_blocks = CoverageGraph::from_mir(mir_body); Self { pass_name, tcx, mir_body, + fn_sig_span, body_span, basic_coverage_blocks, coverage_counters: CoverageCounters::new(function_source_hash), @@ -114,9 +120,15 @@ impl<'a, 'tcx> Instrumentor<'a, 'tcx> { let source_map = tcx.sess.source_map(); let mir_source = self.mir_body.source; let def_id = mir_source.def_id(); + let fn_sig_span = self.fn_sig_span; let body_span = self.body_span; - debug!("instrumenting {:?}, span: {}", def_id, source_map.span_to_string(body_span)); + debug!( + "instrumenting {:?}, fn sig span: {}, body span: {}", + def_id, + source_map.span_to_string(fn_sig_span), + source_map.span_to_string(body_span) + ); let mut graphviz_data = debug::GraphvizData::new(); let mut debug_used_expressions = debug::UsedExpressions::new(); @@ -138,6 +150,7 @@ impl<'a, 'tcx> Instrumentor<'a, 'tcx> { // Compute `CoverageSpan`s from the `CoverageGraph`. let coverage_spans = CoverageSpans::generate_coverage_spans( &self.mir_body, + fn_sig_span, body_span, &self.basic_coverage_blocks, ); @@ -272,47 +285,13 @@ impl<'a, 'tcx> Instrumentor<'a, 'tcx> { bug!("Every BasicCoverageBlock should have a Counter or Expression"); }; graphviz_data.add_bcb_coverage_span_with_counter(bcb, &covspan, &counter_kind); - // FIXME(#78542): Can spans for `TerminatorKind::Goto` be improved to avoid special - // cases? - let some_code_region = if self.is_code_region_redundant(bcb, span, body_span) { - None - } else { - Some(make_code_region(file_name, &source_file, span, body_span)) - }; - inject_statement(self.mir_body, counter_kind, self.bcb_last_bb(bcb), some_code_region); - } - } - - /// Returns true if the type of `BasicCoverageBlock` (specifically, it's `BasicBlock`s - /// `TerminatorKind`) with the given `Span` (relative to the `body_span`) is known to produce - /// a redundant coverage count. - /// - /// There is at least one case for this, and if it's not handled, the last line in a function - /// will be double-counted. - /// - /// If this method returns `true`, the counter (which other `Expressions` may depend on) is - /// still injected, but without an associated code region. - // FIXME(#78542): Can spans for `TerminatorKind::Goto` be improved to avoid special cases? - fn is_code_region_redundant( - &self, - bcb: BasicCoverageBlock, - span: Span, - body_span: Span, - ) -> bool { - if span.hi() == body_span.hi() { - // All functions execute a `Return`-terminated `BasicBlock`, regardless of how the - // function returns; but only some functions also _can_ return after a `Goto` block - // that ends on the closing brace of the function (with the `Return`). When this - // happens, the last character is counted 2 (or possibly more) times, when we know - // the function returned only once (of course). By giving all `Goto` terminators at - // the end of a function a `non-reportable` code region, they are still counted - // if appropriate, but they don't increment the line counter, as long as their is - // also a `Return` on that last line. - if let TerminatorKind::Goto { .. } = self.bcb_terminator(bcb).kind { - return true; - } + inject_statement( + self.mir_body, + counter_kind, + self.bcb_last_bb(bcb), + Some(make_code_region(file_name, &source_file, span, body_span)), + ); } - false } /// `inject_coverage_span_counters()` looped through the `CoverageSpan`s and injected the @@ -411,11 +390,6 @@ impl<'a, 'tcx> Instrumentor<'a, 'tcx> { self.bcb_data(bcb).last_bb() } - #[inline] - fn bcb_terminator(&self, bcb: BasicCoverageBlock) -> &Terminator<'tcx> { - self.bcb_data(bcb).terminator(self.mir_body) - } - #[inline] fn bcb_data(&self, bcb: BasicCoverageBlock) -> &BasicCoverageBlockData { &self.basic_coverage_blocks[bcb] @@ -521,10 +495,15 @@ fn make_code_region( } } -fn hir_body<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> &'tcx rustc_hir::Body<'tcx> { +fn fn_sig_and_body<'tcx>( + tcx: TyCtxt<'tcx>, + def_id: DefId, +) -> (Option<&'tcx rustc_hir::FnSig<'tcx>>, &'tcx rustc_hir::Body<'tcx>) { + // FIXME(#79625): Consider improving MIR to provide the information needed, to avoid going back + // to HIR for it. let hir_node = tcx.hir().get_if_local(def_id).expect("expected DefId is local"); let fn_body_id = hir::map::associated_body(hir_node).expect("HIR node is a function with body"); - tcx.hir().body(fn_body_id) + (hir::map::fn_sig(hir_node), tcx.hir().body(fn_body_id)) } fn hash_mir_source<'tcx>(tcx: TyCtxt<'tcx>, hir_body: &'tcx rustc_hir::Body<'tcx>) -> u64 { diff --git a/compiler/rustc_mir/src/transform/coverage/query.rs b/compiler/rustc_mir/src/transform/coverage/query.rs index e86bb96d29c30..aa34ae70ef1a4 100644 --- a/compiler/rustc_mir/src/transform/coverage/query.rs +++ b/compiler/rustc_mir/src/transform/coverage/query.rs @@ -1,6 +1,8 @@ +use super::*; + use rustc_middle::mir::coverage::*; use rustc_middle::mir::visit::Visitor; -use rustc_middle::mir::{Coverage, CoverageInfo, Location}; +use rustc_middle::mir::{self, Coverage, CoverageInfo, Location}; use rustc_middle::ty::query::Providers; use rustc_middle::ty::TyCtxt; use rustc_span::def_id::DefId; @@ -9,6 +11,8 @@ use rustc_span::def_id::DefId; /// counter) and `FunctionCoverage::new()` (to extract the coverage map metadata from the MIR). pub(crate) fn provide(providers: &mut Providers) { providers.coverageinfo = |tcx, def_id| coverageinfo_from_mir(tcx, def_id); + providers.covered_file_name = |tcx, def_id| covered_file_name(tcx, def_id); + providers.covered_code_regions = |tcx, def_id| covered_code_regions(tcx, def_id); } /// The `num_counters` argument to `llvm.instrprof.increment` is the max counter_id + 1, or in @@ -123,3 +127,34 @@ fn coverageinfo_from_mir<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> CoverageInfo coverage_visitor.info } + +fn covered_file_name<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> Option { + let mir_body = tcx.optimized_mir(def_id); + for bb_data in mir_body.basic_blocks().iter() { + for statement in bb_data.statements.iter() { + if let StatementKind::Coverage(box ref coverage) = statement.kind { + if let Some(code_region) = coverage.code_region.as_ref() { + return Some(code_region.file_name); + } + } + } + } + None +} + +fn covered_code_regions<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> Vec<&'tcx CodeRegion> { + let mir_body: &'tcx mir::Body<'tcx> = tcx.optimized_mir(def_id); + mir_body + .basic_blocks() + .iter() + .map(|data| { + data.statements.iter().filter_map(|statement| match statement.kind { + StatementKind::Coverage(box ref coverage) => { + coverage.code_region.as_ref() // may be None + } + _ => None, + }) + }) + .flatten() + .collect() +} diff --git a/compiler/rustc_mir/src/transform/coverage/spans.rs b/compiler/rustc_mir/src/transform/coverage/spans.rs index 95c49922262f6..6eb89754ee635 100644 --- a/compiler/rustc_mir/src/transform/coverage/spans.rs +++ b/compiler/rustc_mir/src/transform/coverage/spans.rs @@ -1,10 +1,9 @@ use super::debug::term_type; -use super::graph::{BasicCoverageBlock, BasicCoverageBlockData, CoverageGraph}; +use super::graph::{BasicCoverageBlock, BasicCoverageBlockData, CoverageGraph, START_BCB}; use crate::util::spanview::source_range_no_file; use rustc_data_structures::graph::WithNumNodes; -use rustc_index::bit_set::BitSet; use rustc_middle::mir::{ self, AggregateKind, BasicBlock, FakeReadCause, Rvalue, Statement, StatementKind, Terminator, TerminatorKind, @@ -74,6 +73,10 @@ pub(super) struct CoverageSpan { } impl CoverageSpan { + pub fn for_fn_sig(fn_sig_span: Span) -> Self { + Self { span: fn_sig_span, bcb: START_BCB, coverage_statements: vec![], is_closure: false } + } + pub fn for_statement( statement: &Statement<'tcx>, span: Span, @@ -82,10 +85,10 @@ impl CoverageSpan { stmt_index: usize, ) -> Self { let is_closure = match statement.kind { - StatementKind::Assign(box ( - _, - Rvalue::Aggregate(box AggregateKind::Closure(_, _), _), - )) => true, + StatementKind::Assign(box (_, Rvalue::Aggregate(box ref kind, _))) => match kind { + AggregateKind::Closure(_, _) | AggregateKind::Generator(_, _, _) => true, + _ => false, + }, _ => false, }; @@ -109,9 +112,6 @@ impl CoverageSpan { pub fn merge_from(&mut self, mut other: CoverageSpan) { debug_assert!(self.is_mergeable(&other)); self.span = self.span.to(other.span); - if other.is_closure { - self.is_closure = true; - } self.coverage_statements.append(&mut other.coverage_statements); } @@ -171,6 +171,9 @@ pub struct CoverageSpans<'a, 'tcx> { /// The MIR, used to look up `BasicBlockData`. mir_body: &'a mir::Body<'tcx>, + /// A `Span` covering the signature of function for the MIR. + fn_sig_span: Span, + /// A `Span` covering the function body of the MIR (typically from left curly brace to right /// curly brace). body_span: Span, @@ -216,11 +219,13 @@ pub struct CoverageSpans<'a, 'tcx> { impl<'a, 'tcx> CoverageSpans<'a, 'tcx> { pub(super) fn generate_coverage_spans( mir_body: &'a mir::Body<'tcx>, + fn_sig_span: Span, body_span: Span, basic_coverage_blocks: &'a CoverageGraph, ) -> Vec { let mut coverage_spans = CoverageSpans { mir_body, + fn_sig_span, body_span, basic_coverage_blocks, sorted_spans_iter: None, @@ -277,6 +282,8 @@ impl<'a, 'tcx> CoverageSpans<'a, 'tcx> { return initial_spans; } + initial_spans.push(CoverageSpan::for_fn_sig(self.fn_sig_span)); + initial_spans.sort_unstable_by(|a, b| { if a.span.lo() == b.span.lo() { if a.span.hi() == b.span.hi() { @@ -331,7 +338,7 @@ impl<'a, 'tcx> CoverageSpans<'a, 'tcx> { prev={:?}", self.prev() ); - self.discard_curr(); + self.take_curr(); } else if self.curr().is_closure { self.carve_out_span_for_closure(); } else if self.prev_original_span == self.curr().span { @@ -345,28 +352,28 @@ impl<'a, 'tcx> CoverageSpans<'a, 'tcx> { debug!(" AT END, adding last prev={:?}", self.prev()); let prev = self.take_prev(); - let CoverageSpans { - mir_body, basic_coverage_blocks, pending_dups, mut refined_spans, .. - } = self; + let CoverageSpans { pending_dups, mut refined_spans, .. } = self; for dup in pending_dups { debug!(" ...adding at least one pending dup={:?}", dup); refined_spans.push(dup); } - refined_spans.push(prev); - - // Remove `CoverageSpan`s with empty spans ONLY if the empty `CoverageSpan`s BCB also has at - // least one other non-empty `CoverageSpan`. - let mut has_coverage = BitSet::new_empty(basic_coverage_blocks.num_nodes()); - for covspan in &refined_spans { - if !covspan.span.is_empty() { - has_coverage.insert(covspan.bcb); - } + + // Async functions wrap a closure that implements the body to be executed. The enclosing + // function is called and returns an `impl Future` without initially executing any of the + // body. To avoid showing the return from the enclosing function as a "covered" return from + // the closure, the enclosing function's `TerminatorKind::Return`s `CoverageSpan` is + // excluded. The closure's `Return` is the only one that will be counted. This provides + // adequate coverage, and more intuitive counts. (Avoids double-counting the closing brace + // of the function body.) + let body_ends_with_closure = if let Some(last_covspan) = refined_spans.last() { + last_covspan.is_closure && last_covspan.span.hi() == self.body_span.hi() + } else { + false + }; + + if !body_ends_with_closure { + refined_spans.push(prev); } - refined_spans.retain(|covspan| { - !(covspan.span.is_empty() - && is_goto(&basic_coverage_blocks[covspan.bcb].terminator(mir_body).kind) - && has_coverage.contains(covspan.bcb)) - }); // Remove `CoverageSpan`s derived from closures, originally added to ensure the coverage // regions for the current function leave room for the closure's own coverage regions @@ -491,8 +498,8 @@ impl<'a, 'tcx> CoverageSpans<'a, 'tcx> { /// If called, then the next call to `next_coverage_span()` will *not* update `prev` with the /// `curr` coverage span. - fn discard_curr(&mut self) { - self.some_curr = None; + fn take_curr(&mut self) -> CoverageSpan { + self.some_curr.take().unwrap_or_else(|| bug!("invalid attempt to unwrap a None some_curr")) } /// Returns true if the curr span should be skipped because prev has already advanced beyond the @@ -508,11 +515,11 @@ impl<'a, 'tcx> CoverageSpans<'a, 'tcx> { self.prev().span.hi() <= self.curr().span.lo() } - /// If `prev`s span extends left of the closure (`curr`), carve out the closure's - /// span from `prev`'s span. (The closure's coverage counters will be injected when - /// processing the closure's own MIR.) Add the portion of the span to the left of the - /// closure; and if the span extends to the right of the closure, update `prev` to - /// that portion of the span. For any `pending_dups`, repeat the same process. + /// If `prev`s span extends left of the closure (`curr`), carve out the closure's span from + /// `prev`'s span. (The closure's coverage counters will be injected when processing the + /// closure's own MIR.) Add the portion of the span to the left of the closure; and if the span + /// extends to the right of the closure, update `prev` to that portion of the span. For any + /// `pending_dups`, repeat the same process. fn carve_out_span_for_closure(&mut self) { let curr_span = self.curr().span; let left_cutoff = curr_span.lo(); @@ -541,7 +548,8 @@ impl<'a, 'tcx> CoverageSpans<'a, 'tcx> { dup.span = dup.span.with_lo(right_cutoff); } self.pending_dups.append(&mut pending_dups); - self.discard_curr(); // since self.prev() was already updated + let closure_covspan = self.take_curr(); + self.refined_spans.push(closure_covspan); // since self.prev() was already updated } else { pending_dups.clear(); } @@ -705,30 +713,8 @@ pub(super) fn filtered_terminator_span( | TerminatorKind::DropAndReplace { .. } | TerminatorKind::SwitchInt { .. } // For `FalseEdge`, only the `real` branch is taken, so it is similar to a `Goto`. - // FIXME(richkadel): Note that `Goto` was moved to it's own match arm, for the reasons - // described below. Add tests to confirm whether or not similar cases also apply to - // `FalseEdge`. - | TerminatorKind::FalseEdge { .. } => None, - - // FIXME(#78542): Can spans for `TerminatorKind::Goto` be improved to avoid special cases? - // - // `Goto`s are often the targets of `SwitchInt` branches, and certain important - // optimizations to replace some `Counter`s with `Expression`s require a separate - // `BasicCoverageBlock` for each branch, to support the `Counter`, when needed. - // - // Also, some test cases showed that `Goto` terminators, and to some degree their `Span`s, - // provided useful context for coverage, such as to count and show when `if` blocks - // _without_ `else` blocks execute the `false` case (counting when the body of the `if` - // was _not_ taken). In these cases, the `Goto` span is ultimately given a `CoverageSpan` - // of 1 character, at the end of it's original `Span`. - // - // However, in other cases, a visible `CoverageSpan` is not wanted, but the `Goto` - // block must still be counted (for example, to contribute its count to an `Expression` - // that reports the execution count for some other block). In these cases, the code region - // is set to `None`. (See `Instrumentor::is_code_region_redundant()`.) - TerminatorKind::Goto { .. } => { - Some(function_source_span(terminator.source_info.span.shrink_to_hi(), body_span)) - } + | TerminatorKind::FalseEdge { .. } + | TerminatorKind::Goto { .. } => None, // Retain spans from all other terminators TerminatorKind::Resume @@ -749,11 +735,3 @@ fn function_source_span(span: Span, body_span: Span) -> Span { let span = original_sp(span, body_span).with_ctxt(SyntaxContext::root()); if body_span.contains(span) { span } else { body_span } } - -#[inline(always)] -fn is_goto(term_kind: &TerminatorKind<'tcx>) -> bool { - match term_kind { - TerminatorKind::Goto { .. } => true, - _ => false, - } -} diff --git a/compiler/rustc_mir/src/util/generic_graphviz.rs b/compiler/rustc_mir/src/util/generic_graphviz.rs index 8bd4a512bbb05..fd55a4dfc4c92 100644 --- a/compiler/rustc_mir/src/util/generic_graphviz.rs +++ b/compiler/rustc_mir/src/util/generic_graphviz.rs @@ -116,9 +116,13 @@ impl< write!(w, r#""#)?; - // FIXME(richkadel): Need generic way to know if node header should have a different color + // FIXME(richkadel): If/when migrating the MIR graphviz to this generic implementation, + // we need generic way to know if node header should have a different color. For example, + // for MIR: + // // let (blk, bgcolor) = if data.is_cleanup { - // (format!("{:?} (cleanup)", node), "lightblue") + // let color = if dark_mode { "royalblue" } else { "lightblue" }; + // (format!("{:?} (cleanup)", node), color) // } else { // let color = if dark_mode { "dimgray" } else { "gray" }; // (format!("{:?}", node), color) diff --git a/compiler/rustc_session/src/options.rs b/compiler/rustc_session/src/options.rs index 66c709b408098..91ebc9a7c82e0 100644 --- a/compiler/rustc_session/src/options.rs +++ b/compiler/rustc_session/src/options.rs @@ -945,8 +945,7 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options, "instrument the generated code to support LLVM source-based code coverage \ reports (note, the compiler build config must include `profiler = true`, \ and is mutually exclusive with `-C profile-generate`/`-C profile-use`); \ - implies `-C link-dead-code` (unless targeting MSVC, or explicitly disabled) \ - and `-Z symbol-mangling-version=v0`; disables/overrides some Rust \ + implies `-Z symbol-mangling-version=v0`; disables/overrides some Rust \ optimizations (default: no)"), instrument_mcount: bool = (false, parse_bool, [TRACKED], "insert function instrument code for mcount-based tracing (default: no)"), diff --git a/compiler/rustc_session/src/session.rs b/compiler/rustc_session/src/session.rs index 1352ab53cab4f..4e269f3172c20 100644 --- a/compiler/rustc_session/src/session.rs +++ b/compiler/rustc_session/src/session.rs @@ -1111,33 +1111,7 @@ impl Session { pub fn link_dead_code(&self) -> bool { match self.opts.cg.link_dead_code { Some(explicitly_set) => explicitly_set, - None => { - self.opts.debugging_opts.instrument_coverage && !self.target.is_like_msvc - // Issue #76038: (rustc `-Clink-dead-code` causes MSVC linker to produce invalid - // binaries when LLVM InstrProf counters are enabled). As described by this issue, - // the "link dead code" option produces incorrect binaries when compiled and linked - // under MSVC. The resulting Rust programs typically crash with a segmentation - // fault, or produce an empty "*.profraw" file (profiling counter results normally - // generated during program exit). - // - // If not targeting MSVC, `-Z instrument-coverage` implies `-C link-dead-code`, so - // unexecuted code is still counted as zero, rather than be optimized out. Note that - // instrumenting dead code can be explicitly disabled with: - // - // `-Z instrument-coverage -C link-dead-code=no`. - // - // FIXME(richkadel): Investigate if `instrument-coverage` implementation can inject - // [zero counters](https://llvm.org/docs/CoverageMappingFormat.html#counter) in the - // coverage map when "dead code" is removed, rather than forcing `link-dead-code`. - // This may not be possible, however, if (as it seems to appear) the "dead code" - // that would otherwise not be linked is only identified as "dead" by the native - // linker. If that's the case, I believe it is too late for the Rust compiler to - // leverage any information it might be able to get from the linker regarding what - // code is dead, to be able to add those counters. - // - // On the other hand, if any Rust compiler passes are optimizing out dead code blocks - // we should inject "zero" counters for those code regions. - } + None => false, } } diff --git a/src/doc/unstable-book/src/compiler-flags/source-based-code-coverage.md b/src/doc/unstable-book/src/compiler-flags/source-based-code-coverage.md index 1dd7272e0f92a..9930bc67cd5d2 100644 --- a/src/doc/unstable-book/src/compiler-flags/source-based-code-coverage.md +++ b/src/doc/unstable-book/src/compiler-flags/source-based-code-coverage.md @@ -1,8 +1,6 @@ # `source-based-code-coverage` -The feature request for this feature is: [#34701] - -The Major Change Proposal (MCP) for this feature is: [#278](https://github.com/rust-lang/compiler-team/issues/278) +The tracking issue for this feature is: [#79121]. ------------------------ @@ -10,7 +8,7 @@ The Major Change Proposal (MCP) for this feature is: [#278](https://github.com/r The Rust compiler includes two code coverage implementations: -* A GCC-compatible, gcov-based coverage implementation, enabled with [`-Zprofile`](profile.md), which operates on DebugInfo. +* A GCC-compatible, gcov-based coverage implementation, enabled with [`-Zprofile`], which operates on DebugInfo. * A source-based code coverage implementation, enabled with `-Zinstrument-coverage`, which uses LLVM's native coverage instrumentation to generate very precise coverage data. This document describes how to enable and use the LLVM instrumentation-based coverage, via the `-Zinstrument-coverage` compiler flag. @@ -20,7 +18,7 @@ This document describes how to enable and use the LLVM instrumentation-based cov When `-Zinstrument-coverage` is enabled, the Rust compiler enhances rust-based libraries and binaries by: * Automatically injecting calls to an LLVM intrinsic ([`llvm.instrprof.increment`]), at functions and branches in compiled code, to increment counters when conditional sections of code are executed. -* Embedding additional information in the data section of each library and binary (using the [LLVM Code Coverage Mapping Format]), to define the code regions (start and end positions in the source code) being counted. +* Embedding additional information in the data section of each library and binary (using the [LLVM Code Coverage Mapping Format] _Version 4_, supported _only_ in LLVM 11 and up), to define the code regions (start and end positions in the source code) being counted. When running a coverage-instrumented program, the counter values are written to a `profraw` file at program termination. LLVM bundles tools that read the counter results, combine those results with the coverage map (embedded in the program binary), and generate coverage reports in multiple formats. @@ -30,7 +28,7 @@ Rust's source-based code coverage requires the Rust "profiler runtime". Without The Rust `nightly` distribution channel should include the profiler runtime, by default. -*IMPORTANT:* If you are building the Rust compiler from the source distribution, the profiler runtime is *not* enabled in the default `config.toml.example`, and may not be enabled in your `config.toml`. Edit the `config.toml` file, and find the `profiler` feature entry. Uncomment it and set it to `true`: +*IMPORTANT:* If you are building the Rust compiler from the source distribution, the profiler runtime is *not* enabled in the default `config.toml.example`. Edit your `config.toml` file and ensure the `profiler` feature is set it to `true`: ```toml # Build the profiler runtime (required when compiling with options that depend @@ -38,13 +36,13 @@ The Rust `nightly` distribution channel should include the profiler runtime, by profiler = true ``` -Then rebuild the Rust compiler (see [rustc-dev-guide-how-to-build-and-run]). +If changed, rebuild the Rust compiler (see [rustc-dev-guide-how-to-build-and-run]). ### Building the demangler LLVM coverage reporting tools generate results that can include function names and other symbol references, and the raw coverage results report symbols using the compiler's "mangled" version of the symbol names, which can be difficult to interpret. To work around this issue, LLVM coverage tools also support a user-specified symbol name demangler. -One option for a Rust demangler is [`rustfilt`](https://crates.io/crates/rustfilt), which can be installed with: +One option for a Rust demangler is [`rustfilt`], which can be installed with: ```shell cargo install rustfilt @@ -70,7 +68,7 @@ $ cargo clean $ RUSTFLAGS="-Zinstrument-coverage" cargo build ``` -If `cargo` is not configured to use your `profiler`-enabled version of `rustc`, set the path explicitly via the `RUSTC` environment variable. Here is another example, using a `stage1` build of `rustc` to compile an `example` binary (from the [`json5format`](https://crates.io/crates/json5format) crate): +If `cargo` is not configured to use your `profiler`-enabled version of `rustc`, set the path explicitly via the `RUSTC` environment variable. Here is another example, using a `stage1` build of `rustc` to compile an `example` binary (from the [`json5format`] crate): ```shell $ RUSTC=$HOME/rust/build/x86_64-unknown-linux-gnu/stage1/bin/rustc \ @@ -78,6 +76,8 @@ $ RUSTC=$HOME/rust/build/x86_64-unknown-linux-gnu/stage1/bin/rustc \ cargo build --example formatjson5 ``` +Note that some compiler options, combined with `-Zinstrument-coverage`, can produce LLVM IR and/or linked binaries that are incompatible with LLVM coverage maps. For example, coverage requires references to actual functions in LLVM IR. If any covered function is optimized out, the coverage tools may not be able to process the coverage results. If you need to pass additional options, with coverage enabled, test them early, to confirm you will get the coverage results you expect. + ## Running the instrumented binary to generate raw coverage profiling data In the previous example, `cargo` generated the coverage-instrumented binary `formatjson5`: @@ -110,19 +110,31 @@ If `LLVM_PROFILE_FILE` contains a path to a non-existent directory, the missing * `%Nm` - the instrumented binary’s signature: The runtime creates a pool of N raw profiles, used for on-line profile merging. The runtime takes care of selecting a raw profile from the pool, locking it, and updating it before the program exits. `N` must be between `1` and `9`, and defaults to `1` if omitted (with simply `%m`). * `%c` - Does not add anything to the filename, but enables a mode (on some platforms, including Darwin) in which profile counter updates are continuously synced to a file. This means that if the instrumented program crashes, or is killed by a signal, perfect coverage information can still be recovered. -## Creating coverage reports +## Installing LLVM coverage tools + +LLVM's supplies two tools—`llvm-profdata` and `llvm-cov`—that process coverage data and generate reports. There are several ways to find and/or install these tools, but note that the coverage mapping data generated by the Rust compiler requires LLVM version 11 or higher. (`llvm-cov --version` typically shows the tool's LLVM version number.): -LLVM's tools to process coverage data and coverage maps have some version dependencies. If you encounter a version mismatch, try updating your LLVM tools. +* The LLVM tools may be installed (or installable) directly to your OS (such as via `apt-get`, for Linux). +* If you are building the Rust compiler from source, you can optionally use the bundled LLVM tools, built from source. Those tool binaries can typically be found in your build platform directory at something like: `rust/build/x86_64-unknown-linux-gnu/llvm/bin/llvm-*`. +* You can install compatible versions of these tools via `rustup`. + +The `rustup` option is guaranteed to install a compatible version of the LLVM tools, but they can be hard to find. We recommend [`cargo-bintools`], which installs Rust-specific wrappers around these and other LLVM tools, so you can invoke them via `cargo` commands! + +```shell +$ rustup component add llvm-tools-preview +$ cargo install cargo-binutils +$ cargo profdata -- --help # note the additional "--" preceeding the tool-specific arguments +``` -If you are building the Rust compiler from source, you can optionally use the bundled LLVM tools, built from source. Those tool binaries can typically be found in your build platform directory at something like: `rust/build/x86_64-unknown-linux-gnu/llvm/bin/llvm-*`. (Look for `llvm-profdata` and `llvm-cov`.) +## Creating coverage reports -Raw profiles have to be indexed before they can be used to generate coverage reports. This is done using [`llvm-profdata merge`] (which can combine multiple raw profiles and index them at the same time): +Raw profiles have to be indexed before they can be used to generate coverage reports. This is done using [`llvm-profdata merge`] (or `cargo cov -- merge`), which can combine multiple raw profiles and index them at the same time: ```shell $ llvm-profdata merge -sparse formatjson5.profraw -o formatjson5.profdata ``` -Finally, the `.profdata` file is used, in combination with the coverage map (from the program binary) to generate coverage reports using [`llvm-cov report`]--for a coverage summaries--and [`llvm-cov show`]--to see detailed coverage of lines and regions (character ranges), overlaid on the original source code. +Finally, the `.profdata` file is used, in combination with the coverage map (from the program binary) to generate coverage reports using [`llvm-cov report`] (or `cargo cov -- report`), for a coverage summaries; and [`llvm-cov show`] (or `cargo cov -- show`), to see detailed coverage of lines and regions (character ranges) overlaid on the original source code. These commands have several display and filtering options. For example: @@ -156,14 +168,77 @@ There are four statistics tracked in a coverage summary: Of these four statistics, function coverage is usually the least granular while region coverage is the most granular. The project-wide totals for each statistic are listed in the summary. +## Test coverage + +A typical use case for coverage analysis is test coverage. Rust's source-based coverage tools can both measure your tests' code coverage as percentage, and pinpoint functions and branches not tested. + +The following example (using the [`json5format`] crate, for demonstration purposes) show how to generate and analyze coverage results for all tests in a crate. + +Since `cargo test` both builds and runs the tests, we set both the additional `RUSTFLAGS`, to add the `-Zinstrument-coverage` flag, and `LLVM_PROFILE_FILE`, to set a custom filename for the raw profiling data generated during the test runs. Since there may be more than one test binary, apply `%m` in the filename pattern. This generates unique names for each test binary. (Otherwise, each executed test binary would overwrite the coverage results from the previous binary.) + +```shell +$ RUSTFLAGS="-Zinstrument-coverage" \ + LLVM_PROFILE_FILE="json5format-%m.profraw" \ + cargo test --tests +``` + +Make note of the test binary file paths, displayed after the word "`Running`" in the test output: + +```text + ... + Compiling json5format v0.1.3 ($HOME/json5format) + Finished test [unoptimized + debuginfo] target(s) in 14.60s + + Running target/debug/deps/json5format-fececd4653271682 +running 25 tests +... +test result: ok. 25 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out + + Running target/debug/deps/lib-30768f9c53506dc5 +running 31 tests +... +test result: ok. 31 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out +``` + +You should have one ore more `.profraw` files now, one for each test binary. Run the `profdata` tool to merge them: + +```shell +$ cargo profdata -- merge \ + -sparse json5format-*.profraw -o json5format.profdata +``` + +Then run the `cov` tool, with the `profdata` file and all test binaries: + +```shell +$ cargo cov -- report \ + --use-color --ignore-filename-regex='/.cargo/registry' \ + --instr-profile=json5format.profdata \ + target/debug/deps/lib-30768f9c53506dc5 \ + target/debug/deps/json5format-fececd4653271682 +$ cargo cov -- show \ + --use-color --ignore-filename-regex='/.cargo/registry' \ + --instr-profile=json5format.profdata \ + target/debug/deps/lib-30768f9c53506dc5 \ + target/debug/deps/json5format-fececd4653271682 \ + --show-instantiations --show-line-counts-or-regions \ + --Xdemangler=rustfilt | less -R +``` + +_Note the command line option `--ignore-filename-regex=/.cargo/registry`, which excludes the sources for dependencies from the coverage results._ + ## Other references -Rust's implementation and workflow for source-based code coverage is based on the same library and tools used to implement [source-based code coverage in Clang](https://clang.llvm.org/docs/SourceBasedCodeCoverage.html). (This document is partially based on the Clang guide.) +Rust's implementation and workflow for source-based code coverage is based on the same library and tools used to implement [source-based code coverage in Clang]. (This document is partially based on the Clang guide.) -[#34701]: https://github.com/rust-lang/rust/issues/34701 +[#79121]: https://github.com/rust-lang/rust/issues/79121 +[`-Zprofile`]: profile.md [`llvm.instrprof.increment`]: https://llvm.org/docs/LangRef.html#llvm-instrprof-increment-intrinsic [LLVM Code Coverage Mapping Format]: https://llvm.org/docs/CoverageMappingFormat.html [rustc-dev-guide-how-to-build-and-run]: https://rustc-dev-guide.rust-lang.org/building/how-to-build-and-run.html +[`rustfilt`]: https://crates.io/crates/rustfilt +[`json5format`]: https://crates.io/crates/json5format +[`cargo-bintools`]: https://crates.io/crates/cargo-bintools [`llvm-profdata merge`]: https://llvm.org/docs/CommandGuide/llvm-profdata.html#profdata-merge [`llvm-cov report`]: https://llvm.org/docs/CommandGuide/llvm-cov.html#llvm-cov-report [`llvm-cov show`]: https://llvm.org/docs/CommandGuide/llvm-cov.html#llvm-cov-show +[source-based code coverage in Clang]: https://clang.llvm.org/docs/SourceBasedCodeCoverage.html \ No newline at end of file diff --git a/src/test/mir-opt/const_prop/control_flow_simplification.hello.ConstProp.diff b/src/test/mir-opt/const_prop/control_flow_simplification.hello.ConstProp.diff index 80b7e7ecddab9..0d06c4960b363 100644 --- a/src/test/mir-opt/const_prop/control_flow_simplification.hello.ConstProp.diff +++ b/src/test/mir-opt/const_prop/control_flow_simplification.hello.ConstProp.diff @@ -15,7 +15,7 @@ } bb1: { - _0 = const (); // scope 0 at $DIR/control-flow-simplification.rs:12:5: 14:6 + _0 = const (); // scope 0 at $DIR/control-flow-simplification.rs:14:6: 14:6 StorageDead(_1); // scope 0 at $DIR/control-flow-simplification.rs:15:1: 15:2 return; // scope 0 at $DIR/control-flow-simplification.rs:15:2: 15:2 } diff --git a/src/test/mir-opt/const_prop/control_flow_simplification.hello.PreCodegen.before.mir b/src/test/mir-opt/const_prop/control_flow_simplification.hello.PreCodegen.before.mir index 4898f9deb0cae..c2f75e5daeeb2 100644 --- a/src/test/mir-opt/const_prop/control_flow_simplification.hello.PreCodegen.before.mir +++ b/src/test/mir-opt/const_prop/control_flow_simplification.hello.PreCodegen.before.mir @@ -4,7 +4,7 @@ fn hello() -> () { let mut _0: (); // return place in scope 0 at $DIR/control-flow-simplification.rs:11:14: 11:14 bb0: { - _0 = const (); // scope 0 at $DIR/control-flow-simplification.rs:12:5: 14:6 + _0 = const (); // scope 0 at $DIR/control-flow-simplification.rs:14:6: 14:6 return; // scope 0 at $DIR/control-flow-simplification.rs:15:2: 15:2 } } diff --git a/src/test/mir-opt/coverage_graphviz.bar.InstrumentCoverage.0.dot b/src/test/mir-opt/coverage_graphviz.bar.InstrumentCoverage.0.dot index efc06bdea57a6..124f2d8b97a00 100644 --- a/src/test/mir-opt/coverage_graphviz.bar.InstrumentCoverage.0.dot +++ b/src/test/mir-opt/coverage_graphviz.bar.InstrumentCoverage.0.dot @@ -2,5 +2,5 @@ digraph Cov_0_4 { graph [fontname="Courier, monospace"]; node [fontname="Courier, monospace"]; edge [fontname="Courier, monospace"]; - bcb0__Cov_0_4 [shape="none", label=<
bcb0
Counter(bcb0) at 19:5-20:2
19:5-19:9: @0[0]: _0 = const true
20:2-20:2: @0.Return: return
bb0: Return
>]; + bcb0__Cov_0_4 [shape="none", label=<
bcb0
Counter(bcb0) at 18:1-20:2
19:5-19:9: @0[0]: _0 = const true
20:2-20:2: @0.Return: return
bb0: Return
>]; } diff --git a/src/test/mir-opt/coverage_graphviz.main.InstrumentCoverage.0.dot b/src/test/mir-opt/coverage_graphviz.main.InstrumentCoverage.0.dot index 5ddd112fe62e6..d88193da4fb19 100644 --- a/src/test/mir-opt/coverage_graphviz.main.InstrumentCoverage.0.dot +++ b/src/test/mir-opt/coverage_graphviz.main.InstrumentCoverage.0.dot @@ -2,9 +2,9 @@ digraph Cov_0_3 { graph [fontname="Courier, monospace"]; node [fontname="Courier, monospace"]; edge [fontname="Courier, monospace"]; - bcb2__Cov_0_3 [shape="none", label=<
bcb2
Expression(bcb0 - bcb1) at 14:6-14:6
14:6-14:6: @4.Goto: goto -> bb0
bb4: Goto
>]; + bcb2__Cov_0_3 [shape="none", label=<
bcb2
Expression(bcb0 - bcb1) at 13:10-13:10
13:10-13:10: @4[0]: _1 = const ()
bb4: Goto
>]; bcb1__Cov_0_3 [shape="none", label=<
bcb1
Counter(bcb1) at 12:13-12:18
12:13-12:18: @5[0]: _0 = const ()
Expression(bcb1 + 0) at 15:2-15:2
15:2-15:2: @5.Return: return
bb3: FalseEdge
bb5: Return
>]; - bcb0__Cov_0_3 [shape="none", label=<
bcb0
Counter(bcb0) at 11:12-11:17
11:12-11:17: @1.Call: _2 = bar() -> [return: bb2, unwind: bb6]
11:12-11:17: @2[0]: FakeRead(ForMatchedPlace, _2)
bb0: FalseUnwind
bb1: Call
bb2: SwitchInt
>]; + bcb0__Cov_0_3 [shape="none", label=<
bcb0
Counter(bcb0) at 9:1-11:17
11:12-11:17: @1.Call: _2 = bar() -> [return: bb2, unwind: bb6]
11:12-11:17: @2[0]: FakeRead(ForMatchedPlace, _2)
bb0: FalseUnwind
bb1: Call
bb2: SwitchInt
>]; bcb2__Cov_0_3 -> bcb0__Cov_0_3 [label=<>]; bcb0__Cov_0_3 -> bcb2__Cov_0_3 [label=]; bcb0__Cov_0_3 -> bcb1__Cov_0_3 [label=]; diff --git a/src/test/mir-opt/inst_combine_deref.do_not_miscompile.InstCombine.diff b/src/test/mir-opt/inst_combine_deref.do_not_miscompile.InstCombine.diff index dac9ec3b443d7..a8b523d06dfc7 100644 --- a/src/test/mir-opt/inst_combine_deref.do_not_miscompile.InstCombine.diff +++ b/src/test/mir-opt/inst_combine_deref.do_not_miscompile.InstCombine.diff @@ -57,7 +57,7 @@ } bb1: { - _7 = const (); // scope 4 at $DIR/inst_combine_deref.rs:60:5: 60:23 + _7 = const (); // scope 4 at $DIR/inst_combine_deref.rs:60:23: 60:23 StorageDead(_8); // scope 4 at $DIR/inst_combine_deref.rs:60:22: 60:23 StorageDead(_7); // scope 4 at $DIR/inst_combine_deref.rs:60:22: 60:23 _0 = const (); // scope 0 at $DIR/inst_combine_deref.rs:54:24: 61:2 diff --git a/src/test/mir-opt/instrument_coverage.bar.InstrumentCoverage.diff b/src/test/mir-opt/instrument_coverage.bar.InstrumentCoverage.diff index 5048359e5c654..112a698309276 100644 --- a/src/test/mir-opt/instrument_coverage.bar.InstrumentCoverage.diff +++ b/src/test/mir-opt/instrument_coverage.bar.InstrumentCoverage.diff @@ -6,7 +6,7 @@ bb0: { _0 = const true; // scope 0 at /the/src/instrument_coverage.rs:20:5: 20:9 -+ Coverage::Counter(1) for /the/src/instrument_coverage.rs:20:5 - 21:2; // scope 0 at /the/src/instrument_coverage.rs:21:2: 21:2 ++ Coverage::Counter(1) for /the/src/instrument_coverage.rs:19:1 - 21:2; // scope 0 at /the/src/instrument_coverage.rs:21:2: 21:2 return; // scope 0 at /the/src/instrument_coverage.rs:21:2: 21:2 } } diff --git a/src/test/mir-opt/instrument_coverage.main.InstrumentCoverage.diff b/src/test/mir-opt/instrument_coverage.main.InstrumentCoverage.diff index c67d0e2ffe656..83dee7efa6db4 100644 --- a/src/test/mir-opt/instrument_coverage.main.InstrumentCoverage.diff +++ b/src/test/mir-opt/instrument_coverage.main.InstrumentCoverage.diff @@ -21,7 +21,7 @@ bb2: { FakeRead(ForMatchedPlace, _2); // scope 0 at /the/src/instrument_coverage.rs:12:12: 12:17 -+ Coverage::Counter(1) for /the/src/instrument_coverage.rs:12:12 - 12:17; // scope 0 at /the/src/instrument_coverage.rs:12:9: 14:10 ++ Coverage::Counter(1) for /the/src/instrument_coverage.rs:10:1 - 12:17; // scope 0 at /the/src/instrument_coverage.rs:12:9: 14:10 switchInt(_2) -> [false: bb4, otherwise: bb3]; // scope 0 at /the/src/instrument_coverage.rs:12:9: 14:10 } @@ -30,9 +30,9 @@ } bb4: { - _1 = const (); // scope 0 at /the/src/instrument_coverage.rs:12:9: 14:10 + _1 = const (); // scope 0 at /the/src/instrument_coverage.rs:14:10: 14:10 StorageDead(_2); // scope 0 at /the/src/instrument_coverage.rs:15:5: 15:6 -+ Coverage::Expression(4294967295) = 1 - 2 for /the/src/instrument_coverage.rs:15:6 - 15:7; // scope 0 at /the/src/instrument_coverage.rs:11:5: 15:6 ++ Coverage::Expression(4294967295) = 1 - 2 for /the/src/instrument_coverage.rs:14:10 - 14:11; // scope 0 at /the/src/instrument_coverage.rs:11:5: 15:6 goto -> bb0; // scope 0 at /the/src/instrument_coverage.rs:11:5: 15:6 } diff --git a/src/test/mir-opt/issue_38669.main.SimplifyCfg-initial.after.mir b/src/test/mir-opt/issue_38669.main.SimplifyCfg-initial.after.mir index 0929ba9d8a266..30036e4034af6 100644 --- a/src/test/mir-opt/issue_38669.main.SimplifyCfg-initial.after.mir +++ b/src/test/mir-opt/issue_38669.main.SimplifyCfg-initial.after.mir @@ -35,7 +35,7 @@ fn main() -> () { } bb4: { - _3 = const (); // scope 1 at $DIR/issue-38669.rs:7:9: 9:10 + _3 = const (); // scope 1 at $DIR/issue-38669.rs:9:10: 9:10 StorageDead(_4); // scope 1 at $DIR/issue-38669.rs:9:9: 9:10 StorageDead(_3); // scope 1 at $DIR/issue-38669.rs:9:9: 9:10 _1 = const true; // scope 1 at $DIR/issue-38669.rs:10:9: 10:28 diff --git a/src/test/mir-opt/issue_41888.main.ElaborateDrops.after.mir b/src/test/mir-opt/issue_41888.main.ElaborateDrops.after.mir index d7b4e073cea4c..453886f3effdf 100644 --- a/src/test/mir-opt/issue_41888.main.ElaborateDrops.after.mir +++ b/src/test/mir-opt/issue_41888.main.ElaborateDrops.after.mir @@ -37,7 +37,7 @@ fn main() -> () { } bb2: { - _0 = const (); // scope 1 at $DIR/issue-41888.rs:8:5: 14:6 + _0 = const (); // scope 1 at $DIR/issue-41888.rs:14:6: 14:6 goto -> bb8; // scope 1 at $DIR/issue-41888.rs:8:5: 14:6 } @@ -61,7 +61,7 @@ fn main() -> () { } bb6: { - _0 = const (); // scope 1 at $DIR/issue-41888.rs:10:9: 13:10 + _0 = const (); // scope 1 at $DIR/issue-41888.rs:13:10: 13:10 goto -> bb8; // scope 1 at $DIR/issue-41888.rs:10:9: 13:10 } diff --git a/src/test/mir-opt/loop_test.main.SimplifyCfg-promote-consts.after.mir b/src/test/mir-opt/loop_test.main.SimplifyCfg-promote-consts.after.mir index 05def56e65eb5..56df50c089318 100644 --- a/src/test/mir-opt/loop_test.main.SimplifyCfg-promote-consts.after.mir +++ b/src/test/mir-opt/loop_test.main.SimplifyCfg-promote-consts.after.mir @@ -25,7 +25,7 @@ fn main() -> () { } bb2: { - _1 = const (); // scope 0 at $DIR/loop_test.rs:10:5: 12:6 + _1 = const (); // scope 0 at $DIR/loop_test.rs:12:6: 12:6 StorageDead(_2); // scope 0 at $DIR/loop_test.rs:12:5: 12:6 StorageDead(_1); // scope 0 at $DIR/loop_test.rs:12:5: 12:6 StorageLive(_4); // scope 0 at $DIR/loop_test.rs:13:5: 16:6 diff --git a/src/test/mir-opt/matches_reduce_branches.foo.MatchBranchSimplification.32bit.diff b/src/test/mir-opt/matches_reduce_branches.foo.MatchBranchSimplification.32bit.diff index ba963e3fe920b..d0b1a96b9aef7 100644 --- a/src/test/mir-opt/matches_reduce_branches.foo.MatchBranchSimplification.32bit.diff +++ b/src/test/mir-opt/matches_reduce_branches.foo.MatchBranchSimplification.32bit.diff @@ -34,7 +34,7 @@ } bb4: { - _0 = const (); // scope 0 at $DIR/matches_reduce_branches.rs:7:5: 9:6 + _0 = const (); // scope 0 at $DIR/matches_reduce_branches.rs:9:6: 9:6 goto -> bb5; // scope 0 at $DIR/matches_reduce_branches.rs:7:5: 9:6 } diff --git a/src/test/mir-opt/matches_reduce_branches.foo.MatchBranchSimplification.64bit.diff b/src/test/mir-opt/matches_reduce_branches.foo.MatchBranchSimplification.64bit.diff index ba963e3fe920b..d0b1a96b9aef7 100644 --- a/src/test/mir-opt/matches_reduce_branches.foo.MatchBranchSimplification.64bit.diff +++ b/src/test/mir-opt/matches_reduce_branches.foo.MatchBranchSimplification.64bit.diff @@ -34,7 +34,7 @@ } bb4: { - _0 = const (); // scope 0 at $DIR/matches_reduce_branches.rs:7:5: 9:6 + _0 = const (); // scope 0 at $DIR/matches_reduce_branches.rs:9:6: 9:6 goto -> bb5; // scope 0 at $DIR/matches_reduce_branches.rs:7:5: 9:6 } diff --git a/src/test/mir-opt/simplify_cfg.main.SimplifyCfg-early-opt.diff b/src/test/mir-opt/simplify_cfg.main.SimplifyCfg-early-opt.diff index 62743057048fb..5588877aec950 100644 --- a/src/test/mir-opt/simplify_cfg.main.SimplifyCfg-early-opt.diff +++ b/src/test/mir-opt/simplify_cfg.main.SimplifyCfg-early-opt.diff @@ -33,7 +33,7 @@ - - bb4: { + bb2: { - _1 = const (); // scope 0 at $DIR/simplify_cfg.rs:7:9: 9:10 + _1 = const (); // scope 0 at $DIR/simplify_cfg.rs:9:10: 9:10 StorageDead(_2); // scope 0 at $DIR/simplify_cfg.rs:10:5: 10:6 goto -> bb0; // scope 0 at $DIR/simplify_cfg.rs:6:5: 10:6 } diff --git a/src/test/mir-opt/simplify_cfg.main.SimplifyCfg-initial.diff b/src/test/mir-opt/simplify_cfg.main.SimplifyCfg-initial.diff index 9a6afc58c4e9d..e62935225d805 100644 --- a/src/test/mir-opt/simplify_cfg.main.SimplifyCfg-initial.diff +++ b/src/test/mir-opt/simplify_cfg.main.SimplifyCfg-initial.diff @@ -40,7 +40,7 @@ - bb5: { + bb4: { - _1 = const (); // scope 0 at $DIR/simplify_cfg.rs:7:9: 9:10 + _1 = const (); // scope 0 at $DIR/simplify_cfg.rs:9:10: 9:10 - goto -> bb9; // scope 0 at $DIR/simplify_cfg.rs:7:9: 9:10 + StorageDead(_2); // scope 0 at $DIR/simplify_cfg.rs:10:5: 10:6 + goto -> bb0; // scope 0 at $DIR/simplify_cfg.rs:6:5: 10:6 diff --git a/src/test/mir-opt/simplify_if.main.SimplifyBranches-after-const-prop.diff b/src/test/mir-opt/simplify_if.main.SimplifyBranches-after-const-prop.diff index aeb319a4904bf..bf3caf505eda1 100644 --- a/src/test/mir-opt/simplify_if.main.SimplifyBranches-after-const-prop.diff +++ b/src/test/mir-opt/simplify_if.main.SimplifyBranches-after-const-prop.diff @@ -14,7 +14,7 @@ } bb1: { - _0 = const (); // scope 0 at $DIR/simplify_if.rs:6:5: 8:6 + _0 = const (); // scope 0 at $DIR/simplify_if.rs:8:6: 8:6 goto -> bb4; // scope 0 at $DIR/simplify_if.rs:6:5: 8:6 } diff --git a/src/test/mir-opt/simplify_locals_fixedpoint.foo.SimplifyLocals.diff b/src/test/mir-opt/simplify_locals_fixedpoint.foo.SimplifyLocals.diff index 45808962bb564..9f7507a5cadb2 100644 --- a/src/test/mir-opt/simplify_locals_fixedpoint.foo.SimplifyLocals.diff +++ b/src/test/mir-opt/simplify_locals_fixedpoint.foo.SimplifyLocals.diff @@ -30,7 +30,7 @@ } bb1: { - _0 = const (); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:5: 8:6 + _0 = const (); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:8:6: 8:6 goto -> bb7; // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:5: 8:6 } @@ -51,7 +51,7 @@ } bb4: { - _0 = const (); // scope 1 at $DIR/simplify-locals-fixedpoint.rs:5:9: 7:10 + _0 = const (); // scope 1 at $DIR/simplify-locals-fixedpoint.rs:7:10: 7:10 goto -> bb6; // scope 1 at $DIR/simplify-locals-fixedpoint.rs:5:9: 7:10 } diff --git a/src/test/mir-opt/unreachable.main.UnreachablePropagation.diff b/src/test/mir-opt/unreachable.main.UnreachablePropagation.diff index 37ff5c6ee3bbd..6f44de1e4a4f5 100644 --- a/src/test/mir-opt/unreachable.main.UnreachablePropagation.diff +++ b/src/test/mir-opt/unreachable.main.UnreachablePropagation.diff @@ -32,7 +32,7 @@ } bb2: { - _0 = const (); // scope 0 at $DIR/unreachable.rs:9:5: 19:6 + _0 = const (); // scope 0 at $DIR/unreachable.rs:19:6: 19:6 StorageDead(_1); // scope 0 at $DIR/unreachable.rs:20:1: 20:2 return; // scope 0 at $DIR/unreachable.rs:20:2: 20:2 - } diff --git a/src/test/mir-opt/unreachable_asm.main.UnreachablePropagation.diff b/src/test/mir-opt/unreachable_asm.main.UnreachablePropagation.diff index 5caacf84ca657..9bca06a3e2b28 100644 --- a/src/test/mir-opt/unreachable_asm.main.UnreachablePropagation.diff +++ b/src/test/mir-opt/unreachable_asm.main.UnreachablePropagation.diff @@ -34,7 +34,7 @@ } bb2: { - _0 = const (); // scope 0 at $DIR/unreachable_asm.rs:11:5: 23:6 + _0 = const (); // scope 0 at $DIR/unreachable_asm.rs:23:6: 23:6 StorageDead(_1); // scope 0 at $DIR/unreachable_asm.rs:24:1: 24:2 return; // scope 0 at $DIR/unreachable_asm.rs:24:2: 24:2 } diff --git a/src/test/mir-opt/unreachable_asm_2.main.UnreachablePropagation.diff b/src/test/mir-opt/unreachable_asm_2.main.UnreachablePropagation.diff index 07ed81b35f53d..cbc24eab0f568 100644 --- a/src/test/mir-opt/unreachable_asm_2.main.UnreachablePropagation.diff +++ b/src/test/mir-opt/unreachable_asm_2.main.UnreachablePropagation.diff @@ -37,7 +37,7 @@ } bb2: { - _0 = const (); // scope 0 at $DIR/unreachable_asm_2.rs:11:5: 25:6 + _0 = const (); // scope 0 at $DIR/unreachable_asm_2.rs:25:6: 25:6 StorageDead(_1); // scope 0 at $DIR/unreachable_asm_2.rs:26:1: 26:2 return; // scope 0 at $DIR/unreachable_asm_2.rs:26:2: 26:2 } diff --git a/src/test/mir-opt/unreachable_diverging.main.UnreachablePropagation.diff b/src/test/mir-opt/unreachable_diverging.main.UnreachablePropagation.diff index c809483d8c2c4..fd8286f1c4f39 100644 --- a/src/test/mir-opt/unreachable_diverging.main.UnreachablePropagation.diff +++ b/src/test/mir-opt/unreachable_diverging.main.UnreachablePropagation.diff @@ -33,7 +33,7 @@ } bb2: { - _0 = const (); // scope 1 at $DIR/unreachable_diverging.rs:14:5: 19:6 + _0 = const (); // scope 1 at $DIR/unreachable_diverging.rs:19:6: 19:6 StorageDead(_1); // scope 0 at $DIR/unreachable_diverging.rs:20:1: 20:2 StorageDead(_2); // scope 0 at $DIR/unreachable_diverging.rs:20:1: 20:2 return; // scope 0 at $DIR/unreachable_diverging.rs:20:2: 20:2 @@ -50,7 +50,7 @@ } bb4: { -- _5 = const (); // scope 2 at $DIR/unreachable_diverging.rs:15:9: 17:10 +- _5 = const (); // scope 2 at $DIR/unreachable_diverging.rs:17:10: 17:10 - goto -> bb6; // scope 2 at $DIR/unreachable_diverging.rs:15:9: 17:10 - } - diff --git a/src/test/run-make-fulldeps/coverage-llvmir-deadcode/Makefile b/src/test/run-make-fulldeps/coverage-llvmir-deadcode/Makefile deleted file mode 100644 index 30c7c0fbb5133..0000000000000 --- a/src/test/run-make-fulldeps/coverage-llvmir-deadcode/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -# needs-profiler-support -# ignore-msvc - -# LINK_DEAD_CODE requires ignore-msvc due to Issue #76038 -LINK_DEAD_CODE=yes - --include ../coverage-llvmir-base/Makefile - -# ISSUE(76038): When targeting MSVC, Rust binaries built with both `-Z instrument-coverage` and -# `-C link-dead-code` typically crash (with a seg-fault) or at best generate an empty `*.profraw`. -# See ../coverage/coverage_tools.mk for more information. diff --git a/src/test/run-make-fulldeps/coverage-llvmir-base/Makefile b/src/test/run-make-fulldeps/coverage-llvmir/Makefile similarity index 72% rename from src/test/run-make-fulldeps/coverage-llvmir-base/Makefile rename to src/test/run-make-fulldeps/coverage-llvmir/Makefile index 219ba15ad116d..54fc3d168645f 100644 --- a/src/test/run-make-fulldeps/coverage-llvmir-base/Makefile +++ b/src/test/run-make-fulldeps/coverage-llvmir/Makefile @@ -1,12 +1,8 @@ # needs-profiler-support -# ISSUE(76038): When targeting MSVC, Rust binaries built with both `-Z instrument-coverage` and -# `-C link-dead-code` typically crash (with a seg-fault) or at best generate an empty `*.profraw`. -# See ../coverage/coverage_tools.mk for more information. - -include ../coverage/coverage_tools.mk -BASEDIR=../coverage-llvmir-base +BASEDIR=../coverage-llvmir ifeq ($(UNAME),Darwin) INSTR_PROF_DATA_SUFFIX=,regular,live_support @@ -20,11 +16,7 @@ else COMDAT_IF_SUPPORTED=, comdat endif -ifeq ($(LINK_DEAD_CODE),yes) - DEFINE_INTERNAL=define hidden -else - DEFINE_INTERNAL=define internal -endif +DEFINE_INTERNAL=define internal ifdef IS_WINDOWS LLVM_FILECHECK_OPTIONS=\ @@ -65,14 +57,8 @@ endif test_llvm_ir: # Compile the test program with non-experimental coverage instrumentation, and generate LLVM IR - # - # Note: `-Clink-dead-code=no` disables the option, needed because the option is automatically - # enabled for some platforms, but not for Windows MSVC (due to Issue #76038). The state of this - # option affects the generated MIR and coverage, so it is enabled for tests to ensure the - # tests results are the same across platforms. $(RUSTC) $(BASEDIR)/testprog.rs \ -Zinstrument-coverage \ - -Clink-dead-code=$(LINK_DEAD_CODE) \ --emit=llvm-ir cat "$(TMPDIR)"/testprog.ll | \ diff --git a/src/test/run-make-fulldeps/coverage-llvmir-base/filecheck.testprog.txt b/src/test/run-make-fulldeps/coverage-llvmir/filecheck.testprog.txt similarity index 100% rename from src/test/run-make-fulldeps/coverage-llvmir-base/filecheck.testprog.txt rename to src/test/run-make-fulldeps/coverage-llvmir/filecheck.testprog.txt diff --git a/src/test/run-make-fulldeps/coverage-llvmir-base/testprog.rs b/src/test/run-make-fulldeps/coverage-llvmir/testprog.rs similarity index 100% rename from src/test/run-make-fulldeps/coverage-llvmir-base/testprog.rs rename to src/test/run-make-fulldeps/coverage-llvmir/testprog.rs diff --git a/src/test/run-make-fulldeps/coverage-reports-base/expected_export_coverage.closure.json b/src/test/run-make-fulldeps/coverage-reports-base/expected_export_coverage.closure.json deleted file mode 100644 index bff55300b3ca3..0000000000000 --- a/src/test/run-make-fulldeps/coverage-reports-base/expected_export_coverage.closure.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "data": [ - { - "files": [ - { - "filename": "../coverage/closure.rs", - "summary": { - "functions": { - "count": 5, - "covered": 3, - "percent": 60 - }, - "instantiations": { - "count": 5, - "covered": 3, - "percent": 60 - }, - "lines": { - "count": 91, - "covered": 77, - "percent": 84.61538461538461 - }, - "regions": { - "count": 25, - "covered": 13, - "notcovered": 12, - "percent": 52 - } - } - } - ], - "totals": { - "functions": { - "count": 5, - "covered": 3, - "percent": 60 - }, - "instantiations": { - "count": 5, - "covered": 3, - "percent": 60 - }, - "lines": { - "count": 91, - "covered": 77, - "percent": 84.61538461538461 - }, - "regions": { - "count": 25, - "covered": 13, - "notcovered": 12, - "percent": 52 - } - } - } - ], - "type": "llvm.coverage.json.export", - "version": "2.0.1" -} diff --git a/src/test/run-make-fulldeps/coverage-reports-base/expected_export_coverage.if.json b/src/test/run-make-fulldeps/coverage-reports-base/expected_export_coverage.if.json deleted file mode 100644 index 84dcc251f3f4b..0000000000000 --- a/src/test/run-make-fulldeps/coverage-reports-base/expected_export_coverage.if.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "data": [ - { - "files": [ - { - "filename": "../coverage/if.rs", - "summary": { - "functions": { - "count": 1, - "covered": 1, - "percent": 100 - }, - "instantiations": { - "count": 1, - "covered": 1, - "percent": 100 - }, - "lines": { - "count": 19, - "covered": 19, - "percent": 100 - }, - "regions": { - "count": 5, - "covered": 4, - "notcovered": 1, - "percent": 80 - } - } - } - ], - "totals": { - "functions": { - "count": 1, - "covered": 1, - "percent": 100 - }, - "instantiations": { - "count": 1, - "covered": 1, - "percent": 100 - }, - "lines": { - "count": 19, - "covered": 19, - "percent": 100 - }, - "regions": { - "count": 5, - "covered": 4, - "notcovered": 1, - "percent": 80 - } - } - } - ], - "type": "llvm.coverage.json.export", - "version": "2.0.1" -} diff --git a/src/test/run-make-fulldeps/coverage-reports-base/expected_export_coverage.if_else.json b/src/test/run-make-fulldeps/coverage-reports-base/expected_export_coverage.if_else.json deleted file mode 100644 index 36f81ceae19bf..0000000000000 --- a/src/test/run-make-fulldeps/coverage-reports-base/expected_export_coverage.if_else.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "data": [ - { - "files": [ - { - "filename": "../coverage/if_else.rs", - "summary": { - "functions": { - "count": 1, - "covered": 1, - "percent": 100 - }, - "instantiations": { - "count": 1, - "covered": 1, - "percent": 100 - }, - "lines": { - "count": 28, - "covered": 19, - "percent": 67.85714285714286 - }, - "regions": { - "count": 7, - "covered": 5, - "notcovered": 2, - "percent": 71.42857142857143 - } - } - } - ], - "totals": { - "functions": { - "count": 1, - "covered": 1, - "percent": 100 - }, - "instantiations": { - "count": 1, - "covered": 1, - "percent": 100 - }, - "lines": { - "count": 28, - "covered": 19, - "percent": 67.85714285714286 - }, - "regions": { - "count": 7, - "covered": 5, - "notcovered": 2, - "percent": 71.42857142857143 - } - } - } - ], - "type": "llvm.coverage.json.export", - "version": "2.0.1" -} diff --git a/src/test/run-make-fulldeps/coverage-reports-base/expected_export_coverage.lazy_boolean.json b/src/test/run-make-fulldeps/coverage-reports-base/expected_export_coverage.lazy_boolean.json deleted file mode 100644 index 5a953b90b423f..0000000000000 --- a/src/test/run-make-fulldeps/coverage-reports-base/expected_export_coverage.lazy_boolean.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "data": [ - { - "files": [ - { - "filename": "../coverage/lazy_boolean.rs", - "summary": { - "functions": { - "count": 1, - "covered": 1, - "percent": 100 - }, - "instantiations": { - "count": 1, - "covered": 1, - "percent": 100 - }, - "lines": { - "count": 40, - "covered": 30, - "percent": 75 - }, - "regions": { - "count": 37, - "covered": 26, - "notcovered": 11, - "percent": 70.27027027027027 - } - } - } - ], - "totals": { - "functions": { - "count": 1, - "covered": 1, - "percent": 100 - }, - "instantiations": { - "count": 1, - "covered": 1, - "percent": 100 - }, - "lines": { - "count": 40, - "covered": 30, - "percent": 75 - }, - "regions": { - "count": 37, - "covered": 26, - "notcovered": 11, - "percent": 70.27027027027027 - } - } - } - ], - "type": "llvm.coverage.json.export", - "version": "2.0.1" -} diff --git a/src/test/run-make-fulldeps/coverage-reports-base/expected_export_coverage.nested_loops.json b/src/test/run-make-fulldeps/coverage-reports-base/expected_export_coverage.nested_loops.json deleted file mode 100644 index 68163eb763619..0000000000000 --- a/src/test/run-make-fulldeps/coverage-reports-base/expected_export_coverage.nested_loops.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "data": [ - { - "files": [ - { - "filename": "../coverage/nested_loops.rs", - "summary": { - "functions": { - "count": 1, - "covered": 1, - "percent": 100 - }, - "instantiations": { - "count": 1, - "covered": 1, - "percent": 100 - }, - "lines": { - "count": 21, - "covered": 16, - "percent": 76.19047619047619 - }, - "regions": { - "count": 18, - "covered": 14, - "notcovered": 4, - "percent": 77.77777777777779 - } - } - } - ], - "totals": { - "functions": { - "count": 1, - "covered": 1, - "percent": 100 - }, - "instantiations": { - "count": 1, - "covered": 1, - "percent": 100 - }, - "lines": { - "count": 21, - "covered": 16, - "percent": 76.19047619047619 - }, - "regions": { - "count": 18, - "covered": 14, - "notcovered": 4, - "percent": 77.77777777777779 - } - } - } - ], - "type": "llvm.coverage.json.export", - "version": "2.0.1" -} diff --git a/src/test/run-make-fulldeps/coverage-reports-base/expected_export_coverage.simple_match.json b/src/test/run-make-fulldeps/coverage-reports-base/expected_export_coverage.simple_match.json deleted file mode 100644 index 63d1ae74c5f5d..0000000000000 --- a/src/test/run-make-fulldeps/coverage-reports-base/expected_export_coverage.simple_match.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "data": [ - { - "files": [ - { - "filename": "../coverage/simple_match.rs", - "summary": { - "functions": { - "count": 1, - "covered": 1, - "percent": 100 - }, - "instantiations": { - "count": 1, - "covered": 1, - "percent": 100 - }, - "lines": { - "count": 24, - "covered": 24, - "percent": 100 - }, - "regions": { - "count": 15, - "covered": 14, - "notcovered": 1, - "percent": 93.33333333333333 - } - } - } - ], - "totals": { - "functions": { - "count": 1, - "covered": 1, - "percent": 100 - }, - "instantiations": { - "count": 1, - "covered": 1, - "percent": 100 - }, - "lines": { - "count": 24, - "covered": 24, - "percent": 100 - }, - "regions": { - "count": 15, - "covered": 14, - "notcovered": 1, - "percent": 93.33333333333333 - } - } - } - ], - "type": "llvm.coverage.json.export", - "version": "2.0.1" -} diff --git a/src/test/run-make-fulldeps/coverage-reports-base/expected_export_coverage.while_early_ret.json b/src/test/run-make-fulldeps/coverage-reports-base/expected_export_coverage.while_early_ret.json deleted file mode 100644 index ad43f5d992630..0000000000000 --- a/src/test/run-make-fulldeps/coverage-reports-base/expected_export_coverage.while_early_ret.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "data": [ - { - "files": [ - { - "filename": "../coverage/while_early_ret.rs", - "summary": { - "functions": { - "count": 1, - "covered": 1, - "percent": 100 - }, - "instantiations": { - "count": 1, - "covered": 1, - "percent": 100 - }, - "lines": { - "count": 17, - "covered": 15, - "percent": 88.23529411764706 - }, - "regions": { - "count": 9, - "covered": 7, - "notcovered": 2, - "percent": 77.77777777777779 - } - } - } - ], - "totals": { - "functions": { - "count": 1, - "covered": 1, - "percent": 100 - }, - "instantiations": { - "count": 1, - "covered": 1, - "percent": 100 - }, - "lines": { - "count": 17, - "covered": 15, - "percent": 88.23529411764706 - }, - "regions": { - "count": 9, - "covered": 7, - "notcovered": 2, - "percent": 77.77777777777779 - } - } - } - ], - "type": "llvm.coverage.json.export", - "version": "2.0.1" -} diff --git a/src/test/run-make-fulldeps/coverage-reports-base/expected_show_coverage.conditions.txt b/src/test/run-make-fulldeps/coverage-reports-base/expected_show_coverage.conditions.txt deleted file mode 100644 index 173ff4aa4c481..0000000000000 --- a/src/test/run-make-fulldeps/coverage-reports-base/expected_show_coverage.conditions.txt +++ /dev/null @@ -1,69 +0,0 @@ - 1| |#![allow(unused_assignments, unused_variables)] - 2| | - 3| |fn main() { - 4| 1| let mut countdown = 0; - 5| 1| if true { - 6| 1| countdown = 10; - 7| 1| } - 8| | - 9| | const B: u32 = 100; - 10| 1| let x = if countdown > 7 { - 11| 1| countdown -= 4; - 12| 1| B - 13| 0| } else if countdown > 2 { - 14| 0| if countdown < 1 || countdown > 5 || countdown != 9 { - 15| 0| countdown = 0; - 16| 0| } - 17| 0| countdown -= 5; - 18| 0| countdown - 19| | } else { - 20| 0| return; - 21| | }; - 22| | - 23| 1| let mut countdown = 0; - 24| 1| if true { - 25| 1| countdown = 10; - 26| 1| } - 27| | - 28| 1| if countdown > 7 { - 29| 1| countdown -= 4; - 30| 0| } else if countdown > 2 { - 31| 0| if countdown < 1 || countdown > 5 || countdown != 9 { - 32| 0| countdown = 0; - 33| 0| } - 34| 0| countdown -= 5; - 35| | } else { - 36| 0| return; - 37| | } - 38| | - 39| 1| let mut countdown = 0; - 40| 1| if true { - 41| 1| countdown = 1; - 42| 1| } - 43| | - 44| 1| let z = if countdown > 7 { - ^0 - 45| 0| countdown -= 4; - 46| 1| } else if countdown > 2 { - 47| 0| if countdown < 1 || countdown > 5 || countdown != 9 { - 48| 0| countdown = 0; - 49| 0| } - 50| 0| countdown -= 5; - 51| | } else { - 52| 1| let should_be_reachable = countdown; - 53| 1| println!("reached"); - 54| 1| return; - 55| | }; - 56| | - 57| 0| let w = if countdown > 7 { - 58| 0| countdown -= 4; - 59| 0| } else if countdown > 2 { - 60| 0| if countdown < 1 || countdown > 5 || countdown != 9 { - 61| 0| countdown = 0; - 62| 0| } - 63| 0| countdown -= 5; - 64| | } else { - 65| 0| return; - 66| | }; - 67| 1|} - diff --git a/src/test/run-make-fulldeps/coverage-reports-base/expected_show_coverage.generics.txt b/src/test/run-make-fulldeps/coverage-reports-base/expected_show_coverage.generics.txt deleted file mode 100644 index 86199d7476302..0000000000000 --- a/src/test/run-make-fulldeps/coverage-reports-base/expected_show_coverage.generics.txt +++ /dev/null @@ -1,67 +0,0 @@ - 1| |#![allow(unused_assignments)] - 2| |// expect-exit-status-1 - 3| | - 4| |struct Firework where T: Copy + std::fmt::Display { - 5| | strength: T, - 6| |} - 7| | - 8| |impl Firework where T: Copy + std::fmt::Display { - 9| | #[inline(always)] - 10| 3| fn set_strength(&mut self, new_strength: T) { - 11| 3| self.strength = new_strength; - 12| 3| } - ------------------ - | >::set_strength: - | 10| 2| fn set_strength(&mut self, new_strength: T) { - | 11| 2| self.strength = new_strength; - | 12| 2| } - ------------------ - | >::set_strength: - | 10| 1| fn set_strength(&mut self, new_strength: T) { - | 11| 1| self.strength = new_strength; - | 12| 1| } - ------------------ - 13| |} - 14| | - 15| |impl Drop for Firework where T: Copy + std::fmt::Display { - 16| | #[inline(always)] - 17| 2| fn drop(&mut self) { - 18| 2| println!("BOOM times {}!!!", self.strength); - 19| 2| } - ------------------ - | as core::ops::drop::Drop>::drop: - | 17| 1| fn drop(&mut self) { - | 18| 1| println!("BOOM times {}!!!", self.strength); - | 19| 1| } - ------------------ - | as core::ops::drop::Drop>::drop: - | 17| 1| fn drop(&mut self) { - | 18| 1| println!("BOOM times {}!!!", self.strength); - | 19| 1| } - ------------------ - 20| |} - 21| | - 22| |fn main() -> Result<(),u8> { - 23| 1| let mut firecracker = Firework { strength: 1 }; - 24| 1| firecracker.set_strength(2); - 25| 1| - 26| 1| let mut tnt = Firework { strength: 100.1 }; - 27| 1| tnt.set_strength(200.1); - 28| 1| tnt.set_strength(300.3); - 29| | - 30| 1| if true { - 31| 1| println!("Exiting with error..."); - 32| 1| return Err(1); - 33| | } - 34| | - 35| | let _ = Firework { strength: 1000 }; - 36| | - 37| | Ok(()) - 38| 1|} - 39| | - 40| |// Expected program output: - 41| |// Exiting with error... - 42| |// BOOM times 100!!! - 43| |// BOOM times 1!!! - 44| |// Error: 1 - diff --git a/src/test/run-make-fulldeps/coverage-reports-base/expected_show_coverage.if_else.txt b/src/test/run-make-fulldeps/coverage-reports-base/expected_show_coverage.if_else.txt deleted file mode 100644 index 5f899723e2554..0000000000000 --- a/src/test/run-make-fulldeps/coverage-reports-base/expected_show_coverage.if_else.txt +++ /dev/null @@ -1,41 +0,0 @@ - 1| |#![allow(unused_assignments)] - 2| | - 3| |fn main() { - 4| | // Initialize test constants in a way that cannot be determined at compile time, to ensure - 5| | // rustc and LLVM cannot optimize out statements (or coverage counters) downstream from - 6| | // dependent conditions. - 7| 1| let is_true = std::env::args().len() == 1; - 8| 1| - 9| 1| let mut countdown = 0; - 10| 1| if - 11| 1| is_true - 12| 1| { - 13| 1| countdown - 14| 1| = - 15| 1| 10 - 16| 1| ; - 17| 1| } - 18| | else // Note coverage region difference without semicolon - 19| | { - 20| 0| countdown - 21| 0| = - 22| 0| 100 - 23| | } - 24| | - 25| | if - 26| 1| is_true - 27| 1| { - 28| 1| countdown - 29| 1| = - 30| 1| 10 - 31| 1| ; - 32| 1| } - 33| | else - 34| 0| { - 35| 0| countdown - 36| 0| = - 37| 0| 100 - 38| 0| ; - 39| 0| } - 40| 1|} - diff --git a/src/test/run-make-fulldeps/coverage-reports-base/expected_show_coverage.inner_items.txt b/src/test/run-make-fulldeps/coverage-reports-base/expected_show_coverage.inner_items.txt deleted file mode 100644 index 4a51f842a4bb2..0000000000000 --- a/src/test/run-make-fulldeps/coverage-reports-base/expected_show_coverage.inner_items.txt +++ /dev/null @@ -1,60 +0,0 @@ - 1| |#![allow(unused_assignments, unused_variables)] - 2| | - 3| |fn main() { - 4| | // Initialize test constants in a way that cannot be determined at compile time, to ensure - 5| | // rustc and LLVM cannot optimize out statements (or coverage counters) downstream from - 6| | // dependent conditions. - 7| 1| let is_true = std::env::args().len() == 1; - 8| 1| - 9| 1| let mut countdown = 0; - 10| 1| if is_true { - 11| 1| countdown = 10; - 12| 1| } - ^0 - 13| | - 14| | mod in_mod { - 15| | const IN_MOD_CONST: u32 = 1000; - 16| | } - 17| | - 18| | fn in_func(a: u32) { - 19| 3| let b = 1; - 20| 3| let c = a + b; - 21| 3| println!("c = {}", c) - 22| 3| } - 23| | - 24| | struct InStruct { - 25| | in_struct_field: u32, - 26| | } - 27| | - 28| | const IN_CONST: u32 = 1234; - 29| | - 30| | trait InTrait { - 31| | fn trait_func(&mut self, incr: u32); - 32| | - 33| 1| fn default_trait_func(&mut self) { - 34| 1| in_func(IN_CONST); - 35| 1| self.trait_func(IN_CONST); - 36| 1| } - 37| | } - 38| | - 39| | impl InTrait for InStruct { - 40| | fn trait_func(&mut self, incr: u32) { - 41| 1| self.in_struct_field += incr; - 42| 1| in_func(self.in_struct_field); - 43| 1| } - 44| | } - 45| | - 46| | type InType = String; - 47| | - 48| 1| if is_true { - 49| 1| in_func(countdown); - 50| 1| } - ^0 - 51| | - 52| 1| let mut val = InStruct { - 53| 1| in_struct_field: 101, - 54| 1| }; - 55| 1| - 56| 1| val.default_trait_func(); - 57| 1|} - diff --git a/src/test/run-make-fulldeps/coverage-reports-base/expected_show_coverage.nested_loops.txt b/src/test/run-make-fulldeps/coverage-reports-base/expected_show_coverage.nested_loops.txt deleted file mode 100644 index c9f373bf6a7c0..0000000000000 --- a/src/test/run-make-fulldeps/coverage-reports-base/expected_show_coverage.nested_loops.txt +++ /dev/null @@ -1,26 +0,0 @@ - 1| |fn main() { - 2| 1| let is_true = std::env::args().len() == 1; - 3| 1| let mut countdown = 10; - 4| | - 5| 1| 'outer: while countdown > 0 { - 6| 1| let mut a = 100; - 7| 1| let mut b = 100; - 8| 3| for _ in 0..50 { - 9| 3| if a < 30 { - 10| 0| break; - 11| | } - 12| 3| a -= 5; - 13| 3| b -= 5; - 14| 3| if b < 90 { - 15| 1| a -= 10; - 16| 1| if is_true { - 17| 1| break 'outer; - 18| | } else { - 19| 0| a -= 2; - 20| 0| } - 21| 2| } - 22| 2| } - 23| 0| countdown -= 1; - 24| 0| } - 25| 1|} - diff --git a/src/test/run-make-fulldeps/coverage-reports-base/expected_show_coverage.partial_eq.txt b/src/test/run-make-fulldeps/coverage-reports-base/expected_show_coverage.partial_eq.txt deleted file mode 100644 index 310bf13a695af..0000000000000 --- a/src/test/run-make-fulldeps/coverage-reports-base/expected_show_coverage.partial_eq.txt +++ /dev/null @@ -1,101 +0,0 @@ - 1| |// This test confirms an earlier problem was resolved, supporting the MIR graph generated by the - 2| |// structure of this test. - 3| | - 4| 2|#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)] - ^1 ^1 - 5| |pub struct Version { - 6| | major: usize, - 7| 1| minor: usize, - 8| | patch: usize, - 9| |} - 10| | - 11| |impl Version { - 12| | pub fn new(major: usize, minor: usize, patch: usize) -> Self { - 13| 2| Self { - 14| 2| major, - 15| 2| minor, - 16| 2| patch, - 17| 2| } - 18| 2| } - 19| |} - 20| | - 21| 1|fn main() { - 22| 1| let version_3_2_1 = Version::new(3, 2, 1); - 23| 1| let version_3_3_0 = Version::new(3, 3, 0); - 24| 1| - 25| 1| println!("{:?} < {:?} = {}", version_3_2_1, version_3_3_0, version_3_2_1 < version_3_3_0); - 26| 1|} - 27| | - 28| |/* - 29| | - 30| |This test verifies a bug was fixed that otherwise generated this error: - 31| | - 32| |thread 'rustc' panicked at 'No counters provided the source_hash for function: - 33| | Instance { - 34| | def: Item(WithOptConstParam { - 35| | did: DefId(0:101 ~ autocfg[c44a]::version::{impl#2}::partial_cmp), - 36| | const_param_did: None - 37| | }), - 38| | substs: [] - 39| | }' - 40| |The `PartialOrd` derived by `Version` happened to generate a MIR that generated coverage - 41| |without a code region associated with any `Counter`. Code regions were associated with at least - 42| |one expression, which is allowed, but the `function_source_hash` was only passed to the codegen - 43| |(coverage mapgen) phase from a `Counter`s code region. A new method was added to pass the - 44| |`function_source_hash` without a code region, if necessary. - 45| | - 46| |*/ - 47| | - 48| |// FIXME(richkadel): It may be worth investigating why the coverage report for this test produces - 49| |// the following results: - 50| | - 51| |/* - 52| | - 53| |1. Why are their two counts below different characters (first and last) of `PartialOrd`, on line 17? - 54| | - 55| |2. Line 17 is counted twice, but the `::lt` instance shows a line count of 1? Is there a missing - 56| | line count with a different instance? Or was it really only called once? - 57| | - 58| |3. Line 20 shows another line count (of 1) for a line within a `struct` declaration (on only one of - 59| | its 3 fields). I doubt the specific field (`minor`) is relevant, but rather I suspect there's a - 60| | problem computing the file position here, for some reason. - 61| | - 62| | - 63| | 16| | - 64| | 17| 2|#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)] - 65| | ^1 ^1 - 66| |------------------ - 67| ||Unexecuted instantiation: ::gt - 68| |------------------ - 69| ||Unexecuted instantiation: ::le - 70| |------------------ - 71| ||Unexecuted instantiation: ::ge - 72| |------------------ - 73| ||::lt: - 74| || 17| 1|#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)] - 75| |------------------ - 76| | 18| |pub struct Version { - 77| | 19| | major: usize, - 78| | 20| 1| minor: usize, - 79| | 21| | patch: usize, - 80| | 22| |} - 81| | 23| | - 82| | 24| |impl Version { - 83| | 25| | pub fn new(major: usize, minor: usize, patch: usize) -> Self { - 84| | 26| 2| Version { - 85| | 27| 2| major, - 86| | 28| 2| minor, - 87| | 29| 2| patch, - 88| | 30| 2| } - 89| | 31| 2| } - 90| | 32| |} - 91| | 33| | - 92| | 34| 1|fn main() { - 93| | 35| 1| let version_3_2_1 = Version::new(3, 2, 1); - 94| | 36| 1| let version_3_3_0 = Version::new(3, 3, 0); - 95| | 37| 1| - 96| | 38| 1| println!("{:?} < {:?} = {}", version_3_2_1, version_3_3_0, version_3_2_1 < version - 97| |_3_3_0); - 98| | 39| 1|} - 99| |*/ - diff --git a/src/test/run-make-fulldeps/coverage-reports-base/expected_show_coverage.simple_loop.txt b/src/test/run-make-fulldeps/coverage-reports-base/expected_show_coverage.simple_loop.txt deleted file mode 100644 index 064930dd75c93..0000000000000 --- a/src/test/run-make-fulldeps/coverage-reports-base/expected_show_coverage.simple_loop.txt +++ /dev/null @@ -1,37 +0,0 @@ - 1| |#![allow(unused_assignments)] - 2| | - 3| |fn main() { - 4| | // Initialize test constants in a way that cannot be determined at compile time, to ensure - 5| | // rustc and LLVM cannot optimize out statements (or coverage counters) downstream from - 6| | // dependent conditions. - 7| 1| let is_true = std::env::args().len() == 1; - 8| 1| - 9| 1| let mut countdown = 0; - 10| | - 11| | if - 12| 1| is_true - 13| 1| { - 14| 1| countdown - 15| 1| = - 16| 1| 10 - 17| 1| ; - 18| 1| } - ^0 - 19| | - 20| | loop - 21| | { - 22| | if - 23| 11| countdown - 24| 11| == - 25| 11| 0 - 26| | { - 27| 1| break - 28| | ; - 29| | } - 30| 10| countdown - 31| 10| -= - 32| 10| 1 - 33| | ; - 34| 1| } - 35| 1|} - diff --git a/src/test/run-make-fulldeps/coverage-reports-base/expected_show_coverage.try_error_result.txt b/src/test/run-make-fulldeps/coverage-reports-base/expected_show_coverage.try_error_result.txt deleted file mode 100644 index 6b3a8c39c6338..0000000000000 --- a/src/test/run-make-fulldeps/coverage-reports-base/expected_show_coverage.try_error_result.txt +++ /dev/null @@ -1,38 +0,0 @@ - 1| |#![allow(unused_assignments)] - 2| |// expect-exit-status-1 - 3| | - 4| |fn call(return_error: bool) -> Result<(),()> { - 5| 6| if return_error { - 6| 1| Err(()) - 7| | } else { - 8| 5| Ok(()) - 9| | } - 10| 6|} - 11| | - 12| |fn main() -> Result<(),()> { - 13| 1| let mut - 14| 1| countdown = 10 - 15| | ; - 16| | for - 17| 6| _ - 18| | in - 19| 6| 0..10 - 20| | { - 21| 6| countdown - 22| 6| -= 1 - 23| 6| ; - 24| 6| if - 25| 6| countdown < 5 - 26| | { - 27| 1| call(/*return_error=*/ true)?; - 28| 0| call(/*return_error=*/ false)?; - 29| | } - 30| | else - 31| | { - 32| 5| call(/*return_error=*/ false)?; - ^0 - 33| 5| } - 34| 5| } - 35| 0| Ok(()) - 36| 1|} - diff --git a/src/test/run-make-fulldeps/coverage-reports-base/expected_show_coverage_counters.closure.txt b/src/test/run-make-fulldeps/coverage-reports-base/expected_show_coverage_counters.closure.txt deleted file mode 100644 index fb797796e4e7d..0000000000000 --- a/src/test/run-make-fulldeps/coverage-reports-base/expected_show_coverage_counters.closure.txt +++ /dev/null @@ -1,94 +0,0 @@ -Counter in file 0 20:21 -> 20:38, #1 -Counter in file 0 21:20 -> 21:28, (#1 + 0) -Counter in file 0 21:29 -> 23:18, #2 -Counter in file 0 23:18 -> 23:19, (#1 - #2) -Counter in file 0 24:17 -> 25:14, (#2 + (#1 - #2)) -Counter in file 0 3:11 -> 18:13, #1 -Counter in file 0 25:14 -> 33:9, (#1 + 0) -Counter in file 0 40:6 -> 60:13, (#1 + 0) -Counter in file 0 67:14 -> 75:9, (#1 + 0) -Counter in file 0 82:6 -> 93:2, (#1 + 0) -Counter in file 0 77:13 -> 77:30, #1 -Counter in file 0 78:12 -> 78:20, (#1 + 0) -Counter in file 0 78:21 -> 80:10, #2 -Counter in file 0 80:10 -> 80:11, (#1 - #2) -Counter in file 0 81:9 -> 82:6, (#2 + (#1 - #2)) -Counter in file 0 62:21 -> 62:38, #1 -Counter in file 0 63:20 -> 63:28, (#1 + 0) -Counter in file 0 63:29 -> 65:18, #2 -Counter in file 0 65:18 -> 65:19, (#1 - #2) -Counter in file 0 66:17 -> 67:14, (#2 + (#1 - #2)) -Counter in file 0 35:13 -> 35:30, #1 -Counter in file 0 36:12 -> 36:20, (#1 + 0) -Counter in file 0 36:21 -> 38:10, #2 -Counter in file 0 38:10 -> 38:11, (#1 - #2) -Counter in file 0 39:9 -> 40:6, (#2 + (#1 - #2)) -Emitting segments for file: ../coverage/closure.rs -Combined regions: - 3:11 -> 18:13 (count=1) - 20:21 -> 20:38 (count=0) - 21:20 -> 21:28 (count=0) - 21:29 -> 23:18 (count=0) - 23:18 -> 23:19 (count=0) - 24:17 -> 25:14 (count=0) - 25:14 -> 33:9 (count=1) - 35:13 -> 35:30 (count=0) - 36:12 -> 36:20 (count=0) - 36:21 -> 38:10 (count=0) - 38:10 -> 38:11 (count=0) - 39:9 -> 40:6 (count=0) - 40:6 -> 60:13 (count=1) - 62:21 -> 62:38 (count=1) - 63:20 -> 63:28 (count=1) - 63:29 -> 65:18 (count=0) - 65:18 -> 65:19 (count=1) - 66:17 -> 67:14 (count=1) - 67:14 -> 75:9 (count=1) - 77:13 -> 77:30 (count=1) - 78:12 -> 78:20 (count=1) - 78:21 -> 80:10 (count=0) - 80:10 -> 80:11 (count=1) - 81:9 -> 82:6 (count=1) - 82:6 -> 93:2 (count=1) -Segment at 3:11 (count = 1), RegionEntry -Segment at 18:13 (count = 0), Skipped -Segment at 20:21 (count = 0), RegionEntry -Segment at 20:38 (count = 0), Skipped -Segment at 21:20 (count = 0), RegionEntry -Segment at 21:28 (count = 0), Skipped -Segment at 21:29 (count = 0), RegionEntry -Segment at 23:18 (count = 0), RegionEntry -Segment at 23:19 (count = 0), Skipped -Segment at 24:17 (count = 0), RegionEntry -Segment at 25:14 (count = 1), RegionEntry -Segment at 33:9 (count = 0), Skipped -Segment at 35:13 (count = 0), RegionEntry -Segment at 35:30 (count = 0), Skipped -Segment at 36:12 (count = 0), RegionEntry -Segment at 36:20 (count = 0), Skipped -Segment at 36:21 (count = 0), RegionEntry -Segment at 38:10 (count = 0), RegionEntry -Segment at 38:11 (count = 0), Skipped -Segment at 39:9 (count = 0), RegionEntry -Segment at 40:6 (count = 1), RegionEntry -Segment at 60:13 (count = 0), Skipped -Segment at 62:21 (count = 1), RegionEntry -Segment at 62:38 (count = 0), Skipped -Segment at 63:20 (count = 1), RegionEntry -Segment at 63:28 (count = 0), Skipped -Segment at 63:29 (count = 0), RegionEntry -Segment at 65:18 (count = 1), RegionEntry -Segment at 65:19 (count = 0), Skipped -Segment at 66:17 (count = 1), RegionEntry -Segment at 67:14 (count = 1), RegionEntry -Segment at 75:9 (count = 0), Skipped -Segment at 77:13 (count = 1), RegionEntry -Segment at 77:30 (count = 0), Skipped -Segment at 78:12 (count = 1), RegionEntry -Segment at 78:20 (count = 0), Skipped -Segment at 78:21 (count = 0), RegionEntry -Segment at 80:10 (count = 1), RegionEntry -Segment at 80:11 (count = 0), Skipped -Segment at 81:9 (count = 1), RegionEntry -Segment at 82:6 (count = 1), RegionEntry -Segment at 93:2 (count = 0), Skipped diff --git a/src/test/run-make-fulldeps/coverage-reports-base/expected_show_coverage_counters.conditions.txt b/src/test/run-make-fulldeps/coverage-reports-base/expected_show_coverage_counters.conditions.txt deleted file mode 100644 index d48cd8074bebb..0000000000000 --- a/src/test/run-make-fulldeps/coverage-reports-base/expected_show_coverage_counters.conditions.txt +++ /dev/null @@ -1,238 +0,0 @@ -Counter in file 0 4:9 -> 4:26, #1 -Counter in file 0 5:8 -> 5:12, (#1 + 0) -Counter in file 0 5:13 -> 7:6, #2 -Counter in file 0 10:9 -> 10:10, (#4 + #11) -Counter in file 0 10:16 -> 10:29, (#2 + 0) -Counter in file 0 11:9 -> 12:10, #4 -Counter in file 0 13:15 -> 13:28, ((#2 + 0) - #3) -Counter in file 0 14:12 -> 14:25, #5 -Counter in file 0 14:29 -> 14:42, (#5 - #13) -Counter in file 0 14:42 -> 14:43, (#13 + #14) -Counter in file 0 14:42 -> 14:43, ((#5 - #13) - #14) -Counter in file 0 14:46 -> 14:60, #21 -Counter in file 0 14:60 -> 14:61, (#17 + #18) -Counter in file 0 14:60 -> 14:61, (#21 - #18) -Counter in file 0 14:61 -> 16:10, #22 -Counter in file 0 16:10 -> 16:11, #23 -Counter in file 0 17:9 -> 18:18, #11 -Counter in file 0 20:9 -> 20:15, (((#2 + 0) - #3) - #5) -Counter in file 0 23:9 -> 23:26, ((#4 + #11) + 0) -Counter in file 0 24:8 -> 24:12, ((#4 + #11) + 0) -Counter in file 0 24:13 -> 26:6, #12 -Counter in file 0 28:8 -> 28:21, (#12 + 0) -Counter in file 0 29:9 -> 29:23, #16 -Counter in file 0 30:15 -> 30:28, ((#12 + 0) - #15) -Counter in file 0 31:12 -> 31:25, (((#12 + 0) - #15) - #8) -Counter in file 0 31:29 -> 31:42, ((((#12 + 0) - #15) - #8) - #24) -Counter in file 0 31:42 -> 31:43, (((((#12 + 0) - #15) - #8) - #24) - #25) -Counter in file 0 31:42 -> 31:43, (#24 + #25) -Counter in file 0 31:46 -> 31:60, #32 -Counter in file 0 31:60 -> 31:61, (#28 + #29) -Counter in file 0 31:60 -> 31:61, (#32 - #29) -Counter in file 0 31:61 -> 33:10, #33 -Counter in file 0 33:10 -> 33:11, #34 -Counter in file 0 34:9 -> 34:23, #19 -Counter in file 0 36:9 -> 36:15, #8 -Counter in file 0 39:9 -> 39:26, (#16 + #19) -Counter in file 0 40:8 -> 40:12, ((#16 + #19) + 0) -Counter in file 0 40:13 -> 42:6, #20 -Counter in file 0 44:9 -> 44:10, (#27 + #30) -Counter in file 0 44:16 -> 44:29, (#20 + 0) -Counter in file 0 45:9 -> 45:23, #27 -Counter in file 0 46:15 -> 46:28, ((#20 + 0) - #26) -Counter in file 0 47:12 -> 47:25, (((#20 + 0) - #26) - #7) -Counter in file 0 47:29 -> 47:42, ((((#20 + 0) - #26) - #7) - #35) -Counter in file 0 47:42 -> 47:43, (#35 + #36) -Counter in file 0 47:42 -> 47:43, (((((#20 + 0) - #26) - #7) - #35) - #36) -Counter in file 0 47:46 -> 47:60, #41 -Counter in file 0 47:60 -> 47:61, (#37 + #38) -Counter in file 0 47:60 -> 47:61, (#41 - #38) -Counter in file 0 47:61 -> 49:10, #42 -Counter in file 0 49:10 -> 49:11, #43 -Counter in file 0 50:9 -> 50:23, #30 -Counter in file 0 52:13 -> 54:15, #7 -Counter in file 0 57:9 -> 57:10, (#9 + #10) -Counter in file 0 57:16 -> 57:29, ((#27 + #30) + 0) -Counter in file 0 58:9 -> 58:23, #9 -Counter in file 0 59:15 -> 59:28, ((#27 + #30) - #31) -Counter in file 0 60:12 -> 60:25, (((#27 + #30) - #31) - #6) -Counter in file 0 60:29 -> 60:42, ((((#27 + #30) - #31) - #6) - #39) -Counter in file 0 60:42 -> 60:43, (#39 + #40) -Counter in file 0 60:42 -> 60:43, (((((#27 + #30) - #31) - #6) - #39) - #40) -Counter in file 0 60:46 -> 60:60, #46 -Counter in file 0 60:60 -> 60:61, (#46 - #45) -Counter in file 0 60:60 -> 60:61, (#44 + #45) -Counter in file 0 60:61 -> 62:10, #47 -Counter in file 0 62:10 -> 62:11, #48 -Counter in file 0 63:9 -> 63:23, #10 -Counter in file 0 65:9 -> 65:15, #6 -Counter in file 0 67:1 -> 67:2, ((#9 + #10) + (((#6 + #7) + #8) + (((#2 + 0) - #3) - #5))) -Emitting segments for file: ../coverage/conditions.rs -Combined regions: - 4:9 -> 4:26 (count=1) - 5:8 -> 5:12 (count=1) - 5:13 -> 7:6 (count=1) - 10:9 -> 10:10 (count=1) - 10:16 -> 10:29 (count=1) - 11:9 -> 12:10 (count=1) - 13:15 -> 13:28 (count=0) - 14:12 -> 14:25 (count=0) - 14:29 -> 14:42 (count=0) - 14:42 -> 14:43 (count=0) - 14:46 -> 14:60 (count=0) - 14:60 -> 14:61 (count=0) - 14:61 -> 16:10 (count=0) - 16:10 -> 16:11 (count=0) - 17:9 -> 18:18 (count=0) - 20:9 -> 20:15 (count=0) - 23:9 -> 23:26 (count=1) - 24:8 -> 24:12 (count=1) - 24:13 -> 26:6 (count=1) - 28:8 -> 28:21 (count=1) - 29:9 -> 29:23 (count=1) - 30:15 -> 30:28 (count=0) - 31:12 -> 31:25 (count=0) - 31:29 -> 31:42 (count=0) - 31:42 -> 31:43 (count=0) - 31:46 -> 31:60 (count=0) - 31:60 -> 31:61 (count=0) - 31:61 -> 33:10 (count=0) - 33:10 -> 33:11 (count=0) - 34:9 -> 34:23 (count=0) - 36:9 -> 36:15 (count=0) - 39:9 -> 39:26 (count=1) - 40:8 -> 40:12 (count=1) - 40:13 -> 42:6 (count=1) - 44:9 -> 44:10 (count=0) - 44:16 -> 44:29 (count=1) - 45:9 -> 45:23 (count=0) - 46:15 -> 46:28 (count=1) - 47:12 -> 47:25 (count=0) - 47:29 -> 47:42 (count=0) - 47:42 -> 47:43 (count=0) - 47:46 -> 47:60 (count=0) - 47:60 -> 47:61 (count=0) - 47:61 -> 49:10 (count=0) - 49:10 -> 49:11 (count=0) - 50:9 -> 50:23 (count=0) - 52:13 -> 54:15 (count=1) - 57:9 -> 57:10 (count=0) - 57:16 -> 57:29 (count=0) - 58:9 -> 58:23 (count=0) - 59:15 -> 59:28 (count=0) - 60:12 -> 60:25 (count=0) - 60:29 -> 60:42 (count=0) - 60:42 -> 60:43 (count=0) - 60:46 -> 60:60 (count=0) - 60:60 -> 60:61 (count=0) - 60:61 -> 62:10 (count=0) - 62:10 -> 62:11 (count=0) - 63:9 -> 63:23 (count=0) - 65:9 -> 65:15 (count=0) - 67:1 -> 67:2 (count=1) -Segment at 4:9 (count = 1), RegionEntry -Segment at 4:26 (count = 0), Skipped -Segment at 5:8 (count = 1), RegionEntry -Segment at 5:12 (count = 0), Skipped -Segment at 5:13 (count = 1), RegionEntry -Segment at 7:6 (count = 0), Skipped -Segment at 10:9 (count = 1), RegionEntry -Segment at 10:10 (count = 0), Skipped -Segment at 10:16 (count = 1), RegionEntry -Segment at 10:29 (count = 0), Skipped -Segment at 11:9 (count = 1), RegionEntry -Segment at 12:10 (count = 0), Skipped -Segment at 13:15 (count = 0), RegionEntry -Segment at 13:28 (count = 0), Skipped -Segment at 14:12 (count = 0), RegionEntry -Segment at 14:25 (count = 0), Skipped -Segment at 14:29 (count = 0), RegionEntry -Segment at 14:42 (count = 0), RegionEntry -Segment at 14:43 (count = 0), Skipped -Segment at 14:46 (count = 0), RegionEntry -Segment at 14:60 (count = 0), RegionEntry -Segment at 14:61 (count = 0), RegionEntry -Segment at 16:10 (count = 0), RegionEntry -Segment at 16:11 (count = 0), Skipped -Segment at 17:9 (count = 0), RegionEntry -Segment at 18:18 (count = 0), Skipped -Segment at 20:9 (count = 0), RegionEntry -Segment at 20:15 (count = 0), Skipped -Segment at 23:9 (count = 1), RegionEntry -Segment at 23:26 (count = 0), Skipped -Segment at 24:8 (count = 1), RegionEntry -Segment at 24:12 (count = 0), Skipped -Segment at 24:13 (count = 1), RegionEntry -Segment at 26:6 (count = 0), Skipped -Segment at 28:8 (count = 1), RegionEntry -Segment at 28:21 (count = 0), Skipped -Segment at 29:9 (count = 1), RegionEntry -Segment at 29:23 (count = 0), Skipped -Segment at 30:15 (count = 0), RegionEntry -Segment at 30:28 (count = 0), Skipped -Segment at 31:12 (count = 0), RegionEntry -Segment at 31:25 (count = 0), Skipped -Segment at 31:29 (count = 0), RegionEntry -Segment at 31:42 (count = 0), RegionEntry -Segment at 31:43 (count = 0), Skipped -Segment at 31:46 (count = 0), RegionEntry -Segment at 31:60 (count = 0), RegionEntry -Segment at 31:61 (count = 0), RegionEntry -Segment at 33:10 (count = 0), RegionEntry -Segment at 33:11 (count = 0), Skipped -Segment at 34:9 (count = 0), RegionEntry -Segment at 34:23 (count = 0), Skipped -Segment at 36:9 (count = 0), RegionEntry -Segment at 36:15 (count = 0), Skipped -Segment at 39:9 (count = 1), RegionEntry -Segment at 39:26 (count = 0), Skipped -Segment at 40:8 (count = 1), RegionEntry -Segment at 40:12 (count = 0), Skipped -Segment at 40:13 (count = 1), RegionEntry -Segment at 42:6 (count = 0), Skipped -Segment at 44:9 (count = 0), RegionEntry -Segment at 44:10 (count = 0), Skipped -Segment at 44:16 (count = 1), RegionEntry -Segment at 44:29 (count = 0), Skipped -Segment at 45:9 (count = 0), RegionEntry -Segment at 45:23 (count = 0), Skipped -Segment at 46:15 (count = 1), RegionEntry -Segment at 46:28 (count = 0), Skipped -Segment at 47:12 (count = 0), RegionEntry -Segment at 47:25 (count = 0), Skipped -Segment at 47:29 (count = 0), RegionEntry -Segment at 47:42 (count = 0), RegionEntry -Segment at 47:43 (count = 0), Skipped -Segment at 47:46 (count = 0), RegionEntry -Segment at 47:60 (count = 0), RegionEntry -Segment at 47:61 (count = 0), RegionEntry -Segment at 49:10 (count = 0), RegionEntry -Segment at 49:11 (count = 0), Skipped -Segment at 50:9 (count = 0), RegionEntry -Segment at 50:23 (count = 0), Skipped -Segment at 52:13 (count = 1), RegionEntry -Segment at 54:15 (count = 0), Skipped -Segment at 57:9 (count = 0), RegionEntry -Segment at 57:10 (count = 0), Skipped -Segment at 57:16 (count = 0), RegionEntry -Segment at 57:29 (count = 0), Skipped -Segment at 58:9 (count = 0), RegionEntry -Segment at 58:23 (count = 0), Skipped -Segment at 59:15 (count = 0), RegionEntry -Segment at 59:28 (count = 0), Skipped -Segment at 60:12 (count = 0), RegionEntry -Segment at 60:25 (count = 0), Skipped -Segment at 60:29 (count = 0), RegionEntry -Segment at 60:42 (count = 0), RegionEntry -Segment at 60:43 (count = 0), Skipped -Segment at 60:46 (count = 0), RegionEntry -Segment at 60:60 (count = 0), RegionEntry -Segment at 60:61 (count = 0), RegionEntry -Segment at 62:10 (count = 0), RegionEntry -Segment at 62:11 (count = 0), Skipped -Segment at 63:9 (count = 0), RegionEntry -Segment at 63:23 (count = 0), Skipped -Segment at 65:9 (count = 0), RegionEntry -Segment at 65:15 (count = 0), Skipped -Segment at 67:1 (count = 1), RegionEntry -Segment at 67:2 (count = 0), Skipped diff --git a/src/test/run-make-fulldeps/coverage-reports-base/expected_show_coverage_counters.generics.txt b/src/test/run-make-fulldeps/coverage-reports-base/expected_show_coverage_counters.generics.txt deleted file mode 100644 index 013a69ed3983a..0000000000000 --- a/src/test/run-make-fulldeps/coverage-reports-base/expected_show_coverage_counters.generics.txt +++ /dev/null @@ -1,48 +0,0 @@ -Counter in file 0 17:24 -> 19:6, #1 -Counter in file 0 17:24 -> 19:6, #1 -Counter in file 0 23:9 -> 28:28, #1 -Counter in file 0 30:8 -> 30:12, (#1 + 0) -Counter in file 0 31:9 -> 32:22, #2 -Counter in file 0 38:1 -> 38:2, (#2 + 0) -Counter in file 0 10:49 -> 12:6, #1 -Counter in file 0 10:49 -> 12:6, #1 -Emitting segments for file: ../coverage/generics.rs -Combined regions: - 10:49 -> 12:6 (count=3) - 17:24 -> 19:6 (count=2) - 23:9 -> 28:28 (count=1) - 30:8 -> 30:12 (count=1) - 31:9 -> 32:22 (count=1) - 38:1 -> 38:2 (count=1) -Segment at 10:49 (count = 3), RegionEntry -Segment at 12:6 (count = 0), Skipped -Segment at 17:24 (count = 2), RegionEntry -Segment at 19:6 (count = 0), Skipped -Segment at 23:9 (count = 1), RegionEntry -Segment at 28:28 (count = 0), Skipped -Segment at 30:8 (count = 1), RegionEntry -Segment at 30:12 (count = 0), Skipped -Segment at 31:9 (count = 1), RegionEntry -Segment at 32:22 (count = 0), Skipped -Segment at 38:1 (count = 1), RegionEntry -Segment at 38:2 (count = 0), Skipped -Emitting segments for function: _RNvMCs4fqI2P2rA04_8genericsINtB2_8FireworkdE12set_strengthB2_ -Combined regions: - 10:49 -> 12:6 (count=2) -Segment at 10:49 (count = 2), RegionEntry -Segment at 12:6 (count = 0), Skipped -Emitting segments for function: _RNvMCs4fqI2P2rA04_8genericsINtB2_8FireworklE12set_strengthB2_ -Combined regions: - 10:49 -> 12:6 (count=1) -Segment at 10:49 (count = 1), RegionEntry -Segment at 12:6 (count = 0), Skipped -Emitting segments for function: _RNvXs_Cs4fqI2P2rA04_8genericsINtB4_8FireworklENtNtNtCs7f2nZg1zwMz_4core3ops4drop4Drop4dropB4_ -Combined regions: - 17:24 -> 19:6 (count=1) -Segment at 17:24 (count = 1), RegionEntry -Segment at 19:6 (count = 0), Skipped -Emitting segments for function: _RNvXs_Cs4fqI2P2rA04_8genericsINtB4_8FireworkdENtNtNtCs7f2nZg1zwMz_4core3ops4drop4Drop4dropB4_ -Combined regions: - 17:24 -> 19:6 (count=1) -Segment at 17:24 (count = 1), RegionEntry -Segment at 19:6 (count = 0), Skipped diff --git a/src/test/run-make-fulldeps/coverage-reports-base/expected_show_coverage_counters.if.txt b/src/test/run-make-fulldeps/coverage-reports-base/expected_show_coverage_counters.if.txt deleted file mode 100644 index c2bef365ea9d8..0000000000000 --- a/src/test/run-make-fulldeps/coverage-reports-base/expected_show_coverage_counters.if.txt +++ /dev/null @@ -1,21 +0,0 @@ -Counter in file 0 8:5 -> 18:10, #1 -Counter in file 0 21:9 -> 21:16, (#1 + 0) -Counter in file 0 22:5 -> 27:6, #2 -Counter in file 0 27:6 -> 27:7, (#1 - #2) -Counter in file 0 28:1 -> 28:2, (#2 + (#1 - #2)) -Emitting segments for file: ../coverage/if.rs -Combined regions: - 8:5 -> 18:10 (count=1) - 21:9 -> 21:16 (count=1) - 22:5 -> 27:6 (count=1) - 27:6 -> 27:7 (count=0) - 28:1 -> 28:2 (count=1) -Segment at 8:5 (count = 1), RegionEntry -Segment at 18:10 (count = 0), Skipped -Segment at 21:9 (count = 1), RegionEntry -Segment at 21:16 (count = 0), Skipped -Segment at 22:5 (count = 1), RegionEntry -Segment at 27:6 (count = 0), RegionEntry -Segment at 27:7 (count = 0), Skipped -Segment at 28:1 (count = 1), RegionEntry -Segment at 28:2 (count = 0), Skipped diff --git a/src/test/run-make-fulldeps/coverage-reports-base/expected_show_coverage_counters.if_else.txt b/src/test/run-make-fulldeps/coverage-reports-base/expected_show_coverage_counters.if_else.txt deleted file mode 100644 index faf5c094bbaaa..0000000000000 --- a/src/test/run-make-fulldeps/coverage-reports-base/expected_show_coverage_counters.if_else.txt +++ /dev/null @@ -1,30 +0,0 @@ -Counter in file 0 7:9 -> 11:16, #1 -Counter in file 0 12:5 -> 17:6, #2 -Counter in file 0 20:9 -> 22:16, (#1 - #2) -Counter in file 0 26:9 -> 26:16, (#2 + (#1 - #2)) -Counter in file 0 27:5 -> 32:6, #3 -Counter in file 0 34:5 -> 39:6, ((#2 + (#1 - #2)) - #3) -Counter in file 0 40:1 -> 40:2, (#3 + ((#2 + (#1 - #2)) - #3)) -Emitting segments for file: ../coverage/if_else.rs -Combined regions: - 7:9 -> 11:16 (count=1) - 12:5 -> 17:6 (count=1) - 20:9 -> 22:16 (count=0) - 26:9 -> 26:16 (count=1) - 27:5 -> 32:6 (count=1) - 34:5 -> 39:6 (count=0) - 40:1 -> 40:2 (count=1) -Segment at 7:9 (count = 1), RegionEntry -Segment at 11:16 (count = 0), Skipped -Segment at 12:5 (count = 1), RegionEntry -Segment at 17:6 (count = 0), Skipped -Segment at 20:9 (count = 0), RegionEntry -Segment at 22:16 (count = 0), Skipped -Segment at 26:9 (count = 1), RegionEntry -Segment at 26:16 (count = 0), Skipped -Segment at 27:5 (count = 1), RegionEntry -Segment at 32:6 (count = 0), Skipped -Segment at 34:5 (count = 0), RegionEntry -Segment at 39:6 (count = 0), Skipped -Segment at 40:1 (count = 1), RegionEntry -Segment at 40:2 (count = 0), Skipped diff --git a/src/test/run-make-fulldeps/coverage-reports-base/expected_show_coverage_counters.inner_items.txt b/src/test/run-make-fulldeps/coverage-reports-base/expected_show_coverage_counters.inner_items.txt deleted file mode 100644 index 65cd6481af4cc..0000000000000 --- a/src/test/run-make-fulldeps/coverage-reports-base/expected_show_coverage_counters.inner_items.txt +++ /dev/null @@ -1,60 +0,0 @@ -Counter in file 0 19:13 -> 19:18, #1 -Counter in file 0 20:13 -> 20:14, #2 -Counter in file 0 20:17 -> 20:22, (#1 + 0) -Counter in file 0 21:9 -> 22:6, (#2 + 0) -Counter in file 0 7:9 -> 9:26, #1 -Counter in file 0 10:8 -> 10:15, (#1 + 0) -Counter in file 0 10:16 -> 12:6, #2 -Counter in file 0 12:6 -> 12:7, (#1 - #2) -Counter in file 0 48:8 -> 48:15, (#2 + (#1 - #2)) -Counter in file 0 48:16 -> 50:6, #3 -Counter in file 0 50:6 -> 50:7, ((#2 + (#1 - #2)) - #3) -Counter in file 0 52:9 -> 57:2, (#3 + ((#2 + (#1 - #2)) - #3)) -Counter in file 0 33:42 -> 36:10, #1 -Counter in file 0 41:37 -> 41:41, #1 -Counter in file 0 42:13 -> 43:10, #2 -Emitting segments for file: ../coverage/inner_items.rs -Combined regions: - 7:9 -> 9:26 (count=1) - 10:8 -> 10:15 (count=1) - 10:16 -> 12:6 (count=1) - 12:6 -> 12:7 (count=0) - 19:13 -> 19:18 (count=3) - 20:13 -> 20:14 (count=3) - 20:17 -> 20:22 (count=3) - 21:9 -> 22:6 (count=3) - 33:42 -> 36:10 (count=1) - 41:37 -> 41:41 (count=1) - 42:13 -> 43:10 (count=1) - 48:8 -> 48:15 (count=1) - 48:16 -> 50:6 (count=1) - 50:6 -> 50:7 (count=0) - 52:9 -> 57:2 (count=1) -Segment at 7:9 (count = 1), RegionEntry -Segment at 9:26 (count = 0), Skipped -Segment at 10:8 (count = 1), RegionEntry -Segment at 10:15 (count = 0), Skipped -Segment at 10:16 (count = 1), RegionEntry -Segment at 12:6 (count = 0), RegionEntry -Segment at 12:7 (count = 0), Skipped -Segment at 19:13 (count = 3), RegionEntry -Segment at 19:18 (count = 0), Skipped -Segment at 20:13 (count = 3), RegionEntry -Segment at 20:14 (count = 0), Skipped -Segment at 20:17 (count = 3), RegionEntry -Segment at 20:22 (count = 0), Skipped -Segment at 21:9 (count = 3), RegionEntry -Segment at 22:6 (count = 0), Skipped -Segment at 33:42 (count = 1), RegionEntry -Segment at 36:10 (count = 0), Skipped -Segment at 41:37 (count = 1), RegionEntry -Segment at 41:41 (count = 0), Skipped -Segment at 42:13 (count = 1), RegionEntry -Segment at 43:10 (count = 0), Skipped -Segment at 48:8 (count = 1), RegionEntry -Segment at 48:15 (count = 0), Skipped -Segment at 48:16 (count = 1), RegionEntry -Segment at 50:6 (count = 0), RegionEntry -Segment at 50:7 (count = 0), Skipped -Segment at 52:9 (count = 1), RegionEntry -Segment at 57:2 (count = 0), Skipped diff --git a/src/test/run-make-fulldeps/coverage-reports-base/expected_show_coverage_counters.nested_loops.txt b/src/test/run-make-fulldeps/coverage-reports-base/expected_show_coverage_counters.nested_loops.txt deleted file mode 100644 index f503007353319..0000000000000 --- a/src/test/run-make-fulldeps/coverage-reports-base/expected_show_coverage_counters.nested_loops.txt +++ /dev/null @@ -1,73 +0,0 @@ -Counter in file 0 2:9 -> 3:27, #1 -Counter in file 0 5:19 -> 5:32, (#1 + #2) -Counter in file 0 6:13 -> 7:24, ((#1 + #2) - #3) -Counter in file 0 8:13 -> 8:14, ((((#1 + #2) - #3) + (#5 + #6)) - #7) -Counter in file 0 8:18 -> 8:23, (((#1 + #2) - #3) + (#5 + #6)) -Counter in file 0 9:16 -> 9:22, (((((#1 + #2) - #3) + (#5 + #6)) - #7) + 0) -Counter in file 0 10:17 -> 10:22, #8 -Counter in file 0 12:13 -> 12:19, #9 -Counter in file 0 13:13 -> 13:19, #10 -Counter in file 0 14:16 -> 14:22, (#10 + 0) -Counter in file 0 15:17 -> 16:27, #11 -Counter in file 0 17:21 -> 17:33, #4 -Counter in file 0 19:21 -> 21:14, #5 -Counter in file 0 21:14 -> 21:15, #6 -Counter in file 0 22:10 -> 22:11, (#5 + #6) -Counter in file 0 23:9 -> 23:23, #2 -Counter in file 0 24:6 -> 24:7, #3 -Counter in file 0 25:1 -> 25:2, (#4 + #3) -Emitting segments for file: ../coverage/nested_loops.rs -Combined regions: - 2:9 -> 3:27 (count=1) - 5:19 -> 5:32 (count=1) - 6:13 -> 7:24 (count=1) - 8:13 -> 8:14 (count=3) - 8:18 -> 8:23 (count=3) - 9:16 -> 9:22 (count=3) - 10:17 -> 10:22 (count=0) - 12:13 -> 12:19 (count=3) - 13:13 -> 13:19 (count=3) - 14:16 -> 14:22 (count=3) - 15:17 -> 16:27 (count=1) - 17:21 -> 17:33 (count=1) - 19:21 -> 21:14 (count=0) - 21:14 -> 21:15 (count=2) - 22:10 -> 22:11 (count=2) - 23:9 -> 23:23 (count=0) - 24:6 -> 24:7 (count=0) - 25:1 -> 25:2 (count=1) -Segment at 2:9 (count = 1), RegionEntry -Segment at 3:27 (count = 0), Skipped -Segment at 5:19 (count = 1), RegionEntry -Segment at 5:32 (count = 0), Skipped -Segment at 6:13 (count = 1), RegionEntry -Segment at 7:24 (count = 0), Skipped -Segment at 8:13 (count = 3), RegionEntry -Segment at 8:14 (count = 0), Skipped -Segment at 8:18 (count = 3), RegionEntry -Segment at 8:23 (count = 0), Skipped -Segment at 9:16 (count = 3), RegionEntry -Segment at 9:22 (count = 0), Skipped -Segment at 10:17 (count = 0), RegionEntry -Segment at 10:22 (count = 0), Skipped -Segment at 12:13 (count = 3), RegionEntry -Segment at 12:19 (count = 0), Skipped -Segment at 13:13 (count = 3), RegionEntry -Segment at 13:19 (count = 0), Skipped -Segment at 14:16 (count = 3), RegionEntry -Segment at 14:22 (count = 0), Skipped -Segment at 15:17 (count = 1), RegionEntry -Segment at 16:27 (count = 0), Skipped -Segment at 17:21 (count = 1), RegionEntry -Segment at 17:33 (count = 0), Skipped -Segment at 19:21 (count = 0), RegionEntry -Segment at 21:14 (count = 2), RegionEntry -Segment at 21:15 (count = 0), Skipped -Segment at 22:10 (count = 2), RegionEntry -Segment at 22:11 (count = 0), Skipped -Segment at 23:9 (count = 0), RegionEntry -Segment at 23:23 (count = 0), Skipped -Segment at 24:6 (count = 0), RegionEntry -Segment at 24:7 (count = 0), Skipped -Segment at 25:1 (count = 1), RegionEntry -Segment at 25:2 (count = 0), Skipped diff --git a/src/test/run-make-fulldeps/coverage-reports-base/expected_show_coverage_counters.partial_eq.txt b/src/test/run-make-fulldeps/coverage-reports-base/expected_show_coverage_counters.partial_eq.txt deleted file mode 100644 index cdef821c0aef2..0000000000000 --- a/src/test/run-make-fulldeps/coverage-reports-base/expected_show_coverage_counters.partial_eq.txt +++ /dev/null @@ -1,27 +0,0 @@ -Counter in file 0 7:5 -> 7:6, #1 -Counter in file 0 21:11 -> 26:2, #1 -Counter in file 0 4:17 -> 4:22, #1 -Counter in file 0 13:9 -> 18:6, #1 -Counter in file 0 4:39 -> 4:40, #1 -Counter in file 0 4:48 -> 4:49, (#1 + 0) -Counter in file 0 8:5 -> 8:17, #1 -Emitting segments for file: ../coverage/partial_eq.rs -Combined regions: - 4:17 -> 4:22 (count=2) - 4:39 -> 4:40 (count=1) - 4:48 -> 4:49 (count=1) - 7:5 -> 7:6 (count=1) - 13:9 -> 18:6 (count=2) - 21:11 -> 26:2 (count=1) -Segment at 4:17 (count = 2), RegionEntry -Segment at 4:22 (count = 0), Skipped -Segment at 4:39 (count = 1), RegionEntry -Segment at 4:40 (count = 0), Skipped -Segment at 4:48 (count = 1), RegionEntry -Segment at 4:49 (count = 0), Skipped -Segment at 7:5 (count = 1), RegionEntry -Segment at 7:6 (count = 0), Skipped -Segment at 13:9 (count = 2), RegionEntry -Segment at 18:6 (count = 0), Skipped -Segment at 21:11 (count = 1), RegionEntry -Segment at 26:2 (count = 0), Skipped diff --git a/src/test/run-make-fulldeps/coverage-reports-base/expected_show_coverage_counters.tight_inf_loop.txt b/src/test/run-make-fulldeps/coverage-reports-base/expected_show_coverage_counters.tight_inf_loop.txt deleted file mode 100644 index 5887658fe67a2..0000000000000 --- a/src/test/run-make-fulldeps/coverage-reports-base/expected_show_coverage_counters.tight_inf_loop.txt +++ /dev/null @@ -1,10 +0,0 @@ -Counter in file 0 2:8 -> 2:13, #1 -Counter in file 0 5:1 -> 5:2, (#1 - #2) -Emitting segments for file: ../coverage/tight_inf_loop.rs -Combined regions: - 2:8 -> 2:13 (count=1) - 5:1 -> 5:2 (count=1) -Segment at 2:8 (count = 1), RegionEntry -Segment at 2:13 (count = 0), Skipped -Segment at 5:1 (count = 1), RegionEntry -Segment at 5:2 (count = 0), Skipped diff --git a/src/test/run-make-fulldeps/coverage-reports-base/expected_show_coverage_counters.try_error_result.txt b/src/test/run-make-fulldeps/coverage-reports-base/expected_show_coverage_counters.try_error_result.txt deleted file mode 100644 index a317cd792910d..0000000000000 --- a/src/test/run-make-fulldeps/coverage-reports-base/expected_show_coverage_counters.try_error_result.txt +++ /dev/null @@ -1,72 +0,0 @@ -Counter in file 0 13:9 -> 14:23, #1 -Counter in file 0 17:9 -> 17:10, ((#1 + (#2 + #3)) - #4) -Counter in file 0 19:9 -> 19:14, (#1 + (#2 + #3)) -Counter in file 0 21:9 -> 25:26, #8 -Counter in file 0 27:13 -> 27:41, #9 -Counter in file 0 27:41 -> 27:42, #5 -Counter in file 0 28:13 -> 28:42, (#9 - #5) -Counter in file 0 28:42 -> 28:43, #6 -Counter in file 0 32:13 -> 32:42, (#8 - #9) -Counter in file 0 32:42 -> 32:43, #7 -Counter in file 0 33:10 -> 33:11, #2 -Counter in file 0 33:10 -> 33:11, #3 -Counter in file 0 34:6 -> 34:7, (#2 + #3) -Counter in file 0 35:5 -> 35:11, #4 -Counter in file 0 36:1 -> 36:2, ((#5 + (#6 + #7)) + #4) -Counter in file 0 5:8 -> 5:20, #1 -Counter in file 0 6:9 -> 6:16, #2 -Counter in file 0 8:9 -> 8:15, (#1 - #2) -Counter in file 0 10:1 -> 10:2, (#2 + (#1 - #2)) -Emitting segments for file: ../coverage/try_error_result.rs -Combined regions: - 5:8 -> 5:20 (count=6) - 6:9 -> 6:16 (count=1) - 8:9 -> 8:15 (count=5) - 10:1 -> 10:2 (count=6) - 13:9 -> 14:23 (count=1) - 17:9 -> 17:10 (count=6) - 19:9 -> 19:14 (count=6) - 21:9 -> 25:26 (count=6) - 27:13 -> 27:41 (count=1) - 27:41 -> 27:42 (count=1) - 28:13 -> 28:42 (count=0) - 28:42 -> 28:43 (count=0) - 32:13 -> 32:42 (count=5) - 32:42 -> 32:43 (count=0) - 33:10 -> 33:11 (count=5) - 34:6 -> 34:7 (count=5) - 35:5 -> 35:11 (count=0) - 36:1 -> 36:2 (count=1) -Segment at 5:8 (count = 6), RegionEntry -Segment at 5:20 (count = 0), Skipped -Segment at 6:9 (count = 1), RegionEntry -Segment at 6:16 (count = 0), Skipped -Segment at 8:9 (count = 5), RegionEntry -Segment at 8:15 (count = 0), Skipped -Segment at 10:1 (count = 6), RegionEntry -Segment at 10:2 (count = 0), Skipped -Segment at 13:9 (count = 1), RegionEntry -Segment at 14:23 (count = 0), Skipped -Segment at 17:9 (count = 6), RegionEntry -Segment at 17:10 (count = 0), Skipped -Segment at 19:9 (count = 6), RegionEntry -Segment at 19:14 (count = 0), Skipped -Segment at 21:9 (count = 6), RegionEntry -Segment at 25:26 (count = 0), Skipped -Segment at 27:13 (count = 1), RegionEntry -Segment at 27:41 (count = 1), RegionEntry -Segment at 27:42 (count = 0), Skipped -Segment at 28:13 (count = 0), RegionEntry -Segment at 28:42 (count = 0), RegionEntry -Segment at 28:43 (count = 0), Skipped -Segment at 32:13 (count = 5), RegionEntry -Segment at 32:42 (count = 0), RegionEntry -Segment at 32:43 (count = 0), Skipped -Segment at 33:10 (count = 5), RegionEntry -Segment at 33:11 (count = 0), Skipped -Segment at 34:6 (count = 5), RegionEntry -Segment at 34:7 (count = 0), Skipped -Segment at 35:5 (count = 0), RegionEntry -Segment at 35:11 (count = 0), Skipped -Segment at 36:1 (count = 1), RegionEntry -Segment at 36:2 (count = 0), Skipped diff --git a/src/test/run-make-fulldeps/coverage-reports-base/expected_show_coverage_counters.while.txt b/src/test/run-make-fulldeps/coverage-reports-base/expected_show_coverage_counters.while.txt deleted file mode 100644 index b0e881da7c8cb..0000000000000 --- a/src/test/run-make-fulldeps/coverage-reports-base/expected_show_coverage_counters.while.txt +++ /dev/null @@ -1,18 +0,0 @@ -Counter in file 0 2:9 -> 2:16, #1 -Counter in file 0 3:11 -> 3:20, (#1 + #2) -Counter in file 0 3:21 -> 4:6, #2 -Counter in file 0 5:1 -> 5:2, ((#1 + #2) - #2) -Emitting segments for file: ../coverage/while.rs -Combined regions: - 2:9 -> 2:16 (count=1) - 3:11 -> 3:20 (count=1) - 3:21 -> 4:6 (count=0) - 5:1 -> 5:2 (count=1) -Segment at 2:9 (count = 1), RegionEntry -Segment at 2:16 (count = 0), Skipped -Segment at 3:11 (count = 1), RegionEntry -Segment at 3:20 (count = 0), Skipped -Segment at 3:21 (count = 0), RegionEntry -Segment at 4:6 (count = 0), Skipped -Segment at 5:1 (count = 1), RegionEntry -Segment at 5:2 (count = 0), Skipped diff --git a/src/test/run-make-fulldeps/coverage-reports-base/expected_show_coverage_counters.while_early_ret.txt b/src/test/run-make-fulldeps/coverage-reports-base/expected_show_coverage_counters.while_early_ret.txt deleted file mode 100644 index f541baec50c0b..0000000000000 --- a/src/test/run-make-fulldeps/coverage-reports-base/expected_show_coverage_counters.while_early_ret.txt +++ /dev/null @@ -1,38 +0,0 @@ -Counter in file 0 5:9 -> 5:27, #1 -Counter in file 0 7:9 -> 9:10, (#1 + #2) -Counter in file 0 12:13 -> 14:14, ((#1 + #2) - #3) -Counter in file 0 18:21 -> 20:22, #6 -Counter in file 0 22:21 -> 22:27, #4 -Counter in file 0 26:21 -> 26:27, #5 -Counter in file 0 30:9 -> 32:10, #2 -Counter in file 0 35:5 -> 35:11, #3 -Counter in file 0 36:1 -> 36:2, ((#4 + #5) + #3) -Emitting segments for file: ../coverage/while_early_ret.rs -Combined regions: - 5:9 -> 5:27 (count=1) - 7:9 -> 9:10 (count=7) - 12:13 -> 14:14 (count=7) - 18:21 -> 20:22 (count=1) - 22:21 -> 22:27 (count=0) - 26:21 -> 26:27 (count=1) - 30:9 -> 32:10 (count=6) - 35:5 -> 35:11 (count=0) - 36:1 -> 36:2 (count=1) -Segment at 5:9 (count = 1), RegionEntry -Segment at 5:27 (count = 0), Skipped -Segment at 7:9 (count = 7), RegionEntry -Segment at 9:10 (count = 0), Skipped -Segment at 12:13 (count = 7), RegionEntry -Segment at 14:14 (count = 0), Skipped -Segment at 18:21 (count = 1), RegionEntry -Segment at 20:22 (count = 0), Skipped -Segment at 22:21 (count = 0), RegionEntry -Segment at 22:27 (count = 0), Skipped -Segment at 26:21 (count = 1), RegionEntry -Segment at 26:27 (count = 0), Skipped -Segment at 30:9 (count = 6), RegionEntry -Segment at 32:10 (count = 0), Skipped -Segment at 35:5 (count = 0), RegionEntry -Segment at 35:11 (count = 0), Skipped -Segment at 36:1 (count = 1), RegionEntry -Segment at 36:2 (count = 0), Skipped diff --git a/src/test/run-make-fulldeps/coverage-reports-deadcode/Makefile b/src/test/run-make-fulldeps/coverage-reports-deadcode/Makefile deleted file mode 100644 index b6a9acbf18b3c..0000000000000 --- a/src/test/run-make-fulldeps/coverage-reports-deadcode/Makefile +++ /dev/null @@ -1,15 +0,0 @@ -# needs-profiler-support -# ignore-msvc -# ignore-windows-gnu - -# FIXME(mati865): MinGW GCC miscompiles compiler-rt profiling library but with Clang it works -# properly. Since we only have GCC on the CI ignore the test for now. - -# LINK_DEAD_CODE requires ignore-msvc due to Issue #76038 -LINK_DEAD_CODE=yes - --include ../coverage-reports-base/Makefile - -# ISSUE(76038): When targeting MSVC, Rust binaries built with both `-Z instrument-coverage` and -# `-C link-dead-code` typically crash (with a seg-fault) or at best generate an empty `*.profraw`. -# See ../coverage/coverage_tools.mk for more information. diff --git a/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_export_coverage.closure.json b/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_export_coverage.closure.json deleted file mode 100644 index bff55300b3ca3..0000000000000 --- a/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_export_coverage.closure.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "data": [ - { - "files": [ - { - "filename": "../coverage/closure.rs", - "summary": { - "functions": { - "count": 5, - "covered": 3, - "percent": 60 - }, - "instantiations": { - "count": 5, - "covered": 3, - "percent": 60 - }, - "lines": { - "count": 91, - "covered": 77, - "percent": 84.61538461538461 - }, - "regions": { - "count": 25, - "covered": 13, - "notcovered": 12, - "percent": 52 - } - } - } - ], - "totals": { - "functions": { - "count": 5, - "covered": 3, - "percent": 60 - }, - "instantiations": { - "count": 5, - "covered": 3, - "percent": 60 - }, - "lines": { - "count": 91, - "covered": 77, - "percent": 84.61538461538461 - }, - "regions": { - "count": 25, - "covered": 13, - "notcovered": 12, - "percent": 52 - } - } - } - ], - "type": "llvm.coverage.json.export", - "version": "2.0.1" -} diff --git a/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_export_coverage.conditions.json b/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_export_coverage.conditions.json deleted file mode 100644 index ed937a1b13f38..0000000000000 --- a/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_export_coverage.conditions.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "data": [ - { - "files": [ - { - "filename": "../coverage/conditions.rs", - "summary": { - "functions": { - "count": 1, - "covered": 1, - "percent": 100 - }, - "instantiations": { - "count": 1, - "covered": 1, - "percent": 100 - }, - "lines": { - "count": 49, - "covered": 23, - "percent": 46.93877551020408 - }, - "regions": { - "count": 69, - "covered": 18, - "notcovered": 51, - "percent": 26.08695652173913 - } - } - } - ], - "totals": { - "functions": { - "count": 1, - "covered": 1, - "percent": 100 - }, - "instantiations": { - "count": 1, - "covered": 1, - "percent": 100 - }, - "lines": { - "count": 49, - "covered": 23, - "percent": 46.93877551020408 - }, - "regions": { - "count": 69, - "covered": 18, - "notcovered": 51, - "percent": 26.08695652173913 - } - } - } - ], - "type": "llvm.coverage.json.export", - "version": "2.0.1" -} diff --git a/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_export_coverage.if.json b/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_export_coverage.if.json deleted file mode 100644 index 84dcc251f3f4b..0000000000000 --- a/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_export_coverage.if.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "data": [ - { - "files": [ - { - "filename": "../coverage/if.rs", - "summary": { - "functions": { - "count": 1, - "covered": 1, - "percent": 100 - }, - "instantiations": { - "count": 1, - "covered": 1, - "percent": 100 - }, - "lines": { - "count": 19, - "covered": 19, - "percent": 100 - }, - "regions": { - "count": 5, - "covered": 4, - "notcovered": 1, - "percent": 80 - } - } - } - ], - "totals": { - "functions": { - "count": 1, - "covered": 1, - "percent": 100 - }, - "instantiations": { - "count": 1, - "covered": 1, - "percent": 100 - }, - "lines": { - "count": 19, - "covered": 19, - "percent": 100 - }, - "regions": { - "count": 5, - "covered": 4, - "notcovered": 1, - "percent": 80 - } - } - } - ], - "type": "llvm.coverage.json.export", - "version": "2.0.1" -} diff --git a/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_export_coverage.inner_items.json b/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_export_coverage.inner_items.json deleted file mode 100644 index c178e7f93476f..0000000000000 --- a/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_export_coverage.inner_items.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "data": [ - { - "files": [ - { - "filename": "../coverage/inner_items.rs", - "summary": { - "functions": { - "count": 4, - "covered": 4, - "percent": 100 - }, - "instantiations": { - "count": 4, - "covered": 4, - "percent": 100 - }, - "lines": { - "count": 26, - "covered": 26, - "percent": 100 - }, - "regions": { - "count": 15, - "covered": 13, - "notcovered": 2, - "percent": 86.66666666666667 - } - } - } - ], - "totals": { - "functions": { - "count": 4, - "covered": 4, - "percent": 100 - }, - "instantiations": { - "count": 4, - "covered": 4, - "percent": 100 - }, - "lines": { - "count": 26, - "covered": 26, - "percent": 100 - }, - "regions": { - "count": 15, - "covered": 13, - "notcovered": 2, - "percent": 86.66666666666667 - } - } - } - ], - "type": "llvm.coverage.json.export", - "version": "2.0.1" -} diff --git a/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_export_coverage.nested_loops.json b/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_export_coverage.nested_loops.json deleted file mode 100644 index 68163eb763619..0000000000000 --- a/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_export_coverage.nested_loops.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "data": [ - { - "files": [ - { - "filename": "../coverage/nested_loops.rs", - "summary": { - "functions": { - "count": 1, - "covered": 1, - "percent": 100 - }, - "instantiations": { - "count": 1, - "covered": 1, - "percent": 100 - }, - "lines": { - "count": 21, - "covered": 16, - "percent": 76.19047619047619 - }, - "regions": { - "count": 18, - "covered": 14, - "notcovered": 4, - "percent": 77.77777777777779 - } - } - } - ], - "totals": { - "functions": { - "count": 1, - "covered": 1, - "percent": 100 - }, - "instantiations": { - "count": 1, - "covered": 1, - "percent": 100 - }, - "lines": { - "count": 21, - "covered": 16, - "percent": 76.19047619047619 - }, - "regions": { - "count": 18, - "covered": 14, - "notcovered": 4, - "percent": 77.77777777777779 - } - } - } - ], - "type": "llvm.coverage.json.export", - "version": "2.0.1" -} diff --git a/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_export_coverage.partial_eq.json b/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_export_coverage.partial_eq.json deleted file mode 100644 index bc0d0088041a8..0000000000000 --- a/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_export_coverage.partial_eq.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "data": [ - { - "files": [ - { - "filename": "../coverage/partial_eq.rs", - "summary": { - "functions": { - "count": 5, - "covered": 5, - "percent": 100 - }, - "instantiations": { - "count": 8, - "covered": 5, - "percent": 62.5 - }, - "lines": { - "count": 15, - "covered": 15, - "percent": 100 - }, - "regions": { - "count": 6, - "covered": 6, - "notcovered": 0, - "percent": 100 - } - } - } - ], - "totals": { - "functions": { - "count": 5, - "covered": 5, - "percent": 100 - }, - "instantiations": { - "count": 8, - "covered": 5, - "percent": 62.5 - }, - "lines": { - "count": 15, - "covered": 15, - "percent": 100 - }, - "regions": { - "count": 6, - "covered": 6, - "notcovered": 0, - "percent": 100 - } - } - } - ], - "type": "llvm.coverage.json.export", - "version": "2.0.1" -} diff --git a/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_export_coverage.simple_loop.json b/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_export_coverage.simple_loop.json deleted file mode 100644 index ada6bb062dd1e..0000000000000 --- a/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_export_coverage.simple_loop.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "data": [ - { - "files": [ - { - "filename": "../coverage/simple_loop.rs", - "summary": { - "functions": { - "count": 1, - "covered": 1, - "percent": 100 - }, - "instantiations": { - "count": 1, - "covered": 1, - "percent": 100 - }, - "lines": { - "count": 19, - "covered": 19, - "percent": 100 - }, - "regions": { - "count": 9, - "covered": 8, - "notcovered": 1, - "percent": 88.88888888888889 - } - } - } - ], - "totals": { - "functions": { - "count": 1, - "covered": 1, - "percent": 100 - }, - "instantiations": { - "count": 1, - "covered": 1, - "percent": 100 - }, - "lines": { - "count": 19, - "covered": 19, - "percent": 100 - }, - "regions": { - "count": 9, - "covered": 8, - "notcovered": 1, - "percent": 88.88888888888889 - } - } - } - ], - "type": "llvm.coverage.json.export", - "version": "2.0.1" -} diff --git a/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_show_coverage.closure.txt b/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_show_coverage.closure.txt deleted file mode 100644 index aef26a62e25fb..0000000000000 --- a/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_show_coverage.closure.txt +++ /dev/null @@ -1,94 +0,0 @@ - 1| |#![allow(unused_assignments, unused_variables)] - 2| | - 3| 1|fn main() { - 4| 1| // Initialize test constants in a way that cannot be determined at compile time, to ensure - 5| 1| // rustc and LLVM cannot optimize out statements (or coverage counters) downstream from - 6| 1| // dependent conditions. - 7| 1| let is_true = std::env::args().len() == 1; - 8| 1| let is_false = ! is_true; - 9| 1| - 10| 1| let mut some_string = Some(String::from("the string content")); - 11| 1| println!( - 12| 1| "The string or alt: {}" - 13| 1| , - 14| 1| some_string - 15| 1| . - 16| 1| unwrap_or_else - 17| 1| ( - 18| 1| || - 19| | { - 20| 0| let mut countdown = 0; - 21| 0| if is_false { - 22| 0| countdown = 10; - 23| 0| } - 24| 0| "alt string 1".to_owned() - 25| 1| } - 26| 1| ) - 27| 1| ); - 28| 1| - 29| 1| some_string = Some(String::from("the string content")); - 30| 1| let - 31| 1| a - 32| 1| = - 33| 1| || - 34| | { - 35| 0| let mut countdown = 0; - 36| 0| if is_false { - 37| 0| countdown = 10; - 38| 0| } - 39| 0| "alt string 2".to_owned() - 40| 1| }; - 41| 1| println!( - 42| 1| "The string or alt: {}" - 43| 1| , - 44| 1| some_string - 45| 1| . - 46| 1| unwrap_or_else - 47| 1| ( - 48| 1| a - 49| 1| ) - 50| 1| ); - 51| 1| - 52| 1| some_string = None; - 53| 1| println!( - 54| 1| "The string or alt: {}" - 55| 1| , - 56| 1| some_string - 57| 1| . - 58| 1| unwrap_or_else - 59| 1| ( - 60| 1| || - 61| | { - 62| 1| let mut countdown = 0; - 63| 1| if is_false { - 64| 0| countdown = 10; - 65| 1| } - 66| 1| "alt string 3".to_owned() - 67| 1| } - 68| 1| ) - 69| 1| ); - 70| 1| - 71| 1| some_string = None; - 72| 1| let - 73| 1| a - 74| 1| = - 75| 1| || - 76| | { - 77| 1| let mut countdown = 0; - 78| 1| if is_false { - 79| 0| countdown = 10; - 80| 1| } - 81| 1| "alt string 4".to_owned() - 82| 1| }; - 83| 1| println!( - 84| 1| "The string or alt: {}" - 85| 1| , - 86| 1| some_string - 87| 1| . - 88| 1| unwrap_or_else - 89| 1| ( - 90| 1| a - 91| 1| ) - 92| 1| ); - 93| 1|} - diff --git a/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_show_coverage.conditions.txt b/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_show_coverage.conditions.txt deleted file mode 100644 index 173ff4aa4c481..0000000000000 --- a/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_show_coverage.conditions.txt +++ /dev/null @@ -1,69 +0,0 @@ - 1| |#![allow(unused_assignments, unused_variables)] - 2| | - 3| |fn main() { - 4| 1| let mut countdown = 0; - 5| 1| if true { - 6| 1| countdown = 10; - 7| 1| } - 8| | - 9| | const B: u32 = 100; - 10| 1| let x = if countdown > 7 { - 11| 1| countdown -= 4; - 12| 1| B - 13| 0| } else if countdown > 2 { - 14| 0| if countdown < 1 || countdown > 5 || countdown != 9 { - 15| 0| countdown = 0; - 16| 0| } - 17| 0| countdown -= 5; - 18| 0| countdown - 19| | } else { - 20| 0| return; - 21| | }; - 22| | - 23| 1| let mut countdown = 0; - 24| 1| if true { - 25| 1| countdown = 10; - 26| 1| } - 27| | - 28| 1| if countdown > 7 { - 29| 1| countdown -= 4; - 30| 0| } else if countdown > 2 { - 31| 0| if countdown < 1 || countdown > 5 || countdown != 9 { - 32| 0| countdown = 0; - 33| 0| } - 34| 0| countdown -= 5; - 35| | } else { - 36| 0| return; - 37| | } - 38| | - 39| 1| let mut countdown = 0; - 40| 1| if true { - 41| 1| countdown = 1; - 42| 1| } - 43| | - 44| 1| let z = if countdown > 7 { - ^0 - 45| 0| countdown -= 4; - 46| 1| } else if countdown > 2 { - 47| 0| if countdown < 1 || countdown > 5 || countdown != 9 { - 48| 0| countdown = 0; - 49| 0| } - 50| 0| countdown -= 5; - 51| | } else { - 52| 1| let should_be_reachable = countdown; - 53| 1| println!("reached"); - 54| 1| return; - 55| | }; - 56| | - 57| 0| let w = if countdown > 7 { - 58| 0| countdown -= 4; - 59| 0| } else if countdown > 2 { - 60| 0| if countdown < 1 || countdown > 5 || countdown != 9 { - 61| 0| countdown = 0; - 62| 0| } - 63| 0| countdown -= 5; - 64| | } else { - 65| 0| return; - 66| | }; - 67| 1|} - diff --git a/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_show_coverage.drop_trait.txt b/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_show_coverage.drop_trait.txt deleted file mode 100644 index 72aa020ca1691..0000000000000 --- a/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_show_coverage.drop_trait.txt +++ /dev/null @@ -1,34 +0,0 @@ - 1| |#![allow(unused_assignments)] - 2| |// expect-exit-status-1 - 3| | - 4| |struct Firework { - 5| | strength: i32, - 6| |} - 7| | - 8| |impl Drop for Firework { - 9| 2| fn drop(&mut self) { - 10| 2| println!("BOOM times {}!!!", self.strength); - 11| 2| } - 12| |} - 13| | - 14| |fn main() -> Result<(),u8> { - 15| 1| let _firecracker = Firework { strength: 1 }; - 16| 1| - 17| 1| let _tnt = Firework { strength: 100 }; - 18| | - 19| 1| if true { - 20| 1| println!("Exiting with error..."); - 21| 1| return Err(1); - 22| | } - 23| | - 24| | let _ = Firework { strength: 1000 }; - 25| | - 26| | Ok(()) - 27| 1|} - 28| | - 29| |// Expected program output: - 30| |// Exiting with error... - 31| |// BOOM times 100!!! - 32| |// BOOM times 1!!! - 33| |// Error: 1 - diff --git a/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_show_coverage.if.txt b/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_show_coverage.if.txt deleted file mode 100644 index 85e6440ab3729..0000000000000 --- a/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_show_coverage.if.txt +++ /dev/null @@ -1,30 +0,0 @@ - 1| |#![allow(unused_assignments, unused_variables)] - 2| | - 3| |fn main() { - 4| | // Initialize test constants in a way that cannot be determined at compile time, to ensure - 5| | // rustc and LLVM cannot optimize out statements (or coverage counters) downstream from - 6| | // dependent conditions. - 7| | let - 8| 1| is_true - 9| 1| = - 10| 1| std::env::args().len() - 11| 1| == - 12| 1| 1 - 13| 1| ; - 14| 1| let - 15| 1| mut - 16| 1| countdown - 17| 1| = - 18| 1| 0 - 19| | ; - 20| | if - 21| 1| is_true - 22| 1| { - 23| 1| countdown - 24| 1| = - 25| 1| 10 - 26| 1| ; - 27| 1| } - ^0 - 28| 1|} - diff --git a/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_show_coverage.lazy_boolean.txt b/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_show_coverage.lazy_boolean.txt deleted file mode 100644 index 1b503033911c5..0000000000000 --- a/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_show_coverage.lazy_boolean.txt +++ /dev/null @@ -1,65 +0,0 @@ - 1| |#![allow(unused_assignments, unused_variables)] - 2| | - 3| |fn main() { - 4| | // Initialize test constants in a way that cannot be determined at compile time, to ensure - 5| | // rustc and LLVM cannot optimize out statements (or coverage counters) downstream from - 6| | // dependent conditions. - 7| 1| let is_true = std::env::args().len() == 1; - 8| 1| - 9| 1| let (mut a, mut b, mut c) = (0, 0, 0); - 10| 1| if is_true { - 11| 1| a = 1; - 12| 1| b = 10; - 13| 1| c = 100; - 14| 1| } - ^0 - 15| | let - 16| 1| somebool - 17| | = - 18| 1| a < b - 19| | || - 20| 1| b < c - ^0 - 21| | ; - 22| | let - 23| 1| somebool - 24| | = - 25| 1| b < a - 26| | || - 27| 1| b < c - 28| | ; - 29| 1| let somebool = a < b && b < c; - 30| 1| let somebool = b < a && b < c; - ^0 - 31| | - 32| | if - 33| 1| ! - 34| 1| is_true - 35| 0| { - 36| 0| a = 2 - 37| 0| ; - 38| 1| } - 39| | - 40| | if - 41| 1| is_true - 42| 1| { - 43| 1| b = 30 - 44| 1| ; - 45| 1| } - 46| | else - 47| 0| { - 48| 0| c = 400 - 49| 0| ; - 50| 0| } - 51| | - 52| 1| if !is_true { - 53| 0| a = 2; - 54| 1| } - 55| | - 56| 1| if is_true { - 57| 1| b = 30; - 58| 1| } else { - 59| 0| c = 400; - 60| 0| } - 61| 1|} - diff --git a/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_show_coverage.loop_break_value.txt b/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_show_coverage.loop_break_value.txt deleted file mode 100644 index b0d668c6d76da..0000000000000 --- a/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_show_coverage.loop_break_value.txt +++ /dev/null @@ -1,14 +0,0 @@ - 1| |#![allow(unused_assignments)] - 2| | - 3| 1|fn main() { - 4| 1| let result - 5| 1| = - 6| 1| loop - 7| 1| { - 8| 1| break - 9| 1| 10 - 10| 1| ; - 11| 1| } - 12| 1| ; - 13| 1|} - diff --git a/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_show_coverage.loops_branches.txt b/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_show_coverage.loops_branches.txt deleted file mode 100644 index 3a969a6b89869..0000000000000 --- a/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_show_coverage.loops_branches.txt +++ /dev/null @@ -1,38 +0,0 @@ - 1| |#![allow(unused_assignments)] - 2| | - 3| |// This test confirms an earlier problem was resolved, supporting the MIR graph generated by the - 4| |// structure of this `fmt` function. - 5| | - 6| |struct DebugTest; - 7| | - 8| |impl std::fmt::Debug for DebugTest { - 9| | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - 10| 1| if true { - 11| 1| if false { - 12| | while true { - 13| | } - 14| 1| } - 15| 1| write!(f, "error")?; - ^0 - 16| | } else { - 17| 1| } - 18| 1| Ok(()) - 19| 1| } - 20| |} - 21| | - 22| 1|fn main() { - 23| 1| let debug_test = DebugTest; - 24| 1| println!("{:?}", debug_test); - 25| 1|} - 26| | - 27| |/* - 28| | - 29| |This is the error message generated, before the issue was fixed: - 30| | - 31| |error: internal compiler error: compiler/rustc_mir/src/transform/coverage/mod.rs:374:42: - 32| |Error processing: DefId(0:6 ~ bug_incomplete_cov_graph_traversal_simplified[317d]::{impl#0}::fmt): - 33| |Error { message: "`TraverseCoverageGraphWithLoops` missed some `BasicCoverageBlock`s: - 34| |[bcb6, bcb7, bcb9]" } - 35| | - 36| |*/ - diff --git a/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_show_coverage.partial_eq.txt b/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_show_coverage.partial_eq.txt deleted file mode 100644 index d16a0a9c4c8c4..0000000000000 --- a/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_show_coverage.partial_eq.txt +++ /dev/null @@ -1,111 +0,0 @@ - 1| |// This test confirms an earlier problem was resolved, supporting the MIR graph generated by the - 2| |// structure of this test. - 3| | - 4| 2|#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)] - ^1 ^1 - ------------------ - | Unexecuted instantiation: ::gt - ------------------ - | Unexecuted instantiation: ::le - ------------------ - | Unexecuted instantiation: ::ge - ------------------ - | ::lt: - | 4| 1|#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)] - ------------------ - 5| |pub struct Version { - 6| | major: usize, - 7| 1| minor: usize, - 8| | patch: usize, - 9| |} - 10| | - 11| |impl Version { - 12| | pub fn new(major: usize, minor: usize, patch: usize) -> Self { - 13| 2| Self { - 14| 2| major, - 15| 2| minor, - 16| 2| patch, - 17| 2| } - 18| 2| } - 19| |} - 20| | - 21| 1|fn main() { - 22| 1| let version_3_2_1 = Version::new(3, 2, 1); - 23| 1| let version_3_3_0 = Version::new(3, 3, 0); - 24| 1| - 25| 1| println!("{:?} < {:?} = {}", version_3_2_1, version_3_3_0, version_3_2_1 < version_3_3_0); - 26| 1|} - 27| | - 28| |/* - 29| | - 30| |This test verifies a bug was fixed that otherwise generated this error: - 31| | - 32| |thread 'rustc' panicked at 'No counters provided the source_hash for function: - 33| | Instance { - 34| | def: Item(WithOptConstParam { - 35| | did: DefId(0:101 ~ autocfg[c44a]::version::{impl#2}::partial_cmp), - 36| | const_param_did: None - 37| | }), - 38| | substs: [] - 39| | }' - 40| |The `PartialOrd` derived by `Version` happened to generate a MIR that generated coverage - 41| |without a code region associated with any `Counter`. Code regions were associated with at least - 42| |one expression, which is allowed, but the `function_source_hash` was only passed to the codegen - 43| |(coverage mapgen) phase from a `Counter`s code region. A new method was added to pass the - 44| |`function_source_hash` without a code region, if necessary. - 45| | - 46| |*/ - 47| | - 48| |// FIXME(richkadel): It may be worth investigating why the coverage report for this test produces - 49| |// the following results: - 50| | - 51| |/* - 52| | - 53| |1. Why are their two counts below different characters (first and last) of `PartialOrd`, on line 17? - 54| | - 55| |2. Line 17 is counted twice, but the `::lt` instance shows a line count of 1? Is there a missing - 56| | line count with a different instance? Or was it really only called once? - 57| | - 58| |3. Line 20 shows another line count (of 1) for a line within a `struct` declaration (on only one of - 59| | its 3 fields). I doubt the specific field (`minor`) is relevant, but rather I suspect there's a - 60| | problem computing the file position here, for some reason. - 61| | - 62| | - 63| | 16| | - 64| | 17| 2|#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)] - 65| | ^1 ^1 - 66| |------------------ - 67| ||Unexecuted instantiation: ::gt - 68| |------------------ - 69| ||Unexecuted instantiation: ::le - 70| |------------------ - 71| ||Unexecuted instantiation: ::ge - 72| |------------------ - 73| ||::lt: - 74| || 17| 1|#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)] - 75| |------------------ - 76| | 18| |pub struct Version { - 77| | 19| | major: usize, - 78| | 20| 1| minor: usize, - 79| | 21| | patch: usize, - 80| | 22| |} - 81| | 23| | - 82| | 24| |impl Version { - 83| | 25| | pub fn new(major: usize, minor: usize, patch: usize) -> Self { - 84| | 26| 2| Version { - 85| | 27| 2| major, - 86| | 28| 2| minor, - 87| | 29| 2| patch, - 88| | 30| 2| } - 89| | 31| 2| } - 90| | 32| |} - 91| | 33| | - 92| | 34| 1|fn main() { - 93| | 35| 1| let version_3_2_1 = Version::new(3, 2, 1); - 94| | 36| 1| let version_3_3_0 = Version::new(3, 3, 0); - 95| | 37| 1| - 96| | 38| 1| println!("{:?} < {:?} = {}", version_3_2_1, version_3_3_0, version_3_2_1 < version - 97| |_3_3_0); - 98| | 39| 1|} - 99| |*/ - diff --git a/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_show_coverage.simple_match.txt b/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_show_coverage.simple_match.txt deleted file mode 100644 index 1f7e71d3eb0e7..0000000000000 --- a/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_show_coverage.simple_match.txt +++ /dev/null @@ -1,46 +0,0 @@ - 1| |#![allow(unused_assignments)] - 2| | - 3| |fn main() { - 4| | // Initialize test constants in a way that cannot be determined at compile time, to ensure - 5| | // rustc and LLVM cannot optimize out statements (or coverage counters) downstream from - 6| | // dependent conditions. - 7| 1| let is_true = std::env::args().len() == 1; - 8| 1| - 9| 1| let mut countdown = 1; - 10| 1| if is_true { - 11| 1| countdown = 0; - 12| 1| } - ^0 - 13| | - 14| | for - 15| 2| _ - 16| | in - 17| 3| 0..2 - 18| | { - 19| | let z - 20| | ; - 21| | match - 22| 2| countdown - 23| | { - 24| 1| x - 25| | if - 26| 2| x - 27| 2| < - 28| 2| 1 - ^1 - 29| | => - 30| 1| { - 31| 1| z = countdown - 32| 1| ; - 33| 1| let y = countdown - 34| 1| ; - 35| 1| countdown = 10 - 36| 1| ; - 37| 1| } - 38| | _ - 39| | => - 40| 1| {} - 41| | } - 42| 3| } - 43| 1|} - diff --git a/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_show_coverage.tight_inf_loop.txt b/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_show_coverage.tight_inf_loop.txt deleted file mode 100644 index e02eac03a6b15..0000000000000 --- a/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_show_coverage.tight_inf_loop.txt +++ /dev/null @@ -1,6 +0,0 @@ - 1| |fn main() { - 2| 1| if false { - 3| | loop {} - 4| | } - 5| 1|} - diff --git a/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_show_coverage.while.txt b/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_show_coverage.while.txt deleted file mode 100644 index 194325b6b9eca..0000000000000 --- a/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_show_coverage.while.txt +++ /dev/null @@ -1,6 +0,0 @@ - 1| |fn main() { - 2| 1| let num = 9; - 3| 1| while num >= 10 { - 4| 0| } - 5| 1|} - diff --git a/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_show_coverage.while_early_ret.txt b/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_show_coverage.while_early_ret.txt deleted file mode 100644 index 26041136d2f4c..0000000000000 --- a/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_show_coverage.while_early_ret.txt +++ /dev/null @@ -1,48 +0,0 @@ - 1| |#![allow(unused_assignments)] - 2| |// expect-exit-status-1 - 3| | - 4| |fn main() -> Result<(),u8> { - 5| 1| let mut countdown = 10; - 6| | while - 7| 7| countdown - 8| 7| > - 9| 7| 0 - 10| | { - 11| | if - 12| 7| countdown - 13| 7| < - 14| 7| 5 - 15| | { - 16| | return - 17| | if - 18| 1| countdown - 19| 1| > - 20| 1| 8 - 21| | { - 22| 0| Ok(()) - 23| | } - 24| | else - 25| | { - 26| 1| Err(1) - 27| | } - 28| | ; - 29| | } - 30| 6| countdown - 31| 6| -= - 32| 6| 1 - 33| | ; - 34| | } - 35| 0| Ok(()) - 36| 1|} - 37| | - 38| |// ISSUE(77553): Originally, this test had `Err(1)` on line 22 (instead of `Ok(())`) and - 39| |// `std::process::exit(2)` on line 26 (instead of `Err(1)`); and this worked as expected on Linux - 40| |// and MacOS. But on Windows (MSVC, at least), the call to `std::process::exit()` exits the program - 41| |// without saving the InstrProf coverage counters. The use of `std::process:exit()` is not critical - 42| |// to the coverage test for early returns, but this is a limitation that should be fixed. - 43| |// - 44| |// FIXME(richkadel): Consider creating a new tests for coverage when calling `std::process::exit()`, - 45| |// move the `ISSUE` comment to that test, and implement a new test directive that supports skipping - 46| |// coverage tests when targeting specific platforms (at least skipping Windows, or MSVC if the - 47| |// problem exists on MSVC only). - diff --git a/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_show_coverage_counters.closure.txt b/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_show_coverage_counters.closure.txt deleted file mode 100644 index fb797796e4e7d..0000000000000 --- a/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_show_coverage_counters.closure.txt +++ /dev/null @@ -1,94 +0,0 @@ -Counter in file 0 20:21 -> 20:38, #1 -Counter in file 0 21:20 -> 21:28, (#1 + 0) -Counter in file 0 21:29 -> 23:18, #2 -Counter in file 0 23:18 -> 23:19, (#1 - #2) -Counter in file 0 24:17 -> 25:14, (#2 + (#1 - #2)) -Counter in file 0 3:11 -> 18:13, #1 -Counter in file 0 25:14 -> 33:9, (#1 + 0) -Counter in file 0 40:6 -> 60:13, (#1 + 0) -Counter in file 0 67:14 -> 75:9, (#1 + 0) -Counter in file 0 82:6 -> 93:2, (#1 + 0) -Counter in file 0 77:13 -> 77:30, #1 -Counter in file 0 78:12 -> 78:20, (#1 + 0) -Counter in file 0 78:21 -> 80:10, #2 -Counter in file 0 80:10 -> 80:11, (#1 - #2) -Counter in file 0 81:9 -> 82:6, (#2 + (#1 - #2)) -Counter in file 0 62:21 -> 62:38, #1 -Counter in file 0 63:20 -> 63:28, (#1 + 0) -Counter in file 0 63:29 -> 65:18, #2 -Counter in file 0 65:18 -> 65:19, (#1 - #2) -Counter in file 0 66:17 -> 67:14, (#2 + (#1 - #2)) -Counter in file 0 35:13 -> 35:30, #1 -Counter in file 0 36:12 -> 36:20, (#1 + 0) -Counter in file 0 36:21 -> 38:10, #2 -Counter in file 0 38:10 -> 38:11, (#1 - #2) -Counter in file 0 39:9 -> 40:6, (#2 + (#1 - #2)) -Emitting segments for file: ../coverage/closure.rs -Combined regions: - 3:11 -> 18:13 (count=1) - 20:21 -> 20:38 (count=0) - 21:20 -> 21:28 (count=0) - 21:29 -> 23:18 (count=0) - 23:18 -> 23:19 (count=0) - 24:17 -> 25:14 (count=0) - 25:14 -> 33:9 (count=1) - 35:13 -> 35:30 (count=0) - 36:12 -> 36:20 (count=0) - 36:21 -> 38:10 (count=0) - 38:10 -> 38:11 (count=0) - 39:9 -> 40:6 (count=0) - 40:6 -> 60:13 (count=1) - 62:21 -> 62:38 (count=1) - 63:20 -> 63:28 (count=1) - 63:29 -> 65:18 (count=0) - 65:18 -> 65:19 (count=1) - 66:17 -> 67:14 (count=1) - 67:14 -> 75:9 (count=1) - 77:13 -> 77:30 (count=1) - 78:12 -> 78:20 (count=1) - 78:21 -> 80:10 (count=0) - 80:10 -> 80:11 (count=1) - 81:9 -> 82:6 (count=1) - 82:6 -> 93:2 (count=1) -Segment at 3:11 (count = 1), RegionEntry -Segment at 18:13 (count = 0), Skipped -Segment at 20:21 (count = 0), RegionEntry -Segment at 20:38 (count = 0), Skipped -Segment at 21:20 (count = 0), RegionEntry -Segment at 21:28 (count = 0), Skipped -Segment at 21:29 (count = 0), RegionEntry -Segment at 23:18 (count = 0), RegionEntry -Segment at 23:19 (count = 0), Skipped -Segment at 24:17 (count = 0), RegionEntry -Segment at 25:14 (count = 1), RegionEntry -Segment at 33:9 (count = 0), Skipped -Segment at 35:13 (count = 0), RegionEntry -Segment at 35:30 (count = 0), Skipped -Segment at 36:12 (count = 0), RegionEntry -Segment at 36:20 (count = 0), Skipped -Segment at 36:21 (count = 0), RegionEntry -Segment at 38:10 (count = 0), RegionEntry -Segment at 38:11 (count = 0), Skipped -Segment at 39:9 (count = 0), RegionEntry -Segment at 40:6 (count = 1), RegionEntry -Segment at 60:13 (count = 0), Skipped -Segment at 62:21 (count = 1), RegionEntry -Segment at 62:38 (count = 0), Skipped -Segment at 63:20 (count = 1), RegionEntry -Segment at 63:28 (count = 0), Skipped -Segment at 63:29 (count = 0), RegionEntry -Segment at 65:18 (count = 1), RegionEntry -Segment at 65:19 (count = 0), Skipped -Segment at 66:17 (count = 1), RegionEntry -Segment at 67:14 (count = 1), RegionEntry -Segment at 75:9 (count = 0), Skipped -Segment at 77:13 (count = 1), RegionEntry -Segment at 77:30 (count = 0), Skipped -Segment at 78:12 (count = 1), RegionEntry -Segment at 78:20 (count = 0), Skipped -Segment at 78:21 (count = 0), RegionEntry -Segment at 80:10 (count = 1), RegionEntry -Segment at 80:11 (count = 0), Skipped -Segment at 81:9 (count = 1), RegionEntry -Segment at 82:6 (count = 1), RegionEntry -Segment at 93:2 (count = 0), Skipped diff --git a/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_show_coverage_counters.conditions.txt b/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_show_coverage_counters.conditions.txt deleted file mode 100644 index d48cd8074bebb..0000000000000 --- a/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_show_coverage_counters.conditions.txt +++ /dev/null @@ -1,238 +0,0 @@ -Counter in file 0 4:9 -> 4:26, #1 -Counter in file 0 5:8 -> 5:12, (#1 + 0) -Counter in file 0 5:13 -> 7:6, #2 -Counter in file 0 10:9 -> 10:10, (#4 + #11) -Counter in file 0 10:16 -> 10:29, (#2 + 0) -Counter in file 0 11:9 -> 12:10, #4 -Counter in file 0 13:15 -> 13:28, ((#2 + 0) - #3) -Counter in file 0 14:12 -> 14:25, #5 -Counter in file 0 14:29 -> 14:42, (#5 - #13) -Counter in file 0 14:42 -> 14:43, (#13 + #14) -Counter in file 0 14:42 -> 14:43, ((#5 - #13) - #14) -Counter in file 0 14:46 -> 14:60, #21 -Counter in file 0 14:60 -> 14:61, (#17 + #18) -Counter in file 0 14:60 -> 14:61, (#21 - #18) -Counter in file 0 14:61 -> 16:10, #22 -Counter in file 0 16:10 -> 16:11, #23 -Counter in file 0 17:9 -> 18:18, #11 -Counter in file 0 20:9 -> 20:15, (((#2 + 0) - #3) - #5) -Counter in file 0 23:9 -> 23:26, ((#4 + #11) + 0) -Counter in file 0 24:8 -> 24:12, ((#4 + #11) + 0) -Counter in file 0 24:13 -> 26:6, #12 -Counter in file 0 28:8 -> 28:21, (#12 + 0) -Counter in file 0 29:9 -> 29:23, #16 -Counter in file 0 30:15 -> 30:28, ((#12 + 0) - #15) -Counter in file 0 31:12 -> 31:25, (((#12 + 0) - #15) - #8) -Counter in file 0 31:29 -> 31:42, ((((#12 + 0) - #15) - #8) - #24) -Counter in file 0 31:42 -> 31:43, (((((#12 + 0) - #15) - #8) - #24) - #25) -Counter in file 0 31:42 -> 31:43, (#24 + #25) -Counter in file 0 31:46 -> 31:60, #32 -Counter in file 0 31:60 -> 31:61, (#28 + #29) -Counter in file 0 31:60 -> 31:61, (#32 - #29) -Counter in file 0 31:61 -> 33:10, #33 -Counter in file 0 33:10 -> 33:11, #34 -Counter in file 0 34:9 -> 34:23, #19 -Counter in file 0 36:9 -> 36:15, #8 -Counter in file 0 39:9 -> 39:26, (#16 + #19) -Counter in file 0 40:8 -> 40:12, ((#16 + #19) + 0) -Counter in file 0 40:13 -> 42:6, #20 -Counter in file 0 44:9 -> 44:10, (#27 + #30) -Counter in file 0 44:16 -> 44:29, (#20 + 0) -Counter in file 0 45:9 -> 45:23, #27 -Counter in file 0 46:15 -> 46:28, ((#20 + 0) - #26) -Counter in file 0 47:12 -> 47:25, (((#20 + 0) - #26) - #7) -Counter in file 0 47:29 -> 47:42, ((((#20 + 0) - #26) - #7) - #35) -Counter in file 0 47:42 -> 47:43, (#35 + #36) -Counter in file 0 47:42 -> 47:43, (((((#20 + 0) - #26) - #7) - #35) - #36) -Counter in file 0 47:46 -> 47:60, #41 -Counter in file 0 47:60 -> 47:61, (#37 + #38) -Counter in file 0 47:60 -> 47:61, (#41 - #38) -Counter in file 0 47:61 -> 49:10, #42 -Counter in file 0 49:10 -> 49:11, #43 -Counter in file 0 50:9 -> 50:23, #30 -Counter in file 0 52:13 -> 54:15, #7 -Counter in file 0 57:9 -> 57:10, (#9 + #10) -Counter in file 0 57:16 -> 57:29, ((#27 + #30) + 0) -Counter in file 0 58:9 -> 58:23, #9 -Counter in file 0 59:15 -> 59:28, ((#27 + #30) - #31) -Counter in file 0 60:12 -> 60:25, (((#27 + #30) - #31) - #6) -Counter in file 0 60:29 -> 60:42, ((((#27 + #30) - #31) - #6) - #39) -Counter in file 0 60:42 -> 60:43, (#39 + #40) -Counter in file 0 60:42 -> 60:43, (((((#27 + #30) - #31) - #6) - #39) - #40) -Counter in file 0 60:46 -> 60:60, #46 -Counter in file 0 60:60 -> 60:61, (#46 - #45) -Counter in file 0 60:60 -> 60:61, (#44 + #45) -Counter in file 0 60:61 -> 62:10, #47 -Counter in file 0 62:10 -> 62:11, #48 -Counter in file 0 63:9 -> 63:23, #10 -Counter in file 0 65:9 -> 65:15, #6 -Counter in file 0 67:1 -> 67:2, ((#9 + #10) + (((#6 + #7) + #8) + (((#2 + 0) - #3) - #5))) -Emitting segments for file: ../coverage/conditions.rs -Combined regions: - 4:9 -> 4:26 (count=1) - 5:8 -> 5:12 (count=1) - 5:13 -> 7:6 (count=1) - 10:9 -> 10:10 (count=1) - 10:16 -> 10:29 (count=1) - 11:9 -> 12:10 (count=1) - 13:15 -> 13:28 (count=0) - 14:12 -> 14:25 (count=0) - 14:29 -> 14:42 (count=0) - 14:42 -> 14:43 (count=0) - 14:46 -> 14:60 (count=0) - 14:60 -> 14:61 (count=0) - 14:61 -> 16:10 (count=0) - 16:10 -> 16:11 (count=0) - 17:9 -> 18:18 (count=0) - 20:9 -> 20:15 (count=0) - 23:9 -> 23:26 (count=1) - 24:8 -> 24:12 (count=1) - 24:13 -> 26:6 (count=1) - 28:8 -> 28:21 (count=1) - 29:9 -> 29:23 (count=1) - 30:15 -> 30:28 (count=0) - 31:12 -> 31:25 (count=0) - 31:29 -> 31:42 (count=0) - 31:42 -> 31:43 (count=0) - 31:46 -> 31:60 (count=0) - 31:60 -> 31:61 (count=0) - 31:61 -> 33:10 (count=0) - 33:10 -> 33:11 (count=0) - 34:9 -> 34:23 (count=0) - 36:9 -> 36:15 (count=0) - 39:9 -> 39:26 (count=1) - 40:8 -> 40:12 (count=1) - 40:13 -> 42:6 (count=1) - 44:9 -> 44:10 (count=0) - 44:16 -> 44:29 (count=1) - 45:9 -> 45:23 (count=0) - 46:15 -> 46:28 (count=1) - 47:12 -> 47:25 (count=0) - 47:29 -> 47:42 (count=0) - 47:42 -> 47:43 (count=0) - 47:46 -> 47:60 (count=0) - 47:60 -> 47:61 (count=0) - 47:61 -> 49:10 (count=0) - 49:10 -> 49:11 (count=0) - 50:9 -> 50:23 (count=0) - 52:13 -> 54:15 (count=1) - 57:9 -> 57:10 (count=0) - 57:16 -> 57:29 (count=0) - 58:9 -> 58:23 (count=0) - 59:15 -> 59:28 (count=0) - 60:12 -> 60:25 (count=0) - 60:29 -> 60:42 (count=0) - 60:42 -> 60:43 (count=0) - 60:46 -> 60:60 (count=0) - 60:60 -> 60:61 (count=0) - 60:61 -> 62:10 (count=0) - 62:10 -> 62:11 (count=0) - 63:9 -> 63:23 (count=0) - 65:9 -> 65:15 (count=0) - 67:1 -> 67:2 (count=1) -Segment at 4:9 (count = 1), RegionEntry -Segment at 4:26 (count = 0), Skipped -Segment at 5:8 (count = 1), RegionEntry -Segment at 5:12 (count = 0), Skipped -Segment at 5:13 (count = 1), RegionEntry -Segment at 7:6 (count = 0), Skipped -Segment at 10:9 (count = 1), RegionEntry -Segment at 10:10 (count = 0), Skipped -Segment at 10:16 (count = 1), RegionEntry -Segment at 10:29 (count = 0), Skipped -Segment at 11:9 (count = 1), RegionEntry -Segment at 12:10 (count = 0), Skipped -Segment at 13:15 (count = 0), RegionEntry -Segment at 13:28 (count = 0), Skipped -Segment at 14:12 (count = 0), RegionEntry -Segment at 14:25 (count = 0), Skipped -Segment at 14:29 (count = 0), RegionEntry -Segment at 14:42 (count = 0), RegionEntry -Segment at 14:43 (count = 0), Skipped -Segment at 14:46 (count = 0), RegionEntry -Segment at 14:60 (count = 0), RegionEntry -Segment at 14:61 (count = 0), RegionEntry -Segment at 16:10 (count = 0), RegionEntry -Segment at 16:11 (count = 0), Skipped -Segment at 17:9 (count = 0), RegionEntry -Segment at 18:18 (count = 0), Skipped -Segment at 20:9 (count = 0), RegionEntry -Segment at 20:15 (count = 0), Skipped -Segment at 23:9 (count = 1), RegionEntry -Segment at 23:26 (count = 0), Skipped -Segment at 24:8 (count = 1), RegionEntry -Segment at 24:12 (count = 0), Skipped -Segment at 24:13 (count = 1), RegionEntry -Segment at 26:6 (count = 0), Skipped -Segment at 28:8 (count = 1), RegionEntry -Segment at 28:21 (count = 0), Skipped -Segment at 29:9 (count = 1), RegionEntry -Segment at 29:23 (count = 0), Skipped -Segment at 30:15 (count = 0), RegionEntry -Segment at 30:28 (count = 0), Skipped -Segment at 31:12 (count = 0), RegionEntry -Segment at 31:25 (count = 0), Skipped -Segment at 31:29 (count = 0), RegionEntry -Segment at 31:42 (count = 0), RegionEntry -Segment at 31:43 (count = 0), Skipped -Segment at 31:46 (count = 0), RegionEntry -Segment at 31:60 (count = 0), RegionEntry -Segment at 31:61 (count = 0), RegionEntry -Segment at 33:10 (count = 0), RegionEntry -Segment at 33:11 (count = 0), Skipped -Segment at 34:9 (count = 0), RegionEntry -Segment at 34:23 (count = 0), Skipped -Segment at 36:9 (count = 0), RegionEntry -Segment at 36:15 (count = 0), Skipped -Segment at 39:9 (count = 1), RegionEntry -Segment at 39:26 (count = 0), Skipped -Segment at 40:8 (count = 1), RegionEntry -Segment at 40:12 (count = 0), Skipped -Segment at 40:13 (count = 1), RegionEntry -Segment at 42:6 (count = 0), Skipped -Segment at 44:9 (count = 0), RegionEntry -Segment at 44:10 (count = 0), Skipped -Segment at 44:16 (count = 1), RegionEntry -Segment at 44:29 (count = 0), Skipped -Segment at 45:9 (count = 0), RegionEntry -Segment at 45:23 (count = 0), Skipped -Segment at 46:15 (count = 1), RegionEntry -Segment at 46:28 (count = 0), Skipped -Segment at 47:12 (count = 0), RegionEntry -Segment at 47:25 (count = 0), Skipped -Segment at 47:29 (count = 0), RegionEntry -Segment at 47:42 (count = 0), RegionEntry -Segment at 47:43 (count = 0), Skipped -Segment at 47:46 (count = 0), RegionEntry -Segment at 47:60 (count = 0), RegionEntry -Segment at 47:61 (count = 0), RegionEntry -Segment at 49:10 (count = 0), RegionEntry -Segment at 49:11 (count = 0), Skipped -Segment at 50:9 (count = 0), RegionEntry -Segment at 50:23 (count = 0), Skipped -Segment at 52:13 (count = 1), RegionEntry -Segment at 54:15 (count = 0), Skipped -Segment at 57:9 (count = 0), RegionEntry -Segment at 57:10 (count = 0), Skipped -Segment at 57:16 (count = 0), RegionEntry -Segment at 57:29 (count = 0), Skipped -Segment at 58:9 (count = 0), RegionEntry -Segment at 58:23 (count = 0), Skipped -Segment at 59:15 (count = 0), RegionEntry -Segment at 59:28 (count = 0), Skipped -Segment at 60:12 (count = 0), RegionEntry -Segment at 60:25 (count = 0), Skipped -Segment at 60:29 (count = 0), RegionEntry -Segment at 60:42 (count = 0), RegionEntry -Segment at 60:43 (count = 0), Skipped -Segment at 60:46 (count = 0), RegionEntry -Segment at 60:60 (count = 0), RegionEntry -Segment at 60:61 (count = 0), RegionEntry -Segment at 62:10 (count = 0), RegionEntry -Segment at 62:11 (count = 0), Skipped -Segment at 63:9 (count = 0), RegionEntry -Segment at 63:23 (count = 0), Skipped -Segment at 65:9 (count = 0), RegionEntry -Segment at 65:15 (count = 0), Skipped -Segment at 67:1 (count = 1), RegionEntry -Segment at 67:2 (count = 0), Skipped diff --git a/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_show_coverage_counters.drop_trait.txt b/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_show_coverage_counters.drop_trait.txt deleted file mode 100644 index 375025fe8bcc2..0000000000000 --- a/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_show_coverage_counters.drop_trait.txt +++ /dev/null @@ -1,22 +0,0 @@ -Counter in file 0 9:24 -> 11:6, #1 -Counter in file 0 15:9 -> 17:42, #1 -Counter in file 0 19:8 -> 19:12, (#1 + 0) -Counter in file 0 20:9 -> 21:22, #2 -Counter in file 0 27:1 -> 27:2, (#2 + 0) -Emitting segments for file: ../coverage/drop_trait.rs -Combined regions: - 9:24 -> 11:6 (count=2) - 15:9 -> 17:42 (count=1) - 19:8 -> 19:12 (count=1) - 20:9 -> 21:22 (count=1) - 27:1 -> 27:2 (count=1) -Segment at 9:24 (count = 2), RegionEntry -Segment at 11:6 (count = 0), Skipped -Segment at 15:9 (count = 1), RegionEntry -Segment at 17:42 (count = 0), Skipped -Segment at 19:8 (count = 1), RegionEntry -Segment at 19:12 (count = 0), Skipped -Segment at 20:9 (count = 1), RegionEntry -Segment at 21:22 (count = 0), Skipped -Segment at 27:1 (count = 1), RegionEntry -Segment at 27:2 (count = 0), Skipped diff --git a/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_show_coverage_counters.generics.txt b/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_show_coverage_counters.generics.txt deleted file mode 100644 index 013a69ed3983a..0000000000000 --- a/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_show_coverage_counters.generics.txt +++ /dev/null @@ -1,48 +0,0 @@ -Counter in file 0 17:24 -> 19:6, #1 -Counter in file 0 17:24 -> 19:6, #1 -Counter in file 0 23:9 -> 28:28, #1 -Counter in file 0 30:8 -> 30:12, (#1 + 0) -Counter in file 0 31:9 -> 32:22, #2 -Counter in file 0 38:1 -> 38:2, (#2 + 0) -Counter in file 0 10:49 -> 12:6, #1 -Counter in file 0 10:49 -> 12:6, #1 -Emitting segments for file: ../coverage/generics.rs -Combined regions: - 10:49 -> 12:6 (count=3) - 17:24 -> 19:6 (count=2) - 23:9 -> 28:28 (count=1) - 30:8 -> 30:12 (count=1) - 31:9 -> 32:22 (count=1) - 38:1 -> 38:2 (count=1) -Segment at 10:49 (count = 3), RegionEntry -Segment at 12:6 (count = 0), Skipped -Segment at 17:24 (count = 2), RegionEntry -Segment at 19:6 (count = 0), Skipped -Segment at 23:9 (count = 1), RegionEntry -Segment at 28:28 (count = 0), Skipped -Segment at 30:8 (count = 1), RegionEntry -Segment at 30:12 (count = 0), Skipped -Segment at 31:9 (count = 1), RegionEntry -Segment at 32:22 (count = 0), Skipped -Segment at 38:1 (count = 1), RegionEntry -Segment at 38:2 (count = 0), Skipped -Emitting segments for function: _RNvMCs4fqI2P2rA04_8genericsINtB2_8FireworkdE12set_strengthB2_ -Combined regions: - 10:49 -> 12:6 (count=2) -Segment at 10:49 (count = 2), RegionEntry -Segment at 12:6 (count = 0), Skipped -Emitting segments for function: _RNvMCs4fqI2P2rA04_8genericsINtB2_8FireworklE12set_strengthB2_ -Combined regions: - 10:49 -> 12:6 (count=1) -Segment at 10:49 (count = 1), RegionEntry -Segment at 12:6 (count = 0), Skipped -Emitting segments for function: _RNvXs_Cs4fqI2P2rA04_8genericsINtB4_8FireworklENtNtNtCs7f2nZg1zwMz_4core3ops4drop4Drop4dropB4_ -Combined regions: - 17:24 -> 19:6 (count=1) -Segment at 17:24 (count = 1), RegionEntry -Segment at 19:6 (count = 0), Skipped -Emitting segments for function: _RNvXs_Cs4fqI2P2rA04_8genericsINtB4_8FireworkdENtNtNtCs7f2nZg1zwMz_4core3ops4drop4Drop4dropB4_ -Combined regions: - 17:24 -> 19:6 (count=1) -Segment at 17:24 (count = 1), RegionEntry -Segment at 19:6 (count = 0), Skipped diff --git a/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_show_coverage_counters.inner_items.txt b/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_show_coverage_counters.inner_items.txt deleted file mode 100644 index 65cd6481af4cc..0000000000000 --- a/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_show_coverage_counters.inner_items.txt +++ /dev/null @@ -1,60 +0,0 @@ -Counter in file 0 19:13 -> 19:18, #1 -Counter in file 0 20:13 -> 20:14, #2 -Counter in file 0 20:17 -> 20:22, (#1 + 0) -Counter in file 0 21:9 -> 22:6, (#2 + 0) -Counter in file 0 7:9 -> 9:26, #1 -Counter in file 0 10:8 -> 10:15, (#1 + 0) -Counter in file 0 10:16 -> 12:6, #2 -Counter in file 0 12:6 -> 12:7, (#1 - #2) -Counter in file 0 48:8 -> 48:15, (#2 + (#1 - #2)) -Counter in file 0 48:16 -> 50:6, #3 -Counter in file 0 50:6 -> 50:7, ((#2 + (#1 - #2)) - #3) -Counter in file 0 52:9 -> 57:2, (#3 + ((#2 + (#1 - #2)) - #3)) -Counter in file 0 33:42 -> 36:10, #1 -Counter in file 0 41:37 -> 41:41, #1 -Counter in file 0 42:13 -> 43:10, #2 -Emitting segments for file: ../coverage/inner_items.rs -Combined regions: - 7:9 -> 9:26 (count=1) - 10:8 -> 10:15 (count=1) - 10:16 -> 12:6 (count=1) - 12:6 -> 12:7 (count=0) - 19:13 -> 19:18 (count=3) - 20:13 -> 20:14 (count=3) - 20:17 -> 20:22 (count=3) - 21:9 -> 22:6 (count=3) - 33:42 -> 36:10 (count=1) - 41:37 -> 41:41 (count=1) - 42:13 -> 43:10 (count=1) - 48:8 -> 48:15 (count=1) - 48:16 -> 50:6 (count=1) - 50:6 -> 50:7 (count=0) - 52:9 -> 57:2 (count=1) -Segment at 7:9 (count = 1), RegionEntry -Segment at 9:26 (count = 0), Skipped -Segment at 10:8 (count = 1), RegionEntry -Segment at 10:15 (count = 0), Skipped -Segment at 10:16 (count = 1), RegionEntry -Segment at 12:6 (count = 0), RegionEntry -Segment at 12:7 (count = 0), Skipped -Segment at 19:13 (count = 3), RegionEntry -Segment at 19:18 (count = 0), Skipped -Segment at 20:13 (count = 3), RegionEntry -Segment at 20:14 (count = 0), Skipped -Segment at 20:17 (count = 3), RegionEntry -Segment at 20:22 (count = 0), Skipped -Segment at 21:9 (count = 3), RegionEntry -Segment at 22:6 (count = 0), Skipped -Segment at 33:42 (count = 1), RegionEntry -Segment at 36:10 (count = 0), Skipped -Segment at 41:37 (count = 1), RegionEntry -Segment at 41:41 (count = 0), Skipped -Segment at 42:13 (count = 1), RegionEntry -Segment at 43:10 (count = 0), Skipped -Segment at 48:8 (count = 1), RegionEntry -Segment at 48:15 (count = 0), Skipped -Segment at 48:16 (count = 1), RegionEntry -Segment at 50:6 (count = 0), RegionEntry -Segment at 50:7 (count = 0), Skipped -Segment at 52:9 (count = 1), RegionEntry -Segment at 57:2 (count = 0), Skipped diff --git a/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_show_coverage_counters.lazy_boolean.txt b/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_show_coverage_counters.lazy_boolean.txt deleted file mode 100644 index 8e56d79d9d2aa..0000000000000 --- a/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_show_coverage_counters.lazy_boolean.txt +++ /dev/null @@ -1,131 +0,0 @@ -Counter in file 0 7:9 -> 9:42, #1 -Counter in file 0 10:8 -> 10:15, (#1 + 0) -Counter in file 0 10:16 -> 14:6, #2 -Counter in file 0 14:6 -> 14:7, (#1 - #2) -Counter in file 0 16:9 -> 16:17, ((#3 + #4) + (((#2 + (#1 - #2)) - #3) - #4)) -Counter in file 0 18:13 -> 18:18, (#2 + (#1 - #2)) -Counter in file 0 20:13 -> 20:18, ((#2 + (#1 - #2)) - #3) -Counter in file 0 20:18 -> 20:19, (#3 + #4) -Counter in file 0 20:18 -> 20:19, (((#2 + (#1 - #2)) - #3) - #4) -Counter in file 0 23:9 -> 23:17, ((#5 + #6) + ((((#3 + #4) + (((#2 + (#1 - #2)) - #3) - #4)) - #5) - #6)) -Counter in file 0 25:13 -> 25:18, (((#3 + #4) + (((#2 + (#1 - #2)) - #3) - #4)) + 0) -Counter in file 0 27:13 -> 27:18, (((#3 + #4) + (((#2 + (#1 - #2)) - #3) - #4)) - #5) -Counter in file 0 27:18 -> 27:19, (#5 + #6) -Counter in file 0 27:18 -> 27:19, ((((#3 + #4) + (((#2 + (#1 - #2)) - #3) - #4)) - #5) - #6) -Counter in file 0 29:9 -> 29:17, ((#7 - #8) + ((((#5 + #6) + ((((#3 + #4) + (((#2 + (#1 - #2)) - #3) - #4)) - #5) - #6)) - #7) + #8)) -Counter in file 0 29:20 -> 29:25, (((#5 + #6) + ((((#3 + #4) + (((#2 + (#1 - #2)) - #3) - #4)) - #5) - #6)) + 0) -Counter in file 0 29:29 -> 29:34, #7 -Counter in file 0 29:34 -> 29:35, ((((#5 + #6) + ((((#3 + #4) + (((#2 + (#1 - #2)) - #3) - #4)) - #5) - #6)) - #7) + #8) -Counter in file 0 29:34 -> 29:35, (#7 - #8) -Counter in file 0 30:9 -> 30:17, ((#9 - #10) + ((((#7 - #8) + ((((#5 + #6) + ((((#3 + #4) + (((#2 + (#1 - #2)) - #3) - #4)) - #5) - #6)) - #7) + #8)) - #9) + #10)) -Counter in file 0 30:20 -> 30:25, (((#7 - #8) + ((((#5 + #6) + ((((#3 + #4) + (((#2 + (#1 - #2)) - #3) - #4)) - #5) - #6)) - #7) + #8)) + 0) -Counter in file 0 30:29 -> 30:34, #9 -Counter in file 0 30:34 -> 30:35, ((((#7 - #8) + ((((#5 + #6) + ((((#3 + #4) + (((#2 + (#1 - #2)) - #3) - #4)) - #5) - #6)) - #7) + #8)) - #9) + #10) -Counter in file 0 30:34 -> 30:35, (#9 - #10) -Counter in file 0 33:9 -> 34:16, (((#9 - #10) + ((((#7 - #8) + ((((#5 + #6) + ((((#3 + #4) + (((#2 + (#1 - #2)) - #3) - #4)) - #5) - #6)) - #7) + #8)) - #9) + #10)) + 0) -Counter in file 0 35:5 -> 38:6, #11 -Counter in file 0 38:6 -> 38:7, (((#9 - #10) + ((((#7 - #8) + ((((#5 + #6) + ((((#3 + #4) + (((#2 + (#1 - #2)) - #3) - #4)) - #5) - #6)) - #7) + #8)) - #9) + #10)) - #11) -Counter in file 0 41:9 -> 41:16, (#11 + (((#9 - #10) + ((((#7 - #8) + ((((#5 + #6) + ((((#3 + #4) + (((#2 + (#1 - #2)) - #3) - #4)) - #5) - #6)) - #7) + #8)) - #9) + #10)) - #11)) -Counter in file 0 42:5 -> 45:6, #12 -Counter in file 0 47:5 -> 50:6, ((#11 + (((#9 - #10) + ((((#7 - #8) + ((((#5 + #6) + ((((#3 + #4) + (((#2 + (#1 - #2)) - #3) - #4)) - #5) - #6)) - #7) + #8)) - #9) + #10)) - #11)) - #12) -Counter in file 0 52:8 -> 52:16, (#12 + ((#11 + (((#9 - #10) + ((((#7 - #8) + ((((#5 + #6) + ((((#3 + #4) + (((#2 + (#1 - #2)) - #3) - #4)) - #5) - #6)) - #7) + #8)) - #9) + #10)) - #11)) - #12)) -Counter in file 0 52:17 -> 54:6, #13 -Counter in file 0 54:6 -> 54:7, ((#12 + ((#11 + (((#9 - #10) + ((((#7 - #8) + ((((#5 + #6) + ((((#3 + #4) + (((#2 + (#1 - #2)) - #3) - #4)) - #5) - #6)) - #7) + #8)) - #9) + #10)) - #11)) - #12)) - #13) -Counter in file 0 56:8 -> 56:15, (#13 + ((#12 + ((#11 + (((#9 - #10) + ((((#7 - #8) + ((((#5 + #6) + ((((#3 + #4) + (((#2 + (#1 - #2)) - #3) - #4)) - #5) - #6)) - #7) + #8)) - #9) + #10)) - #11)) - #12)) - #13)) -Counter in file 0 56:16 -> 58:6, #14 -Counter in file 0 58:12 -> 60:6, ((#13 + ((#12 + ((#11 + (((#9 - #10) + ((((#7 - #8) + ((((#5 + #6) + ((((#3 + #4) + (((#2 + (#1 - #2)) - #3) - #4)) - #5) - #6)) - #7) + #8)) - #9) + #10)) - #11)) - #12)) - #13)) - #14) -Counter in file 0 61:1 -> 61:2, (#14 + ((#13 + ((#12 + ((#11 + (((#9 - #10) + ((((#7 - #8) + ((((#5 + #6) + ((((#3 + #4) + (((#2 + (#1 - #2)) - #3) - #4)) - #5) - #6)) - #7) + #8)) - #9) + #10)) - #11)) - #12)) - #13)) - #14)) -Emitting segments for file: ../coverage/lazy_boolean.rs -Combined regions: - 7:9 -> 9:42 (count=1) - 10:8 -> 10:15 (count=1) - 10:16 -> 14:6 (count=1) - 14:6 -> 14:7 (count=0) - 16:9 -> 16:17 (count=1) - 18:13 -> 18:18 (count=1) - 20:13 -> 20:18 (count=0) - 20:18 -> 20:19 (count=1) - 23:9 -> 23:17 (count=1) - 25:13 -> 25:18 (count=1) - 27:13 -> 27:18 (count=1) - 27:18 -> 27:19 (count=1) - 29:9 -> 29:17 (count=1) - 29:20 -> 29:25 (count=1) - 29:29 -> 29:34 (count=1) - 29:34 -> 29:35 (count=1) - 30:9 -> 30:17 (count=1) - 30:20 -> 30:25 (count=1) - 30:29 -> 30:34 (count=0) - 30:34 -> 30:35 (count=1) - 33:9 -> 34:16 (count=1) - 35:5 -> 38:6 (count=0) - 38:6 -> 38:7 (count=1) - 41:9 -> 41:16 (count=1) - 42:5 -> 45:6 (count=1) - 47:5 -> 50:6 (count=0) - 52:8 -> 52:16 (count=1) - 52:17 -> 54:6 (count=0) - 54:6 -> 54:7 (count=1) - 56:8 -> 56:15 (count=1) - 56:16 -> 58:6 (count=1) - 58:12 -> 60:6 (count=0) - 61:1 -> 61:2 (count=1) -Segment at 7:9 (count = 1), RegionEntry -Segment at 9:42 (count = 0), Skipped -Segment at 10:8 (count = 1), RegionEntry -Segment at 10:15 (count = 0), Skipped -Segment at 10:16 (count = 1), RegionEntry -Segment at 14:6 (count = 0), RegionEntry -Segment at 14:7 (count = 0), Skipped -Segment at 16:9 (count = 1), RegionEntry -Segment at 16:17 (count = 0), Skipped -Segment at 18:13 (count = 1), RegionEntry -Segment at 18:18 (count = 0), Skipped -Segment at 20:13 (count = 0), RegionEntry -Segment at 20:18 (count = 1), RegionEntry -Segment at 20:19 (count = 0), Skipped -Segment at 23:9 (count = 1), RegionEntry -Segment at 23:17 (count = 0), Skipped -Segment at 25:13 (count = 1), RegionEntry -Segment at 25:18 (count = 0), Skipped -Segment at 27:13 (count = 1), RegionEntry -Segment at 27:18 (count = 1), RegionEntry -Segment at 27:19 (count = 0), Skipped -Segment at 29:9 (count = 1), RegionEntry -Segment at 29:17 (count = 0), Skipped -Segment at 29:20 (count = 1), RegionEntry -Segment at 29:25 (count = 0), Skipped -Segment at 29:29 (count = 1), RegionEntry -Segment at 29:34 (count = 1), RegionEntry -Segment at 29:35 (count = 0), Skipped -Segment at 30:9 (count = 1), RegionEntry -Segment at 30:17 (count = 0), Skipped -Segment at 30:20 (count = 1), RegionEntry -Segment at 30:25 (count = 0), Skipped -Segment at 30:29 (count = 0), RegionEntry -Segment at 30:34 (count = 1), RegionEntry -Segment at 30:35 (count = 0), Skipped -Segment at 33:9 (count = 1), RegionEntry -Segment at 34:16 (count = 0), Skipped -Segment at 35:5 (count = 0), RegionEntry -Segment at 38:6 (count = 1), RegionEntry -Segment at 38:7 (count = 0), Skipped -Segment at 41:9 (count = 1), RegionEntry -Segment at 41:16 (count = 0), Skipped -Segment at 42:5 (count = 1), RegionEntry -Segment at 45:6 (count = 0), Skipped -Segment at 47:5 (count = 0), RegionEntry -Segment at 50:6 (count = 0), Skipped -Segment at 52:8 (count = 1), RegionEntry -Segment at 52:16 (count = 0), Skipped -Segment at 52:17 (count = 0), RegionEntry -Segment at 54:6 (count = 1), RegionEntry -Segment at 54:7 (count = 0), Skipped -Segment at 56:8 (count = 1), RegionEntry -Segment at 56:15 (count = 0), Skipped -Segment at 56:16 (count = 1), RegionEntry -Segment at 58:6 (count = 0), Skipped -Segment at 58:12 (count = 0), RegionEntry -Segment at 60:6 (count = 0), Skipped -Segment at 61:1 (count = 1), RegionEntry -Segment at 61:2 (count = 0), Skipped diff --git a/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_show_coverage_counters.loop_break_value.txt b/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_show_coverage_counters.loop_break_value.txt deleted file mode 100644 index a6144b8072ace..0000000000000 --- a/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_show_coverage_counters.loop_break_value.txt +++ /dev/null @@ -1,6 +0,0 @@ -Counter in file 0 3:11 -> 13:2, #1 -Emitting segments for file: ../coverage/loop_break_value.rs -Combined regions: - 3:11 -> 13:2 (count=1) -Segment at 3:11 (count = 1), RegionEntry -Segment at 13:2 (count = 0), Skipped diff --git a/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_show_coverage_counters.loops_branches.txt b/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_show_coverage_counters.loops_branches.txt deleted file mode 100644 index d8af6998964cf..0000000000000 --- a/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_show_coverage_counters.loops_branches.txt +++ /dev/null @@ -1,37 +0,0 @@ -Counter in file 0 10:12 -> 10:16, #1 -Counter in file 0 11:16 -> 11:21, #2 -Counter in file 0 14:14 -> 14:15, (#2 - #5) -Counter in file 0 15:13 -> 15:31, (0 + (#2 - #5)) -Counter in file 0 15:31 -> 15:32, #4 -Counter in file 0 17:10 -> 17:11, #3 -Counter in file 0 18:9 -> 18:15, (#3 + 0) -Counter in file 0 19:5 -> 19:6, (#4 + (#3 + 0)) -Counter in file 0 22:11 -> 25:2, #1 -Emitting segments for file: ../coverage/loops_branches.rs -Combined regions: - 10:12 -> 10:16 (count=1) - 11:16 -> 11:21 (count=1) - 14:14 -> 14:15 (count=1) - 15:13 -> 15:31 (count=1) - 15:31 -> 15:32 (count=0) - 17:10 -> 17:11 (count=1) - 18:9 -> 18:15 (count=1) - 19:5 -> 19:6 (count=1) - 22:11 -> 25:2 (count=1) -Segment at 10:12 (count = 1), RegionEntry -Segment at 10:16 (count = 0), Skipped -Segment at 11:16 (count = 1), RegionEntry -Segment at 11:21 (count = 0), Skipped -Segment at 14:14 (count = 1), RegionEntry -Segment at 14:15 (count = 0), Skipped -Segment at 15:13 (count = 1), RegionEntry -Segment at 15:31 (count = 0), RegionEntry -Segment at 15:32 (count = 0), Skipped -Segment at 17:10 (count = 1), RegionEntry -Segment at 17:11 (count = 0), Skipped -Segment at 18:9 (count = 1), RegionEntry -Segment at 18:15 (count = 0), Skipped -Segment at 19:5 (count = 1), RegionEntry -Segment at 19:6 (count = 0), Skipped -Segment at 22:11 (count = 1), RegionEntry -Segment at 25:2 (count = 0), Skipped diff --git a/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_show_coverage_counters.nested_loops.txt b/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_show_coverage_counters.nested_loops.txt deleted file mode 100644 index f503007353319..0000000000000 --- a/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_show_coverage_counters.nested_loops.txt +++ /dev/null @@ -1,73 +0,0 @@ -Counter in file 0 2:9 -> 3:27, #1 -Counter in file 0 5:19 -> 5:32, (#1 + #2) -Counter in file 0 6:13 -> 7:24, ((#1 + #2) - #3) -Counter in file 0 8:13 -> 8:14, ((((#1 + #2) - #3) + (#5 + #6)) - #7) -Counter in file 0 8:18 -> 8:23, (((#1 + #2) - #3) + (#5 + #6)) -Counter in file 0 9:16 -> 9:22, (((((#1 + #2) - #3) + (#5 + #6)) - #7) + 0) -Counter in file 0 10:17 -> 10:22, #8 -Counter in file 0 12:13 -> 12:19, #9 -Counter in file 0 13:13 -> 13:19, #10 -Counter in file 0 14:16 -> 14:22, (#10 + 0) -Counter in file 0 15:17 -> 16:27, #11 -Counter in file 0 17:21 -> 17:33, #4 -Counter in file 0 19:21 -> 21:14, #5 -Counter in file 0 21:14 -> 21:15, #6 -Counter in file 0 22:10 -> 22:11, (#5 + #6) -Counter in file 0 23:9 -> 23:23, #2 -Counter in file 0 24:6 -> 24:7, #3 -Counter in file 0 25:1 -> 25:2, (#4 + #3) -Emitting segments for file: ../coverage/nested_loops.rs -Combined regions: - 2:9 -> 3:27 (count=1) - 5:19 -> 5:32 (count=1) - 6:13 -> 7:24 (count=1) - 8:13 -> 8:14 (count=3) - 8:18 -> 8:23 (count=3) - 9:16 -> 9:22 (count=3) - 10:17 -> 10:22 (count=0) - 12:13 -> 12:19 (count=3) - 13:13 -> 13:19 (count=3) - 14:16 -> 14:22 (count=3) - 15:17 -> 16:27 (count=1) - 17:21 -> 17:33 (count=1) - 19:21 -> 21:14 (count=0) - 21:14 -> 21:15 (count=2) - 22:10 -> 22:11 (count=2) - 23:9 -> 23:23 (count=0) - 24:6 -> 24:7 (count=0) - 25:1 -> 25:2 (count=1) -Segment at 2:9 (count = 1), RegionEntry -Segment at 3:27 (count = 0), Skipped -Segment at 5:19 (count = 1), RegionEntry -Segment at 5:32 (count = 0), Skipped -Segment at 6:13 (count = 1), RegionEntry -Segment at 7:24 (count = 0), Skipped -Segment at 8:13 (count = 3), RegionEntry -Segment at 8:14 (count = 0), Skipped -Segment at 8:18 (count = 3), RegionEntry -Segment at 8:23 (count = 0), Skipped -Segment at 9:16 (count = 3), RegionEntry -Segment at 9:22 (count = 0), Skipped -Segment at 10:17 (count = 0), RegionEntry -Segment at 10:22 (count = 0), Skipped -Segment at 12:13 (count = 3), RegionEntry -Segment at 12:19 (count = 0), Skipped -Segment at 13:13 (count = 3), RegionEntry -Segment at 13:19 (count = 0), Skipped -Segment at 14:16 (count = 3), RegionEntry -Segment at 14:22 (count = 0), Skipped -Segment at 15:17 (count = 1), RegionEntry -Segment at 16:27 (count = 0), Skipped -Segment at 17:21 (count = 1), RegionEntry -Segment at 17:33 (count = 0), Skipped -Segment at 19:21 (count = 0), RegionEntry -Segment at 21:14 (count = 2), RegionEntry -Segment at 21:15 (count = 0), Skipped -Segment at 22:10 (count = 2), RegionEntry -Segment at 22:11 (count = 0), Skipped -Segment at 23:9 (count = 0), RegionEntry -Segment at 23:23 (count = 0), Skipped -Segment at 24:6 (count = 0), RegionEntry -Segment at 24:7 (count = 0), Skipped -Segment at 25:1 (count = 1), RegionEntry -Segment at 25:2 (count = 0), Skipped diff --git a/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_show_coverage_counters.partial_eq.txt b/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_show_coverage_counters.partial_eq.txt deleted file mode 100644 index 2b9285202f97f..0000000000000 --- a/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_show_coverage_counters.partial_eq.txt +++ /dev/null @@ -1,53 +0,0 @@ -Counter in file 0 4:32 -> 4:33, (#3 + (#1 + #2)) -Counter in file 0 4:48 -> 4:49, ((#1 + #2) + ((#3 + #4) + ((#5 + #6) + #7))) -Counter in file 0 21:11 -> 26:2, #1 -Counter in file 0 8:5 -> 8:17, #1 -Counter in file 0 8:5 -> 8:17, #1 -Counter in file 0 4:39 -> 4:40, #1 -Counter in file 0 4:48 -> 4:49, (#1 + 0) -Counter in file 0 4:39 -> 4:40, #1 -Counter in file 0 4:48 -> 4:49, (#1 + 0) -Counter in file 0 8:5 -> 8:17, #1 -Counter in file 0 4:32 -> 4:33, ((#4 + #5) + #6) -Counter in file 0 4:53 -> 4:54, (#1 + (#2 + (#3 + #4))) -Counter in file 0 13:9 -> 18:6, #1 -Counter in file 0 4:39 -> 4:40, #1 -Counter in file 0 4:48 -> 4:49, (#1 + 0) -Counter in file 0 7:5 -> 7:6, #1 -Counter in file 0 4:10 -> 4:15, #1 -Counter in file 0 4:35 -> 4:37, #1 -Counter in file 0 7:5 -> 7:6, #1 -Counter in file 0 7:5 -> 7:6, #1 -Counter in file 0 4:17 -> 4:22, #1 -Counter in file 0 8:5 -> 8:17, #1 -Counter in file 0 4:39 -> 4:40, #1 -Counter in file 0 4:48 -> 4:49, (#1 + 0) -Counter in file 0 7:5 -> 7:6, #1 -Emitting segments for file: ../coverage/partial_eq.rs -Combined regions: - 4:17 -> 4:22 (count=2) - 4:39 -> 4:40 (count=1) - 4:48 -> 4:49 (count=1) - 7:5 -> 7:6 (count=1) - 13:9 -> 18:6 (count=2) - 21:11 -> 26:2 (count=1) -Segment at 4:17 (count = 2), RegionEntry -Segment at 4:22 (count = 0), Skipped -Segment at 4:39 (count = 1), RegionEntry -Segment at 4:40 (count = 0), Skipped -Segment at 4:48 (count = 1), RegionEntry -Segment at 4:49 (count = 0), Skipped -Segment at 7:5 (count = 1), RegionEntry -Segment at 7:6 (count = 0), Skipped -Segment at 13:9 (count = 2), RegionEntry -Segment at 18:6 (count = 0), Skipped -Segment at 21:11 (count = 1), RegionEntry -Segment at 26:2 (count = 0), Skipped -Emitting segments for function: _RNvXs0_Cs4fqI2P2rA04_10partial_eqNtB5_7VersionNtNtCs7f2nZg1zwMz_4core3cmp10PartialOrd2ltB5_ -Combined regions: - 4:39 -> 4:40 (count=1) - 4:48 -> 4:49 (count=1) -Segment at 4:39 (count = 1), RegionEntry -Segment at 4:40 (count = 0), Skipped -Segment at 4:48 (count = 1), RegionEntry -Segment at 4:49 (count = 0), Skipped diff --git a/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_show_coverage_counters.simple_loop.txt b/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_show_coverage_counters.simple_loop.txt deleted file mode 100644 index 255173e5534d1..0000000000000 --- a/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_show_coverage_counters.simple_loop.txt +++ /dev/null @@ -1,37 +0,0 @@ -Counter in file 0 7:9 -> 9:26, #1 -Counter in file 0 12:9 -> 12:16, (#1 + 0) -Counter in file 0 13:5 -> 18:6, #2 -Counter in file 0 18:6 -> 18:7, (#1 - #2) -Counter in file 0 23:13 -> 25:14, ((#2 + (#1 - #2)) + #3) -Counter in file 0 27:13 -> 27:18, #4 -Counter in file 0 30:9 -> 32:10, #3 -Counter in file 0 34:6 -> 34:7, (#2 + (#1 - #2)) -Counter in file 0 35:1 -> 35:2, (#4 + 0) -Emitting segments for file: ../coverage/simple_loop.rs -Combined regions: - 7:9 -> 9:26 (count=1) - 12:9 -> 12:16 (count=1) - 13:5 -> 18:6 (count=1) - 18:6 -> 18:7 (count=0) - 23:13 -> 25:14 (count=11) - 27:13 -> 27:18 (count=1) - 30:9 -> 32:10 (count=10) - 34:6 -> 34:7 (count=1) - 35:1 -> 35:2 (count=1) -Segment at 7:9 (count = 1), RegionEntry -Segment at 9:26 (count = 0), Skipped -Segment at 12:9 (count = 1), RegionEntry -Segment at 12:16 (count = 0), Skipped -Segment at 13:5 (count = 1), RegionEntry -Segment at 18:6 (count = 0), RegionEntry -Segment at 18:7 (count = 0), Skipped -Segment at 23:13 (count = 11), RegionEntry -Segment at 25:14 (count = 0), Skipped -Segment at 27:13 (count = 1), RegionEntry -Segment at 27:18 (count = 0), Skipped -Segment at 30:9 (count = 10), RegionEntry -Segment at 32:10 (count = 0), Skipped -Segment at 34:6 (count = 1), RegionEntry -Segment at 34:7 (count = 0), Skipped -Segment at 35:1 (count = 1), RegionEntry -Segment at 35:2 (count = 0), Skipped diff --git a/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_show_coverage_counters.simple_match.txt b/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_show_coverage_counters.simple_match.txt deleted file mode 100644 index 1682a379bc0ff..0000000000000 --- a/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_show_coverage_counters.simple_match.txt +++ /dev/null @@ -1,57 +0,0 @@ -Counter in file 0 7:9 -> 9:26, #1 -Counter in file 0 10:8 -> 10:15, (#1 + 0) -Counter in file 0 10:16 -> 12:6, #2 -Counter in file 0 12:6 -> 12:7, (#1 - #2) -Counter in file 0 15:9 -> 15:10, (((#2 + (#1 - #2)) + (#3 + #4)) - #5) -Counter in file 0 17:9 -> 17:13, ((#2 + (#1 - #2)) + (#3 + #4)) -Counter in file 0 22:13 -> 22:22, ((((#2 + (#1 - #2)) + (#3 + #4)) - #5) + 0) -Counter in file 0 24:13 -> 24:14, #3 -Counter in file 0 26:17 -> 28:18, ((((#2 + (#1 - #2)) + (#3 + #4)) - #5) + 0) -Counter in file 0 28:18 -> 28:19, ((((#2 + (#1 - #2)) + (#3 + #4)) - #5) - #3) -Counter in file 0 30:13 -> 37:14, (#3 + 0) -Counter in file 0 40:13 -> 40:15, #4 -Counter in file 0 42:6 -> 42:7, (#2 + (#1 - #2)) -Counter in file 0 42:6 -> 42:7, (#3 + #4) -Counter in file 0 43:1 -> 43:2, #5 -Emitting segments for file: ../coverage/simple_match.rs -Combined regions: - 7:9 -> 9:26 (count=1) - 10:8 -> 10:15 (count=1) - 10:16 -> 12:6 (count=1) - 12:6 -> 12:7 (count=0) - 15:9 -> 15:10 (count=2) - 17:9 -> 17:13 (count=3) - 22:13 -> 22:22 (count=2) - 24:13 -> 24:14 (count=1) - 26:17 -> 28:18 (count=2) - 28:18 -> 28:19 (count=1) - 30:13 -> 37:14 (count=1) - 40:13 -> 40:15 (count=1) - 42:6 -> 42:7 (count=3) - 43:1 -> 43:2 (count=1) -Segment at 7:9 (count = 1), RegionEntry -Segment at 9:26 (count = 0), Skipped -Segment at 10:8 (count = 1), RegionEntry -Segment at 10:15 (count = 0), Skipped -Segment at 10:16 (count = 1), RegionEntry -Segment at 12:6 (count = 0), RegionEntry -Segment at 12:7 (count = 0), Skipped -Segment at 15:9 (count = 2), RegionEntry -Segment at 15:10 (count = 0), Skipped -Segment at 17:9 (count = 3), RegionEntry -Segment at 17:13 (count = 0), Skipped -Segment at 22:13 (count = 2), RegionEntry -Segment at 22:22 (count = 0), Skipped -Segment at 24:13 (count = 1), RegionEntry -Segment at 24:14 (count = 0), Skipped -Segment at 26:17 (count = 2), RegionEntry -Segment at 28:18 (count = 1), RegionEntry -Segment at 28:19 (count = 0), Skipped -Segment at 30:13 (count = 1), RegionEntry -Segment at 37:14 (count = 0), Skipped -Segment at 40:13 (count = 1), RegionEntry -Segment at 40:15 (count = 0), Skipped -Segment at 42:6 (count = 3), RegionEntry -Segment at 42:7 (count = 0), Skipped -Segment at 43:1 (count = 1), RegionEntry -Segment at 43:2 (count = 0), Skipped diff --git a/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_show_coverage_counters.tight_inf_loop.txt b/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_show_coverage_counters.tight_inf_loop.txt deleted file mode 100644 index 5887658fe67a2..0000000000000 --- a/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_show_coverage_counters.tight_inf_loop.txt +++ /dev/null @@ -1,10 +0,0 @@ -Counter in file 0 2:8 -> 2:13, #1 -Counter in file 0 5:1 -> 5:2, (#1 - #2) -Emitting segments for file: ../coverage/tight_inf_loop.rs -Combined regions: - 2:8 -> 2:13 (count=1) - 5:1 -> 5:2 (count=1) -Segment at 2:8 (count = 1), RegionEntry -Segment at 2:13 (count = 0), Skipped -Segment at 5:1 (count = 1), RegionEntry -Segment at 5:2 (count = 0), Skipped diff --git a/src/test/run-make-fulldeps/coverage-reports-base/Makefile b/src/test/run-make-fulldeps/coverage-reports/Makefile similarity index 53% rename from src/test/run-make-fulldeps/coverage-reports-base/Makefile rename to src/test/run-make-fulldeps/coverage-reports/Makefile index 2dac8fc2225bf..302f09ae422bc 100644 --- a/src/test/run-make-fulldeps/coverage-reports-base/Makefile +++ b/src/test/run-make-fulldeps/coverage-reports/Makefile @@ -4,13 +4,9 @@ # FIXME(mati865): MinGW GCC miscompiles compiler-rt profiling library but with Clang it works # properly. Since we only have GCC on the CI ignore the test for now. -# ISSUE(76038): When targeting MSVC, Rust binaries built with both `-Z instrument-coverage` and -# `-C link-dead-code` typically crash (with a seg-fault) or at best generate an empty `*.profraw`. -# See ../coverage/coverage_tools.mk for more information. - -include ../coverage/coverage_tools.mk -BASEDIR=../coverage-reports-base +BASEDIR=../coverage-reports SOURCEDIR=../coverage # The `llvm-cov show` flag `--debug`, used to generate the `counters` output files, is only enabled @@ -26,6 +22,43 @@ ifeq ($(LLVM_COV_DEBUG), 1) DEBUG_FLAG=--debug endif +# FIXME(richkadel): I'm adding `--ignore-filename-regex=` line(s) for specific test(s) that produce +# `llvm-cov` results for multiple files (for example `uses_crate.rs` and `used_crate/mod.rs`) as a +# workaround for two problems causing tests to fail on Windows: +# +# 1. When multiple files appear in the `llvm-cov show` results, each file's coverage results can +# appear in different a different order. Whether this is random or, somehow, platform-specific, +# the Windows output flips the order of the files, compared to Linux. In the `uses_crate.rs` +# test, the only test-unique (interesting) results we care about are the results for only one +# of the two files, `mod/uses_crate.rs`, so the workaround is to ignore all but this one file. +# In the future, we may want a more sophisticated solution that splits apart `llvm-cov show` +# results into separate results files for each result (taking care not to create new file +# paths that might be too long for Windows MAX_PATH limits when creating these new sub-results, +# as well). +# 2. When multiple files appear in the `llvm-cov show` results, the results for each file are +# prefixed with their filename, including platform-specific path separators (`\` for Windows, +# and `/` everywhere else). This could be filtered or normalized of course, but by ignoring +# coverage results for all but one of the file, the filenames are no longer included anyway. +# If this changes (if/when we decide to support `llvm-cov show` results for multiple files), +# the file path separator differences may need to be addressed. +# +# Since this is only a workaround, I decided to implement the override by adding an option for +# each file to be ignored, using a `--ignore-filename-regex=` entry for each one, rather than +# implement some more sophisticated solution with a new custom test directive in the test file +# itself (similar to `expect-exit-status`) because that would add a lot of complexity and still +# be a workaround, with the same result, with no benefit. +# +# Yes these `--ignore-filename-regex=` options are included in all invocations of `llvm-cov show` +# for now, but it is effectively ignored for all tests that don't include this file anyway. +# +# Note that it's also possible the `_counters..txt` and `.json` files may order +# results from multiple files inconsistently, which might also have to be accomodated if and when +# we allow `llvm-cov` to produce results for multiple files. (The path separators appear to be +# normalized to `/` in those files, thankfully.) But since we are ignoring results for all but one +# file, this workaround addresses those potential issues as well. +LLVM_COV_IGNORE_FILES=\ + --ignore-filename-regex=uses_crate.rs + # When generating `expected_*` results (using `x.py test --bless`), the `--debug` flag is forced. # If assertions are disabled, the command will fail with an error, rather than attempt to generate # only partial results. @@ -34,7 +67,7 @@ DEBUG_FLAG=--debug endif ifeq ($(LLVM_VERSION_11_PLUS),true) -all: $(patsubst $(SOURCEDIR)/%.rs,%,$(wildcard $(SOURCEDIR)/*.rs)) +all: $(patsubst $(SOURCEDIR)/lib/%.rs,%,$(wildcard $(SOURCEDIR)/lib/*.rs)) $(patsubst $(SOURCEDIR)/%.rs,%,$(wildcard $(SOURCEDIR)/*.rs)) else $(info Rust option `-Z instrument-coverage` requires LLVM 11 or higher. Test skipped.) all: @@ -51,11 +84,17 @@ endif -include clear_expected_if_blessed +%: $(SOURCEDIR)/lib/%.rs + # Compile the test library with coverage instrumentation + $(RUSTC) $(SOURCEDIR)/lib/$@.rs \ + $$( grep -q '^\/\/ require-rust-edition-2018' $(SOURCEDIR)/lib/$@.rs && echo "--edition=2018" ) \ + --crate-type rlib -Zinstrument-coverage + %: $(SOURCEDIR)/%.rs - # Compile the test program with coverage instrumentation and generate relevant MIR. + # Compile the test program with coverage instrumentation $(RUSTC) $(SOURCEDIR)/$@.rs \ - -Zinstrument-coverage \ - -Clink-dead-code=$(LINK_DEAD_CODE) + $$( grep -q '^\/\/ require-rust-edition-2018' $(SOURCEDIR)/$@.rs && echo "--edition=2018" ) \ + -L "$(TMPDIR)" -Zinstrument-coverage # Run it in order to generate some profiling data, # with `LLVM_PROFILE_FILE=` environment variable set to @@ -78,6 +117,7 @@ endif # Generate a coverage report using `llvm-cov show`. "$(LLVM_BIN_DIR)"/llvm-cov show \ $(DEBUG_FLAG) \ + $(LLVM_COV_IGNORE_FILES) \ --Xdemangler="$(RUST_DEMANGLER)" \ --show-line-counts-or-regions \ --instr-profile="$(TMPDIR)"/$@.profdata \ @@ -106,8 +146,17 @@ else # Compare the show coverage output (`--bless` refreshes `typical` files) # Note `llvm-cov show` output for some programs can vary, but can be ignored # by inserting `// ignore-llvm-cov-show-diffs` at the top of the source file. - - $(DIFF) expected_show_coverage.$@.txt "$(TMPDIR)"/actual_show_coverage.$@.txt || \ + # + # FIXME(richkadel): It looks like most past variations seem to have been mitigated. None of the + # Rust test source samples have the `// ignore-llvm-cov-show-diffs` anymore. The main variation + # I had seen (and is still present in the new `coverage/lib/used_crate.rs`) is the `llvm-cov show` + # reporting of multiple instantiations of a generic function with different type substitutions. + # For some reason, `llvm-cov show` can report these in a non-deterministic order, breaking the + # `diff` comparision. I was able to work around the problem with `diff --ignore-matching-lines=RE` + # to ignore each line prefixing each generic instantiation coverage code region. + + $(DIFF) --ignore-matching-lines='::<.*>.*:$$' \ + expected_show_coverage.$@.txt "$(TMPDIR)"/actual_show_coverage.$@.txt || \ ( grep -q '^\/\/ ignore-llvm-cov-show-diffs' $(SOURCEDIR)/$@.rs && \ >&2 echo 'diff failed, but suppressed with `// ignore-llvm-cov-show-diffs` in $(SOURCEDIR)/$@.rs' \ ) || \ @@ -135,11 +184,16 @@ endif # Generate a coverage report in JSON, using `llvm-cov export`, and fail if # there are differences from the expected output. "$(LLVM_BIN_DIR)"/llvm-cov export \ + $(LLVM_COV_IGNORE_FILES) \ --summary-only \ --instr-profile="$(TMPDIR)"/$@.profdata \ $(call BIN,"$(TMPDIR)"/$@) \ | "$(PYTHON)" $(BASEDIR)/prettify_json.py \ > "$(TMPDIR)"/actual_export_coverage.$@.json + # FIXME(richkadel): With the addition of `--ignore-matching-lines=RE` to ignore the + # non-deterministically-ordered coverage results for multiple instantiations of generics with + # differing type substitutions, I probably don't need the `.json` files anymore (and may not + # need `prettify_json.py` either). ifdef RUSTC_BLESS_TEST cp "$(TMPDIR)"/actual_export_coverage.$@.json expected_export_coverage.$@.json diff --git a/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_export_coverage.loops_branches.json b/src/test/run-make-fulldeps/coverage-reports/expected_export_coverage.abort.json similarity index 67% rename from src/test/run-make-fulldeps/coverage-reports-deadcode/expected_export_coverage.loops_branches.json rename to src/test/run-make-fulldeps/coverage-reports/expected_export_coverage.abort.json index 2dca41df9d24e..db7dd0b15e960 100644 --- a/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_export_coverage.loops_branches.json +++ b/src/test/run-make-fulldeps/coverage-reports/expected_export_coverage.abort.json @@ -3,7 +3,7 @@ { "files": [ { - "filename": "../coverage/loops_branches.rs", + "filename": "../coverage/abort.rs", "summary": { "functions": { "count": 2, @@ -16,15 +16,15 @@ "percent": 100 }, "lines": { - "count": 11, - "covered": 11, - "percent": 100 + "count": 19, + "covered": 17, + "percent": 89.47368421052632 }, "regions": { - "count": 9, - "covered": 8, + "count": 17, + "covered": 16, "notcovered": 1, - "percent": 88.88888888888889 + "percent": 94.11764705882352 } } } @@ -41,15 +41,15 @@ "percent": 100 }, "lines": { - "count": 11, - "covered": 11, - "percent": 100 + "count": 19, + "covered": 17, + "percent": 89.47368421052632 }, "regions": { - "count": 9, - "covered": 8, + "count": 17, + "covered": 16, "notcovered": 1, - "percent": 88.88888888888889 + "percent": 94.11764705882352 } } } diff --git a/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_export_coverage.drop_trait.json b/src/test/run-make-fulldeps/coverage-reports/expected_export_coverage.assert.json similarity index 64% rename from src/test/run-make-fulldeps/coverage-reports-deadcode/expected_export_coverage.drop_trait.json rename to src/test/run-make-fulldeps/coverage-reports/expected_export_coverage.assert.json index bd2e2d56d4a55..024b5f11179ac 100644 --- a/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_export_coverage.drop_trait.json +++ b/src/test/run-make-fulldeps/coverage-reports/expected_export_coverage.assert.json @@ -3,7 +3,7 @@ { "files": [ { - "filename": "../coverage/drop_trait.rs", + "filename": "../coverage/assert.rs", "summary": { "functions": { "count": 2, @@ -16,15 +16,15 @@ "percent": 100 }, "lines": { - "count": 10, - "covered": 10, - "percent": 100 + "count": 15, + "covered": 12, + "percent": 80 }, "regions": { - "count": 5, - "covered": 5, - "notcovered": 0, - "percent": 100 + "count": 14, + "covered": 12, + "notcovered": 2, + "percent": 85.71428571428571 } } } @@ -41,15 +41,15 @@ "percent": 100 }, "lines": { - "count": 10, - "covered": 10, - "percent": 100 + "count": 15, + "covered": 12, + "percent": 80 }, "regions": { - "count": 5, - "covered": 5, - "notcovered": 0, - "percent": 100 + "count": 14, + "covered": 12, + "notcovered": 2, + "percent": 85.71428571428571 } } } diff --git a/src/test/run-make-fulldeps/coverage-reports/expected_export_coverage.async.json b/src/test/run-make-fulldeps/coverage-reports/expected_export_coverage.async.json new file mode 100644 index 0000000000000..794a2e382535a --- /dev/null +++ b/src/test/run-make-fulldeps/coverage-reports/expected_export_coverage.async.json @@ -0,0 +1,59 @@ +{ + "data": [ + { + "files": [ + { + "filename": "../coverage/async.rs", + "summary": { + "functions": { + "count": 17, + "covered": 16, + "percent": 94.11764705882352 + }, + "instantiations": { + "count": 17, + "covered": 16, + "percent": 94.11764705882352 + }, + "lines": { + "count": 105, + "covered": 77, + "percent": 73.33333333333333 + }, + "regions": { + "count": 78, + "covered": 36, + "notcovered": 42, + "percent": 46.15384615384615 + } + } + } + ], + "totals": { + "functions": { + "count": 17, + "covered": 16, + "percent": 94.11764705882352 + }, + "instantiations": { + "count": 17, + "covered": 16, + "percent": 94.11764705882352 + }, + "lines": { + "count": 105, + "covered": 77, + "percent": 73.33333333333333 + }, + "regions": { + "count": 78, + "covered": 36, + "notcovered": 42, + "percent": 46.15384615384615 + } + } + } + ], + "type": "llvm.coverage.json.export", + "version": "2.0.1" +} diff --git a/src/test/run-make-fulldeps/coverage-reports/expected_export_coverage.closure.json b/src/test/run-make-fulldeps/coverage-reports/expected_export_coverage.closure.json new file mode 100644 index 0000000000000..39e1dea66f963 --- /dev/null +++ b/src/test/run-make-fulldeps/coverage-reports/expected_export_coverage.closure.json @@ -0,0 +1,59 @@ +{ + "data": [ + { + "files": [ + { + "filename": "../coverage/closure.rs", + "summary": { + "functions": { + "count": 6, + "covered": 4, + "percent": 66.66666666666666 + }, + "instantiations": { + "count": 6, + "covered": 4, + "percent": 66.66666666666666 + }, + "lines": { + "count": 161, + "covered": 131, + "percent": 81.36645962732919 + }, + "regions": { + "count": 42, + "covered": 22, + "notcovered": 20, + "percent": 52.38095238095239 + } + } + } + ], + "totals": { + "functions": { + "count": 6, + "covered": 4, + "percent": 66.66666666666666 + }, + "instantiations": { + "count": 6, + "covered": 4, + "percent": 66.66666666666666 + }, + "lines": { + "count": 161, + "covered": 131, + "percent": 81.36645962732919 + }, + "regions": { + "count": 42, + "covered": 22, + "notcovered": 20, + "percent": 52.38095238095239 + } + } + } + ], + "type": "llvm.coverage.json.export", + "version": "2.0.1" +} diff --git a/src/test/run-make-fulldeps/coverage-reports-base/expected_export_coverage.conditions.json b/src/test/run-make-fulldeps/coverage-reports/expected_export_coverage.conditions.json similarity index 66% rename from src/test/run-make-fulldeps/coverage-reports-base/expected_export_coverage.conditions.json rename to src/test/run-make-fulldeps/coverage-reports/expected_export_coverage.conditions.json index ed937a1b13f38..69356604856b6 100644 --- a/src/test/run-make-fulldeps/coverage-reports-base/expected_export_coverage.conditions.json +++ b/src/test/run-make-fulldeps/coverage-reports/expected_export_coverage.conditions.json @@ -16,15 +16,15 @@ "percent": 100 }, "lines": { - "count": 49, - "covered": 23, - "percent": 46.93877551020408 + "count": 64, + "covered": 33, + "percent": 51.5625 }, "regions": { - "count": 69, - "covered": 18, - "notcovered": 51, - "percent": 26.08695652173913 + "count": 64, + "covered": 21, + "notcovered": 43, + "percent": 32.8125 } } } @@ -41,15 +41,15 @@ "percent": 100 }, "lines": { - "count": 49, - "covered": 23, - "percent": 46.93877551020408 + "count": 64, + "covered": 33, + "percent": 51.5625 }, "regions": { - "count": 69, - "covered": 18, - "notcovered": 51, - "percent": 26.08695652173913 + "count": 64, + "covered": 21, + "notcovered": 43, + "percent": 32.8125 } } } diff --git a/src/test/run-make-fulldeps/coverage-reports/expected_export_coverage.dead_code.json b/src/test/run-make-fulldeps/coverage-reports/expected_export_coverage.dead_code.json new file mode 100644 index 0000000000000..6588ba90274ad --- /dev/null +++ b/src/test/run-make-fulldeps/coverage-reports/expected_export_coverage.dead_code.json @@ -0,0 +1,59 @@ +{ + "data": [ + { + "files": [ + { + "filename": "../coverage/dead_code.rs", + "summary": { + "functions": { + "count": 1, + "covered": 0, + "percent": 0 + }, + "instantiations": { + "count": 1, + "covered": 0, + "percent": 0 + }, + "lines": { + "count": 33, + "covered": 11, + "percent": 33.33333333333333 + }, + "regions": { + "count": 12, + "covered": 3, + "notcovered": 9, + "percent": 25 + } + } + } + ], + "totals": { + "functions": { + "count": 1, + "covered": 0, + "percent": 0 + }, + "instantiations": { + "count": 1, + "covered": 0, + "percent": 0 + }, + "lines": { + "count": 33, + "covered": 11, + "percent": 33.33333333333333 + }, + "regions": { + "count": 12, + "covered": 3, + "notcovered": 9, + "percent": 25 + } + } + } + ], + "type": "llvm.coverage.json.export", + "version": "2.0.1" +} diff --git a/src/test/run-make-fulldeps/coverage-reports-base/expected_export_coverage.drop_trait.json b/src/test/run-make-fulldeps/coverage-reports/expected_export_coverage.drop_trait.json similarity index 83% rename from src/test/run-make-fulldeps/coverage-reports-base/expected_export_coverage.drop_trait.json rename to src/test/run-make-fulldeps/coverage-reports/expected_export_coverage.drop_trait.json index bd2e2d56d4a55..e303d3802f519 100644 --- a/src/test/run-make-fulldeps/coverage-reports-base/expected_export_coverage.drop_trait.json +++ b/src/test/run-make-fulldeps/coverage-reports/expected_export_coverage.drop_trait.json @@ -16,13 +16,13 @@ "percent": 100 }, "lines": { - "count": 10, - "covered": 10, + "count": 12, + "covered": 12, "percent": 100 }, "regions": { - "count": 5, - "covered": 5, + "count": 4, + "covered": 4, "notcovered": 0, "percent": 100 } @@ -41,13 +41,13 @@ "percent": 100 }, "lines": { - "count": 10, - "covered": 10, + "count": 12, + "covered": 12, "percent": 100 }, "regions": { - "count": 5, - "covered": 5, + "count": 4, + "covered": 4, "notcovered": 0, "percent": 100 } diff --git a/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_export_coverage.generics.json b/src/test/run-make-fulldeps/coverage-reports/expected_export_coverage.generics.json similarity index 83% rename from src/test/run-make-fulldeps/coverage-reports-deadcode/expected_export_coverage.generics.json rename to src/test/run-make-fulldeps/coverage-reports/expected_export_coverage.generics.json index a50f4657e20aa..bfae69d7ac4dc 100644 --- a/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_export_coverage.generics.json +++ b/src/test/run-make-fulldeps/coverage-reports/expected_export_coverage.generics.json @@ -16,13 +16,13 @@ "percent": 100 }, "lines": { - "count": 16, - "covered": 16, + "count": 18, + "covered": 18, "percent": 100 }, "regions": { - "count": 6, - "covered": 6, + "count": 5, + "covered": 5, "notcovered": 0, "percent": 100 } @@ -41,13 +41,13 @@ "percent": 100 }, "lines": { - "count": 16, - "covered": 16, + "count": 18, + "covered": 18, "percent": 100 }, "regions": { - "count": 6, - "covered": 6, + "count": 5, + "covered": 5, "notcovered": 0, "percent": 100 } diff --git a/src/test/run-make-fulldeps/coverage-reports-base/expected_export_coverage.while.json b/src/test/run-make-fulldeps/coverage-reports/expected_export_coverage.if.json similarity index 83% rename from src/test/run-make-fulldeps/coverage-reports-base/expected_export_coverage.while.json rename to src/test/run-make-fulldeps/coverage-reports/expected_export_coverage.if.json index 339c65556682a..8f233f8bfc548 100644 --- a/src/test/run-make-fulldeps/coverage-reports-base/expected_export_coverage.while.json +++ b/src/test/run-make-fulldeps/coverage-reports/expected_export_coverage.if.json @@ -3,7 +3,7 @@ { "files": [ { - "filename": "../coverage/while.rs", + "filename": "../coverage/if.rs", "summary": { "functions": { "count": 1, @@ -16,9 +16,9 @@ "percent": 100 }, "lines": { - "count": 4, - "covered": 3, - "percent": 75 + "count": 26, + "covered": 26, + "percent": 100 }, "regions": { "count": 4, @@ -41,9 +41,9 @@ "percent": 100 }, "lines": { - "count": 4, - "covered": 3, - "percent": 75 + "count": 26, + "covered": 26, + "percent": 100 }, "regions": { "count": 4, diff --git a/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_export_coverage.if_else.json b/src/test/run-make-fulldeps/coverage-reports/expected_export_coverage.if_else.json similarity index 85% rename from src/test/run-make-fulldeps/coverage-reports-deadcode/expected_export_coverage.if_else.json rename to src/test/run-make-fulldeps/coverage-reports/expected_export_coverage.if_else.json index 36f81ceae19bf..5c0454e1ecbc2 100644 --- a/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_export_coverage.if_else.json +++ b/src/test/run-make-fulldeps/coverage-reports/expected_export_coverage.if_else.json @@ -16,9 +16,9 @@ "percent": 100 }, "lines": { - "count": 28, - "covered": 19, - "percent": 67.85714285714286 + "count": 32, + "covered": 23, + "percent": 71.875 }, "regions": { "count": 7, @@ -41,9 +41,9 @@ "percent": 100 }, "lines": { - "count": 28, - "covered": 19, - "percent": 67.85714285714286 + "count": 32, + "covered": 23, + "percent": 71.875 }, "regions": { "count": 7, diff --git a/src/test/run-make-fulldeps/coverage-reports-base/expected_export_coverage.inner_items.json b/src/test/run-make-fulldeps/coverage-reports/expected_export_coverage.inner_items.json similarity index 77% rename from src/test/run-make-fulldeps/coverage-reports-base/expected_export_coverage.inner_items.json rename to src/test/run-make-fulldeps/coverage-reports/expected_export_coverage.inner_items.json index c178e7f93476f..07ef9a9ab3348 100644 --- a/src/test/run-make-fulldeps/coverage-reports-base/expected_export_coverage.inner_items.json +++ b/src/test/run-make-fulldeps/coverage-reports/expected_export_coverage.inner_items.json @@ -16,15 +16,15 @@ "percent": 100 }, "lines": { - "count": 26, - "covered": 26, + "count": 29, + "covered": 29, "percent": 100 }, "regions": { - "count": 15, - "covered": 13, + "count": 11, + "covered": 9, "notcovered": 2, - "percent": 86.66666666666667 + "percent": 81.81818181818183 } } } @@ -41,15 +41,15 @@ "percent": 100 }, "lines": { - "count": 26, - "covered": 26, + "count": 29, + "covered": 29, "percent": 100 }, "regions": { - "count": 15, - "covered": 13, + "count": 11, + "covered": 9, "notcovered": 2, - "percent": 86.66666666666667 + "percent": 81.81818181818183 } } } diff --git a/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_export_coverage.lazy_boolean.json b/src/test/run-make-fulldeps/coverage-reports/expected_export_coverage.lazy_boolean.json similarity index 72% rename from src/test/run-make-fulldeps/coverage-reports-deadcode/expected_export_coverage.lazy_boolean.json rename to src/test/run-make-fulldeps/coverage-reports/expected_export_coverage.lazy_boolean.json index 5a953b90b423f..c3a96b08e6a2a 100644 --- a/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_export_coverage.lazy_boolean.json +++ b/src/test/run-make-fulldeps/coverage-reports/expected_export_coverage.lazy_boolean.json @@ -16,15 +16,15 @@ "percent": 100 }, "lines": { - "count": 40, - "covered": 30, + "count": 44, + "covered": 33, "percent": 75 }, "regions": { - "count": 37, - "covered": 26, - "notcovered": 11, - "percent": 70.27027027027027 + "count": 28, + "covered": 21, + "notcovered": 7, + "percent": 75 } } } @@ -41,15 +41,15 @@ "percent": 100 }, "lines": { - "count": 40, - "covered": 30, + "count": 44, + "covered": 33, "percent": 75 }, "regions": { - "count": 37, - "covered": 26, - "notcovered": 11, - "percent": 70.27027027027027 + "count": 28, + "covered": 21, + "notcovered": 7, + "percent": 75 } } } diff --git a/src/test/run-make-fulldeps/coverage-reports-base/expected_export_coverage.loop_break_value.json b/src/test/run-make-fulldeps/coverage-reports/expected_export_coverage.loop_break_value.json similarity index 100% rename from src/test/run-make-fulldeps/coverage-reports-base/expected_export_coverage.loop_break_value.json rename to src/test/run-make-fulldeps/coverage-reports/expected_export_coverage.loop_break_value.json diff --git a/src/test/run-make-fulldeps/coverage-reports-base/expected_export_coverage.loops_branches.json b/src/test/run-make-fulldeps/coverage-reports/expected_export_coverage.loops_branches.json similarity index 85% rename from src/test/run-make-fulldeps/coverage-reports-base/expected_export_coverage.loops_branches.json rename to src/test/run-make-fulldeps/coverage-reports/expected_export_coverage.loops_branches.json index 2dca41df9d24e..6d566f2b818c8 100644 --- a/src/test/run-make-fulldeps/coverage-reports-base/expected_export_coverage.loops_branches.json +++ b/src/test/run-make-fulldeps/coverage-reports/expected_export_coverage.loops_branches.json @@ -21,10 +21,10 @@ "percent": 100 }, "regions": { - "count": 9, - "covered": 8, + "count": 8, + "covered": 7, "notcovered": 1, - "percent": 88.88888888888889 + "percent": 87.5 } } } @@ -46,10 +46,10 @@ "percent": 100 }, "regions": { - "count": 9, - "covered": 8, + "count": 8, + "covered": 7, "notcovered": 1, - "percent": 88.88888888888889 + "percent": 87.5 } } } diff --git a/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_export_coverage.loop_break_value.json b/src/test/run-make-fulldeps/coverage-reports/expected_export_coverage.nested_loops.json similarity index 66% rename from src/test/run-make-fulldeps/coverage-reports-deadcode/expected_export_coverage.loop_break_value.json rename to src/test/run-make-fulldeps/coverage-reports/expected_export_coverage.nested_loops.json index 6cb1465c81873..bf3b5cb031b92 100644 --- a/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_export_coverage.loop_break_value.json +++ b/src/test/run-make-fulldeps/coverage-reports/expected_export_coverage.nested_loops.json @@ -3,7 +3,7 @@ { "files": [ { - "filename": "../coverage/loop_break_value.rs", + "filename": "../coverage/nested_loops.rs", "summary": { "functions": { "count": 1, @@ -16,15 +16,15 @@ "percent": 100 }, "lines": { - "count": 11, - "covered": 11, - "percent": 100 + "count": 22, + "covered": 17, + "percent": 77.27272727272727 }, "regions": { - "count": 1, - "covered": 1, - "notcovered": 0, - "percent": 100 + "count": 14, + "covered": 11, + "notcovered": 3, + "percent": 78.57142857142857 } } } @@ -41,15 +41,15 @@ "percent": 100 }, "lines": { - "count": 11, - "covered": 11, - "percent": 100 + "count": 22, + "covered": 17, + "percent": 77.27272727272727 }, "regions": { - "count": 1, - "covered": 1, - "notcovered": 0, - "percent": 100 + "count": 14, + "covered": 11, + "notcovered": 3, + "percent": 78.57142857142857 } } } diff --git a/src/test/run-make-fulldeps/coverage-reports-base/expected_export_coverage.tight_inf_loop.json b/src/test/run-make-fulldeps/coverage-reports/expected_export_coverage.overflow.json similarity index 62% rename from src/test/run-make-fulldeps/coverage-reports-base/expected_export_coverage.tight_inf_loop.json rename to src/test/run-make-fulldeps/coverage-reports/expected_export_coverage.overflow.json index 872560384eb90..030d7b033f009 100644 --- a/src/test/run-make-fulldeps/coverage-reports-base/expected_export_coverage.tight_inf_loop.json +++ b/src/test/run-make-fulldeps/coverage-reports/expected_export_coverage.overflow.json @@ -3,53 +3,53 @@ { "files": [ { - "filename": "../coverage/tight_inf_loop.rs", + "filename": "../coverage/overflow.rs", "summary": { "functions": { - "count": 1, - "covered": 1, + "count": 2, + "covered": 2, "percent": 100 }, "instantiations": { - "count": 1, - "covered": 1, - "percent": 100 - }, - "lines": { "count": 2, "covered": 2, "percent": 100 }, + "lines": { + "count": 23, + "covered": 19, + "percent": 82.6086956521739 + }, "regions": { - "count": 2, - "covered": 2, - "notcovered": 0, - "percent": 100 + "count": 13, + "covered": 11, + "notcovered": 2, + "percent": 84.61538461538461 } } } ], "totals": { "functions": { - "count": 1, - "covered": 1, + "count": 2, + "covered": 2, "percent": 100 }, "instantiations": { - "count": 1, - "covered": 1, - "percent": 100 - }, - "lines": { "count": 2, "covered": 2, "percent": 100 }, + "lines": { + "count": 23, + "covered": 19, + "percent": 82.6086956521739 + }, "regions": { - "count": 2, - "covered": 2, - "notcovered": 0, - "percent": 100 + "count": 13, + "covered": 11, + "notcovered": 2, + "percent": 84.61538461538461 } } } diff --git a/src/test/run-make-fulldeps/coverage-reports-base/expected_export_coverage.try_error_result.json b/src/test/run-make-fulldeps/coverage-reports/expected_export_coverage.panic_unwind.json similarity index 66% rename from src/test/run-make-fulldeps/coverage-reports-base/expected_export_coverage.try_error_result.json rename to src/test/run-make-fulldeps/coverage-reports/expected_export_coverage.panic_unwind.json index 78b935b15689a..b1d44fdfeac54 100644 --- a/src/test/run-make-fulldeps/coverage-reports-base/expected_export_coverage.try_error_result.json +++ b/src/test/run-make-fulldeps/coverage-reports/expected_export_coverage.panic_unwind.json @@ -3,7 +3,7 @@ { "files": [ { - "filename": "../coverage/try_error_result.rs", + "filename": "../coverage/panic_unwind.rs", "summary": { "functions": { "count": 2, @@ -16,15 +16,15 @@ "percent": 100 }, "lines": { - "count": 20, - "covered": 18, - "percent": 90 + "count": 19, + "covered": 16, + "percent": 84.21052631578947 }, "regions": { - "count": 19, - "covered": 14, - "notcovered": 5, - "percent": 73.68421052631578 + "count": 13, + "covered": 11, + "notcovered": 2, + "percent": 84.61538461538461 } } } @@ -41,15 +41,15 @@ "percent": 100 }, "lines": { - "count": 20, - "covered": 18, - "percent": 90 + "count": 19, + "covered": 16, + "percent": 84.21052631578947 }, "regions": { - "count": 19, - "covered": 14, - "notcovered": 5, - "percent": 73.68421052631578 + "count": 13, + "covered": 11, + "notcovered": 2, + "percent": 84.61538461538461 } } } diff --git a/src/test/run-make-fulldeps/coverage-reports-base/expected_export_coverage.partial_eq.json b/src/test/run-make-fulldeps/coverage-reports/expected_export_coverage.partial_eq.json similarity index 54% rename from src/test/run-make-fulldeps/coverage-reports-base/expected_export_coverage.partial_eq.json rename to src/test/run-make-fulldeps/coverage-reports/expected_export_coverage.partial_eq.json index a7b98247b6631..6a0d83a6d0e44 100644 --- a/src/test/run-make-fulldeps/coverage-reports-base/expected_export_coverage.partial_eq.json +++ b/src/test/run-make-fulldeps/coverage-reports/expected_export_coverage.partial_eq.json @@ -7,24 +7,24 @@ "summary": { "functions": { "count": 5, - "covered": 5, - "percent": 100 + "covered": 4, + "percent": 80 }, "instantiations": { "count": 5, - "covered": 5, - "percent": 100 + "covered": 4, + "percent": 80 }, "lines": { - "count": 15, - "covered": 15, - "percent": 100 + "count": 18, + "covered": 16, + "percent": 88.88888888888889 }, "regions": { - "count": 6, - "covered": 6, - "notcovered": 0, - "percent": 100 + "count": 24, + "covered": 5, + "notcovered": 19, + "percent": 20.833333333333336 } } } @@ -32,24 +32,24 @@ "totals": { "functions": { "count": 5, - "covered": 5, - "percent": 100 + "covered": 4, + "percent": 80 }, "instantiations": { "count": 5, - "covered": 5, - "percent": 100 + "covered": 4, + "percent": 80 }, "lines": { - "count": 15, - "covered": 15, - "percent": 100 + "count": 18, + "covered": 16, + "percent": 88.88888888888889 }, "regions": { - "count": 6, - "covered": 6, - "notcovered": 0, - "percent": 100 + "count": 24, + "covered": 5, + "notcovered": 19, + "percent": 20.833333333333336 } } } diff --git a/src/test/run-make-fulldeps/coverage-reports-base/expected_export_coverage.simple_loop.json b/src/test/run-make-fulldeps/coverage-reports/expected_export_coverage.simple_loop.json similarity index 77% rename from src/test/run-make-fulldeps/coverage-reports-base/expected_export_coverage.simple_loop.json rename to src/test/run-make-fulldeps/coverage-reports/expected_export_coverage.simple_loop.json index ada6bb062dd1e..4c849692a034c 100644 --- a/src/test/run-make-fulldeps/coverage-reports-base/expected_export_coverage.simple_loop.json +++ b/src/test/run-make-fulldeps/coverage-reports/expected_export_coverage.simple_loop.json @@ -16,15 +16,15 @@ "percent": 100 }, "lines": { - "count": 19, - "covered": 19, + "count": 25, + "covered": 25, "percent": 100 }, "regions": { - "count": 9, - "covered": 8, + "count": 7, + "covered": 6, "notcovered": 1, - "percent": 88.88888888888889 + "percent": 85.71428571428571 } } } @@ -41,15 +41,15 @@ "percent": 100 }, "lines": { - "count": 19, - "covered": 19, + "count": 25, + "covered": 25, "percent": 100 }, "regions": { - "count": 9, - "covered": 8, + "count": 7, + "covered": 6, "notcovered": 1, - "percent": 88.88888888888889 + "percent": 85.71428571428571 } } } diff --git a/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_export_coverage.simple_match.json b/src/test/run-make-fulldeps/coverage-reports/expected_export_coverage.simple_match.json similarity index 77% rename from src/test/run-make-fulldeps/coverage-reports-deadcode/expected_export_coverage.simple_match.json rename to src/test/run-make-fulldeps/coverage-reports/expected_export_coverage.simple_match.json index 63d1ae74c5f5d..41bc4d57d59f4 100644 --- a/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_export_coverage.simple_match.json +++ b/src/test/run-make-fulldeps/coverage-reports/expected_export_coverage.simple_match.json @@ -16,15 +16,15 @@ "percent": 100 }, "lines": { - "count": 24, - "covered": 24, + "count": 27, + "covered": 27, "percent": 100 }, "regions": { - "count": 15, - "covered": 14, + "count": 11, + "covered": 10, "notcovered": 1, - "percent": 93.33333333333333 + "percent": 90.9090909090909 } } } @@ -41,15 +41,15 @@ "percent": 100 }, "lines": { - "count": 24, - "covered": 24, + "count": 27, + "covered": 27, "percent": 100 }, "regions": { - "count": 15, - "covered": 14, + "count": 11, + "covered": 10, "notcovered": 1, - "percent": 93.33333333333333 + "percent": 90.9090909090909 } } } diff --git a/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_export_coverage.tight_inf_loop.json b/src/test/run-make-fulldeps/coverage-reports/expected_export_coverage.tight_inf_loop.json similarity index 91% rename from src/test/run-make-fulldeps/coverage-reports-deadcode/expected_export_coverage.tight_inf_loop.json rename to src/test/run-make-fulldeps/coverage-reports/expected_export_coverage.tight_inf_loop.json index 872560384eb90..7f6c90b92d296 100644 --- a/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_export_coverage.tight_inf_loop.json +++ b/src/test/run-make-fulldeps/coverage-reports/expected_export_coverage.tight_inf_loop.json @@ -16,8 +16,8 @@ "percent": 100 }, "lines": { - "count": 2, - "covered": 2, + "count": 4, + "covered": 4, "percent": 100 }, "regions": { @@ -41,8 +41,8 @@ "percent": 100 }, "lines": { - "count": 2, - "covered": 2, + "count": 4, + "covered": 4, "percent": 100 }, "regions": { diff --git a/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_export_coverage.try_error_result.json b/src/test/run-make-fulldeps/coverage-reports/expected_export_coverage.try_error_result.json similarity index 80% rename from src/test/run-make-fulldeps/coverage-reports-deadcode/expected_export_coverage.try_error_result.json rename to src/test/run-make-fulldeps/coverage-reports/expected_export_coverage.try_error_result.json index 78b935b15689a..df4de9dc54bdc 100644 --- a/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_export_coverage.try_error_result.json +++ b/src/test/run-make-fulldeps/coverage-reports/expected_export_coverage.try_error_result.json @@ -21,10 +21,10 @@ "percent": 90 }, "regions": { - "count": 19, - "covered": 14, - "notcovered": 5, - "percent": 73.68421052631578 + "count": 16, + "covered": 12, + "notcovered": 4, + "percent": 75 } } } @@ -46,10 +46,10 @@ "percent": 90 }, "regions": { - "count": 19, - "covered": 14, - "notcovered": 5, - "percent": 73.68421052631578 + "count": 16, + "covered": 12, + "notcovered": 4, + "percent": 75 } } } diff --git a/src/test/run-make-fulldeps/coverage-reports/expected_export_coverage.uses_crate.json b/src/test/run-make-fulldeps/coverage-reports/expected_export_coverage.uses_crate.json new file mode 100644 index 0000000000000..35ddd58fc437a --- /dev/null +++ b/src/test/run-make-fulldeps/coverage-reports/expected_export_coverage.uses_crate.json @@ -0,0 +1,59 @@ +{ + "data": [ + { + "files": [ + { + "filename": "../coverage/lib/used_crate.rs", + "summary": { + "functions": { + "count": 6, + "covered": 5, + "percent": 83.33333333333334 + }, + "instantiations": { + "count": 10, + "covered": 8, + "percent": 80 + }, + "lines": { + "count": 46, + "covered": 26, + "percent": 56.52173913043478 + }, + "regions": { + "count": 19, + "covered": 8, + "notcovered": 11, + "percent": 42.10526315789473 + } + } + } + ], + "totals": { + "functions": { + "count": 6, + "covered": 5, + "percent": 83.33333333333334 + }, + "instantiations": { + "count": 10, + "covered": 8, + "percent": 80 + }, + "lines": { + "count": 46, + "covered": 26, + "percent": 56.52173913043478 + }, + "regions": { + "count": 19, + "covered": 8, + "notcovered": 11, + "percent": 42.10526315789473 + } + } + } + ], + "type": "llvm.coverage.json.export", + "version": "2.0.1" +} diff --git a/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_export_coverage.while.json b/src/test/run-make-fulldeps/coverage-reports/expected_export_coverage.while.json similarity index 87% rename from src/test/run-make-fulldeps/coverage-reports-deadcode/expected_export_coverage.while.json rename to src/test/run-make-fulldeps/coverage-reports/expected_export_coverage.while.json index 339c65556682a..339c533ada6dc 100644 --- a/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_export_coverage.while.json +++ b/src/test/run-make-fulldeps/coverage-reports/expected_export_coverage.while.json @@ -16,9 +16,9 @@ "percent": 100 }, "lines": { - "count": 4, - "covered": 3, - "percent": 75 + "count": 5, + "covered": 4, + "percent": 80 }, "regions": { "count": 4, @@ -41,9 +41,9 @@ "percent": 100 }, "lines": { - "count": 4, - "covered": 3, - "percent": 75 + "count": 5, + "covered": 4, + "percent": 80 }, "regions": { "count": 4, diff --git a/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_export_coverage.while_early_ret.json b/src/test/run-make-fulldeps/coverage-reports/expected_export_coverage.while_early_ret.json similarity index 85% rename from src/test/run-make-fulldeps/coverage-reports-deadcode/expected_export_coverage.while_early_ret.json rename to src/test/run-make-fulldeps/coverage-reports/expected_export_coverage.while_early_ret.json index ad43f5d992630..b7fe2a0fb47df 100644 --- a/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_export_coverage.while_early_ret.json +++ b/src/test/run-make-fulldeps/coverage-reports/expected_export_coverage.while_early_ret.json @@ -16,9 +16,9 @@ "percent": 100 }, "lines": { - "count": 17, - "covered": 15, - "percent": 88.23529411764706 + "count": 19, + "covered": 17, + "percent": 89.47368421052632 }, "regions": { "count": 9, @@ -41,9 +41,9 @@ "percent": 100 }, "lines": { - "count": 17, - "covered": 15, - "percent": 88.23529411764706 + "count": 19, + "covered": 17, + "percent": 89.47368421052632 }, "regions": { "count": 9, diff --git a/src/test/run-make-fulldeps/coverage-reports-base/expected_export_coverage.generics.json b/src/test/run-make-fulldeps/coverage-reports/expected_export_coverage.yield.json similarity index 55% rename from src/test/run-make-fulldeps/coverage-reports-base/expected_export_coverage.generics.json rename to src/test/run-make-fulldeps/coverage-reports/expected_export_coverage.yield.json index a50f4657e20aa..6fc41212bc091 100644 --- a/src/test/run-make-fulldeps/coverage-reports-base/expected_export_coverage.generics.json +++ b/src/test/run-make-fulldeps/coverage-reports/expected_export_coverage.yield.json @@ -3,7 +3,7 @@ { "files": [ { - "filename": "../coverage/generics.rs", + "filename": "../coverage/yield.rs", "summary": { "functions": { "count": 3, @@ -11,20 +11,20 @@ "percent": 100 }, "instantiations": { - "count": 5, - "covered": 5, + "count": 3, + "covered": 3, "percent": 100 }, "lines": { - "count": 16, - "covered": 16, - "percent": 100 + "count": 26, + "covered": 19, + "percent": 73.07692307692307 }, "regions": { - "count": 6, - "covered": 6, - "notcovered": 0, - "percent": 100 + "count": 23, + "covered": 17, + "notcovered": 6, + "percent": 73.91304347826086 } } } @@ -36,20 +36,20 @@ "percent": 100 }, "instantiations": { - "count": 5, - "covered": 5, + "count": 3, + "covered": 3, "percent": 100 }, "lines": { - "count": 16, - "covered": 16, - "percent": 100 + "count": 26, + "covered": 19, + "percent": 73.07692307692307 }, "regions": { - "count": 6, - "covered": 6, - "notcovered": 0, - "percent": 100 + "count": 23, + "covered": 17, + "notcovered": 6, + "percent": 73.91304347826086 } } } diff --git a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.abort.txt b/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.abort.txt new file mode 100644 index 0000000000000..3b5d5eb422702 --- /dev/null +++ b/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.abort.txt @@ -0,0 +1,70 @@ + 1| |#![feature(unwind_attributes)] + 2| |#![allow(unused_assignments)] + 3| | + 4| |#[unwind(aborts)] + 5| 12|fn might_abort(should_abort: bool) { + 6| 12| if should_abort { + 7| 0| println!("aborting..."); + 8| 0| panic!("panics and aborts"); + 9| 12| } else { + 10| 12| println!("Don't Panic"); + 11| 12| } + 12| 12|} + 13| | + 14| 1|fn main() -> Result<(), u8> { + 15| 1| let mut countdown = 10; + 16| 11| while countdown > 0 { + 17| 10| if countdown < 5 { + 18| 4| might_abort(false); + 19| 6| } + 20| | // See discussion (below the `Notes` section) on coverage results for the closing brace. + 21| 10| if countdown < 5 { might_abort(false); } // Counts for different regions on one line. + ^4 ^6 + 22| | // For the following example, the closing brace is the last character on the line. + 23| | // This shows the character after the closing brace is highlighted, even if that next + 24| | // character is a newline. + 25| 10| if countdown < 5 { might_abort(false); } + ^4 ^6 + 26| 10| countdown -= 1; + 27| | } + 28| 1| Ok(()) + 29| 1|} + 30| | + 31| |// Notes: + 32| |// 1. Compare this program and its coverage results to those of the similar tests + 33| |// `panic_unwind.rs` and `try_error_result.rs`. + 34| |// 2. This test confirms the coverage generated when a program includes `TerminatorKind::Abort`. + 35| |// 3. The test does not invoke the abort. By executing to a successful completion, the coverage + 36| |// results show where the program did and did not execute. + 37| |// 4. If the program actually aborted, the coverage counters would not be saved (which "works as + 38| |// intended"). Coverage results would show no executed coverage regions. + 39| |// 6. If `should_abort` is `true` and the program aborts, the program exits with a `132` status + 40| |// (on Linux at least). + 41| | + 42| |/* + 43| | + 44| |Expect the following coverage results: + 45| | + 46| |```text + 47| | 16| 11| while countdown > 0 { + 48| | 17| 10| if countdown < 5 { + 49| | 18| 4| might_abort(false); + 50| | 19| 6| } + 51| |``` + 52| | + 53| |This is actually correct. + 54| | + 55| |The condition `countdown < 5` executed 10 times (10 loop iterations). + 56| | + 57| |It evaluated to `true` 4 times, and executed the `might_abort()` call. + 58| | + 59| |It skipped the body of the `might_abort()` call 6 times. If an `if` does not include an explicit + 60| |`else`, the coverage implementation injects a counter, at the character immediately after the `if`s + 61| |closing brace, to count the "implicit" `else`. This is the only way to capture the coverage of the + 62| |non-true condition. + 63| | + 64| |As another example of why this is important, say the condition was `countdown < 50`, which is always + 65| |`true`. In that case, we wouldn't have a test for what happens if `might_abort()` is not called. + 66| |The closing brace would have a count of `0`, highlighting the missed coverage. + 67| |*/ + diff --git a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.assert.txt b/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.assert.txt new file mode 100644 index 0000000000000..355b53f7f3b69 --- /dev/null +++ b/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.assert.txt @@ -0,0 +1,34 @@ + 1| |#![allow(unused_assignments)] + 2| |// expect-exit-status-101 + 3| | + 4| 4|fn might_fail_assert(one_plus_one: u32) { + 5| 4| println!("does 1 + 1 = {}?", one_plus_one); + 6| 4| assert_eq!(1 + 1, one_plus_one, "the argument was wrong"); + ^1 + 7| 3|} + 8| | + 9| 1|fn main() -> Result<(),u8> { + 10| 1| let mut countdown = 10; + 11| 10| while countdown > 0 { + 12| 10| if countdown == 1 { + 13| 0| might_fail_assert(3); + 14| 10| } else if countdown < 5 { + 15| 3| might_fail_assert(2); + 16| 6| } + 17| 9| countdown -= 1; + 18| | } + 19| 0| Ok(()) + 20| 0|} + 21| | + 22| |// Notes: + 23| |// 1. Compare this program and its coverage results to those of the very similar test + 24| |// `panic_unwind.rs`, and similar tests `abort.rs` and `try_error_result.rs`. + 25| |// 2. This test confirms the coverage generated when a program passes or fails an `assert!()` or + 26| |// related `assert_*!()` macro. + 27| |// 3. Notably, the `assert` macros *do not* generate `TerminatorKind::Assert`. The macros produce + 28| |// conditional expressions, `TerminatorKind::SwitchInt` branches, and a possible call to + 29| |// `begin_panic_fmt()` (that begins a panic unwind, if the assertion test fails). + 30| |// 4. `TerminatoKind::Assert` is, however, also present in the MIR generated for this test + 31| |// (and in many other coverage tests). The `Assert` terminator is typically generated by the + 32| |// Rust compiler to check for runtime failures, such as numeric overflows. + diff --git a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.async.txt b/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.async.txt new file mode 100644 index 0000000000000..824bddaa40155 --- /dev/null +++ b/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.async.txt @@ -0,0 +1,135 @@ + 1| |#![allow(unused_assignments, dead_code)] + 2| | + 3| |// require-rust-edition-2018 + 4| | + 5| 1|async fn c(x: u8) -> u8 { + 6| 1| if x == 8 { + 7| 1| 1 + 8| | } else { + 9| 0| 0 + 10| | } + 11| 1|} + 12| | + 13| 0|async fn d() -> u8 { 1 } + 14| | + 15| 0|async fn e() -> u8 { 1 } // unused function; executor does not block on `g()` + 16| | + 17| 1|async fn f() -> u8 { 1 } + 18| | + 19| 0|async fn foo() -> [bool; 10] { [false; 10] } // unused function; executor does not block on `h()` + 20| | + 21| 1|pub async fn g(x: u8) { + 22| 0| match x { + 23| 0| y if e().await == y => (), + 24| 0| y if f().await == y => (), + 25| 0| _ => (), + 26| | } + 27| 0|} + 28| | + 29| 1|async fn h(x: usize) { // The function signature is counted when called, but the body is not + 30| 0| // executed (not awaited) so the open brace has a `0` count (at least when + 31| 0| // displayed with `llvm-cov show` in color-mode). + 32| 0| match x { + 33| 0| y if foo().await[y] => (), + 34| 0| _ => (), + 35| | } + 36| 0|} + 37| | + 38| 1|async fn i(x: u8) { // line coverage is 1, but there are 2 regions: + 39| 1| // (a) the function signature, counted when the function is called; and + 40| 1| // (b) the open brace for the function body, counted once when the body is + 41| 1| // executed asynchronously. + 42| 1| match x { + 43| 1| y if c(x).await == y + 1 => { d().await; } + ^0 ^0 + 44| 1| y if f().await == y + 1 => (), + ^0 ^0 + 45| 1| _ => (), + 46| | } + 47| 1|} + 48| | + 49| 1|fn j(x: u8) { + 50| 1| // non-async versions of `c()`, `d()`, and `f()` to make it similar to async `i()`. + 51| 1| fn c(x: u8) -> u8 { + 52| 1| if x == 8 { + 53| 1| 1 // This line appears covered, but the 1-character expression span covering the `1` + ^0 + 54| 1| // is not executed. (`llvm-cov show` displays a `^0` below the `1` ). This is because + 55| 1| // `fn j()` executes the open brace for the funciton body, followed by the function's + 56| 1| // first executable statement, `match x`. Inner function declarations are not + 57| 1| // "visible" to the MIR for `j()`, so the code region counts all lines between the + 58| 1| // open brace and the first statement as executed, which is, in a sense, true. + 59| 1| // `llvm-cov show` overcomes this kind of situation by showing the actual counts + 60| 1| // of the enclosed coverages, (that is, the `1` expression was not executed, and + 61| 1| // accurately displays a `0`). + 62| 1| } else { + 63| 1| 0 + 64| 1| } + 65| 1| } + 66| 1| fn d() -> u8 { 1 } + 67| 1| fn f() -> u8 { 1 } + 68| 1| match x { + 69| 1| y if c(x) == y + 1 => { d(); } + ^0 ^0 + 70| 1| y if f() == y + 1 => (), + ^0 ^0 + 71| 1| _ => (), + 72| | } + 73| 1|} + 74| | + 75| 0|fn k(x: u8) { // unused function + 76| 0| match x { + 77| 0| 1 => (), + 78| 0| 2 => (), + 79| 0| _ => (), + 80| | } + 81| 0|} + 82| | + 83| 1|fn l(x: u8) { + 84| 1| match x { + 85| 0| 1 => (), + 86| 0| 2 => (), + 87| 1| _ => (), + 88| | } + 89| 1|} + 90| | + 91| 1|async fn m(x: u8) -> u8 { x - 1 } + ^0 + 92| | + 93| 1|fn main() { + 94| 1| let _ = g(10); + 95| 1| let _ = h(9); + 96| 1| let mut future = Box::pin(i(8)); + 97| 1| j(7); + 98| 1| l(6); + 99| 1| let _ = m(5); + 100| 1| executor::block_on(future.as_mut()); + 101| 1|} + 102| | + 103| |mod executor { + 104| | use core::{ + 105| | future::Future, + 106| | pin::Pin, + 107| | task::{Context, Poll, RawWaker, RawWakerVTable, Waker}, + 108| | }; + 109| | + 110| 1| pub fn block_on(mut future: F) -> F::Output { + 111| 1| let mut future = unsafe { Pin::new_unchecked(&mut future) }; + 112| 1| + 113| 1| static VTABLE: RawWakerVTable = RawWakerVTable::new( + 114| 1| |_| unimplemented!("clone"), + 115| 1| |_| unimplemented!("wake"), + 116| 1| |_| unimplemented!("wake_by_ref"), + 117| 1| |_| (), + 118| 1| ); + 119| 1| let waker = unsafe { Waker::from_raw(RawWaker::new(core::ptr::null(), &VTABLE)) }; + 120| 1| let mut context = Context::from_waker(&waker); + 121| | + 122| | loop { + 123| 1| if let Poll::Ready(val) = future.as_mut().poll(&mut context) { + 124| 1| break val; + 125| 0| } + 126| | } + 127| 1| } + 128| |} + diff --git a/src/test/run-make-fulldeps/coverage-reports-base/expected_show_coverage.closure.txt b/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.closure.txt similarity index 51% rename from src/test/run-make-fulldeps/coverage-reports-base/expected_show_coverage.closure.txt rename to src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.closure.txt index aef26a62e25fb..7261cf0a3b0da 100644 --- a/src/test/run-make-fulldeps/coverage-reports-base/expected_show_coverage.closure.txt +++ b/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.closure.txt @@ -16,7 +16,7 @@ 16| 1| unwrap_or_else 17| 1| ( 18| 1| || - 19| | { + 19| 0| { 20| 0| let mut countdown = 0; 21| 0| if is_false { 22| 0| countdown = 10; @@ -31,7 +31,7 @@ 31| 1| a 32| 1| = 33| 1| || - 34| | { + 34| 0| { 35| 0| let mut countdown = 0; 36| 0| if is_false { 37| 0| countdown = 10; @@ -58,7 +58,7 @@ 58| 1| unwrap_or_else 59| 1| ( 60| 1| || - 61| | { + 61| 1| { 62| 1| let mut countdown = 0; 63| 1| if is_false { 64| 0| countdown = 10; @@ -73,7 +73,7 @@ 73| 1| a 74| 1| = 75| 1| || - 76| | { + 76| 1| { 77| 1| let mut countdown = 0; 78| 1| if is_false { 79| 0| countdown = 10; @@ -90,5 +90,71 @@ 90| 1| a 91| 1| ) 92| 1| ); - 93| 1|} + 93| 1| + 94| 1| let + 95| 1| quote_closure + 96| 1| = + 97| 1| |val| + 98| 5| { + 99| 5| let mut countdown = 0; + 100| 5| if is_false { + 101| 0| countdown = 10; + 102| 5| } + 103| 5| format!("'{}'", val) + 104| 5| }; + 105| 1| println!( + 106| 1| "Repeated, quoted string: {:?}" + 107| 1| , + 108| 1| std::iter::repeat("repeat me") + 109| 1| .take(5) + 110| 1| .map + 111| 1| ( + 112| 1| quote_closure + 113| 1| ) + 114| 1| .collect::>() + 115| 1| ); + 116| 1| + 117| 1| let + 118| 1| _unused_closure + 119| 1| = + 120| 1| | + 121| | mut countdown + 122| | | + 123| 0| { + 124| 0| if is_false { + 125| 0| countdown = 10; + 126| 0| } + 127| 0| "closure should be unused".to_owned() + 128| 1| }; + 129| 1| + 130| 1| let mut countdown = 10; + 131| 1| let _short_unused_closure = | _unused_arg: u8 | countdown += 1; + ^0 + 132| 1| + 133| 1| // Macros can sometimes confuse the coverage results. Compare this next assignment, with an + 134| 1| // unused closure that invokes the `println!()` macro, with the closure assignment above, that + 135| 1| // does not use a macro. The closure above correctly shows `0` executions. + 136| 1| let _short_unused_closure = | _unused_arg: u8 | println!("not called"); + 137| 1| // The closure assignment above is executed, with a line count of `1`, but the `println!()` + 138| 1| // could not have been called, and yet, there is no indication that it wasn't... + 139| 1| + 140| 1| // ...but adding block braces gives the expected result, showing the block was not executed. + 141| 1| let _short_unused_closure_block = | _unused_arg: u8 | { println!("not called") }; + ^0 + 142| 1| + 143| 1| let _shortish_unused_closure = | _unused_arg: u8 | { + 144| 0| println!("not called") + 145| 1| }; + 146| 1| + 147| 1| let _as_short_unused_closure = | + 148| | _unused_arg: u8 + 149| 1| | { println!("not called") }; + ^0 + 150| 1| + 151| 1| let _almost_as_short_unused_closure = | + 152| | _unused_arg: u8 + 153| 1| | { println!("not called") } + ^0 + 154| 1| ; + 155| 1|} diff --git a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.conditions.txt b/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.conditions.txt new file mode 100644 index 0000000000000..656a26597759d --- /dev/null +++ b/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.conditions.txt @@ -0,0 +1,90 @@ + 1| |#![allow(unused_assignments, unused_variables)] + 2| | + 3| 1|fn main() { + 4| 1| let mut countdown = 0; + 5| 1| if true { + 6| 1| countdown = 10; + 7| 1| } + 8| | + 9| | const B: u32 = 100; + 10| 1| let x = if countdown > 7 { + 11| 1| countdown -= 4; + 12| 1| B + 13| 0| } else if countdown > 2 { + 14| 0| if countdown < 1 || countdown > 5 || countdown != 9 { + 15| 0| countdown = 0; + 16| 0| } + 17| 0| countdown -= 5; + 18| 0| countdown + 19| | } else { + 20| 0| return; + 21| | }; + 22| | + 23| 1| let mut countdown = 0; + 24| 1| if true { + 25| 1| countdown = 10; + 26| 1| } + 27| | + 28| 1| if countdown > 7 { + 29| 1| countdown -= 4; + 30| 1| } else if countdown > 2 { + ^0 + 31| 0| if countdown < 1 || countdown > 5 || countdown != 9 { + 32| 0| countdown = 0; + 33| 0| } + 34| 0| countdown -= 5; + 35| | } else { + 36| 0| return; + 37| | } + 38| | + 39| 1| if true { + 40| 1| let mut countdown = 0; + 41| 1| if true { + 42| 1| countdown = 10; + 43| 1| } + 44| | + 45| 1| if countdown > 7 { + 46| 1| countdown -= 4; + 47| 1| } + 48| 0| else if countdown > 2 { + 49| 0| if countdown < 1 || countdown > 5 || countdown != 9 { + 50| 0| countdown = 0; + 51| 0| } + 52| 0| countdown -= 5; + 53| | } else { + 54| 0| return; + 55| | } + 56| | } // Note: closing brace shows uncovered (vs. `0` for implicit else) because condition literal + 57| | // `true` was const-evaluated. The compiler knows the `if` block will be executed. + 58| | + 59| 1| let mut countdown = 0; + 60| 1| if true { + 61| 1| countdown = 1; + 62| 1| } + 63| | + 64| 1| let z = if countdown > 7 { + ^0 + 65| 0| countdown -= 4; + 66| 1| } else if countdown > 2 { + 67| 0| if countdown < 1 || countdown > 5 || countdown != 9 { + 68| 0| countdown = 0; + 69| 0| } + 70| 0| countdown -= 5; + 71| | } else { + 72| 1| let should_be_reachable = countdown; + 73| 1| println!("reached"); + 74| 1| return; + 75| | }; + 76| | + 77| 0| let w = if countdown > 7 { + 78| 0| countdown -= 4; + 79| 0| } else if countdown > 2 { + 80| 0| if countdown < 1 || countdown > 5 || countdown != 9 { + 81| 0| countdown = 0; + 82| 0| } + 83| 0| countdown -= 5; + 84| | } else { + 85| 0| return; + 86| | }; + 87| 1|} + diff --git a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.dead_code.txt b/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.dead_code.txt new file mode 100644 index 0000000000000..09ff14c6f2722 --- /dev/null +++ b/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.dead_code.txt @@ -0,0 +1,39 @@ + 1| |#![allow(unused_assignments, unused_variables)] + 2| | + 3| 0|pub fn unused_pub_fn_not_in_library() { + 4| 0| // Initialize test constants in a way that cannot be determined at compile time, to ensure + 5| 0| // rustc and LLVM cannot optimize out statements (or coverage counters) downstream from + 6| 0| // dependent conditions. + 7| 0| let is_true = std::env::args().len() == 1; + 8| 0| + 9| 0| let mut countdown = 0; + 10| 0| if is_true { + 11| 0| countdown = 10; + 12| 0| } + 13| 0|} + 14| | + 15| 0|fn unused_fn() { + 16| 0| // Initialize test constants in a way that cannot be determined at compile time, to ensure + 17| 0| // rustc and LLVM cannot optimize out statements (or coverage counters) downstream from + 18| 0| // dependent conditions. + 19| 0| let is_true = std::env::args().len() == 1; + 20| 0| + 21| 0| let mut countdown = 0; + 22| 0| if is_true { + 23| 0| countdown = 10; + 24| 0| } + 25| 0|} + 26| | + 27| 1|fn main() { + 28| 1| // Initialize test constants in a way that cannot be determined at compile time, to ensure + 29| 1| // rustc and LLVM cannot optimize out statements (or coverage counters) downstream from + 30| 1| // dependent conditions. + 31| 1| let is_true = std::env::args().len() == 1; + 32| 1| + 33| 1| let mut countdown = 0; + 34| 1| if is_true { + 35| 1| countdown = 10; + 36| 1| } + ^0 + 37| 1|} + diff --git a/src/test/run-make-fulldeps/coverage-reports-base/expected_show_coverage.drop_trait.txt b/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.drop_trait.txt similarity index 94% rename from src/test/run-make-fulldeps/coverage-reports-base/expected_show_coverage.drop_trait.txt rename to src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.drop_trait.txt index 72aa020ca1691..fab5be41901c9 100644 --- a/src/test/run-make-fulldeps/coverage-reports-base/expected_show_coverage.drop_trait.txt +++ b/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.drop_trait.txt @@ -11,11 +11,11 @@ 11| 2| } 12| |} 13| | - 14| |fn main() -> Result<(),u8> { + 14| 1|fn main() -> Result<(),u8> { 15| 1| let _firecracker = Firework { strength: 1 }; 16| 1| 17| 1| let _tnt = Firework { strength: 100 }; - 18| | + 18| 1| 19| 1| if true { 20| 1| println!("Exiting with error..."); 21| 1| return Err(1); diff --git a/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_show_coverage.generics.txt b/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.generics.txt similarity index 69% rename from src/test/run-make-fulldeps/coverage-reports-deadcode/expected_show_coverage.generics.txt rename to src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.generics.txt index 86199d7476302..7b38ffb87cba8 100644 --- a/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_show_coverage.generics.txt +++ b/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.generics.txt @@ -41,27 +41,31 @@ ------------------ 20| |} 21| | - 22| |fn main() -> Result<(),u8> { + 22| 1|fn main() -> Result<(),u8> { 23| 1| let mut firecracker = Firework { strength: 1 }; 24| 1| firecracker.set_strength(2); 25| 1| 26| 1| let mut tnt = Firework { strength: 100.1 }; 27| 1| tnt.set_strength(200.1); 28| 1| tnt.set_strength(300.3); - 29| | + 29| 1| 30| 1| if true { 31| 1| println!("Exiting with error..."); 32| 1| return Err(1); - 33| | } - 34| | - 35| | let _ = Firework { strength: 1000 }; - 36| | - 37| | Ok(()) - 38| 1|} - 39| | - 40| |// Expected program output: - 41| |// Exiting with error... - 42| |// BOOM times 100!!! - 43| |// BOOM times 1!!! - 44| |// Error: 1 + 33| | } // The remaining lines below have no coverage because `if true` (with the constant literal + 34| | // `true`) is guaranteed to execute the `then` block, which is also guaranteed to `return`. + 35| | // Thankfully, in the normal case, conditions are not guaranteed ahead of time, and as shown + 36| | // in other tests, the lines below would have coverage (which would show they had `0` + 37| | // executions, assuming the condition still evaluated to `true`). + 38| | + 39| | let _ = Firework { strength: 1000 }; + 40| | + 41| | Ok(()) + 42| 1|} + 43| | + 44| |// Expected program output: + 45| |// Exiting with error... + 46| |// BOOM times 100!!! + 47| |// BOOM times 1!!! + 48| |// Error: 1 diff --git a/src/test/run-make-fulldeps/coverage-reports-base/expected_show_coverage.if.txt b/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.if.txt similarity index 71% rename from src/test/run-make-fulldeps/coverage-reports-base/expected_show_coverage.if.txt rename to src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.if.txt index 85e6440ab3729..0c9eff227ed0c 100644 --- a/src/test/run-make-fulldeps/coverage-reports-base/expected_show_coverage.if.txt +++ b/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.if.txt @@ -1,10 +1,10 @@ 1| |#![allow(unused_assignments, unused_variables)] 2| | - 3| |fn main() { - 4| | // Initialize test constants in a way that cannot be determined at compile time, to ensure - 5| | // rustc and LLVM cannot optimize out statements (or coverage counters) downstream from - 6| | // dependent conditions. - 7| | let + 3| 1|fn main() { + 4| 1| // Initialize test constants in a way that cannot be determined at compile time, to ensure + 5| 1| // rustc and LLVM cannot optimize out statements (or coverage counters) downstream from + 6| 1| // dependent conditions. + 7| 1| let 8| 1| is_true 9| 1| = 10| 1| std::env::args().len() @@ -16,8 +16,8 @@ 16| 1| countdown 17| 1| = 18| 1| 0 - 19| | ; - 20| | if + 19| 1| ; + 20| 1| if 21| 1| is_true 22| 1| { 23| 1| countdown diff --git a/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_show_coverage.if_else.txt b/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.if_else.txt similarity index 79% rename from src/test/run-make-fulldeps/coverage-reports-deadcode/expected_show_coverage.if_else.txt rename to src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.if_else.txt index 5f899723e2554..4285d31868689 100644 --- a/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_show_coverage.if_else.txt +++ b/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.if_else.txt @@ -1,9 +1,9 @@ - 1| |#![allow(unused_assignments)] + 1| |#![allow(unused_assignments, unused_variables)] 2| | - 3| |fn main() { - 4| | // Initialize test constants in a way that cannot be determined at compile time, to ensure - 5| | // rustc and LLVM cannot optimize out statements (or coverage counters) downstream from - 6| | // dependent conditions. + 3| 1|fn main() { + 4| 1| // Initialize test constants in a way that cannot be determined at compile time, to ensure + 5| 1| // rustc and LLVM cannot optimize out statements (or coverage counters) downstream from + 6| 1| // dependent conditions. 7| 1| let is_true = std::env::args().len() == 1; 8| 1| 9| 1| let mut countdown = 0; diff --git a/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_show_coverage.inner_items.txt b/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.inner_items.txt similarity index 90% rename from src/test/run-make-fulldeps/coverage-reports-deadcode/expected_show_coverage.inner_items.txt rename to src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.inner_items.txt index 4a51f842a4bb2..f5b5184044f65 100644 --- a/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_show_coverage.inner_items.txt +++ b/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.inner_items.txt @@ -1,6 +1,6 @@ - 1| |#![allow(unused_assignments, unused_variables)] + 1| |#![allow(unused_assignments, unused_variables, dead_code)] 2| | - 3| |fn main() { + 3| 1|fn main() { 4| | // Initialize test constants in a way that cannot be determined at compile time, to ensure 5| | // rustc and LLVM cannot optimize out statements (or coverage counters) downstream from 6| | // dependent conditions. @@ -16,7 +16,7 @@ 15| | const IN_MOD_CONST: u32 = 1000; 16| | } 17| | - 18| | fn in_func(a: u32) { + 18| 3| fn in_func(a: u32) { 19| 3| let b = 1; 20| 3| let c = a + b; 21| 3| println!("c = {}", c) @@ -38,7 +38,7 @@ 37| | } 38| | 39| | impl InTrait for InStruct { - 40| | fn trait_func(&mut self, incr: u32) { + 40| 1| fn trait_func(&mut self, incr: u32) { 41| 1| self.in_struct_field += incr; 42| 1| in_func(self.in_struct_field); 43| 1| } diff --git a/src/test/run-make-fulldeps/coverage-reports-base/expected_show_coverage.lazy_boolean.txt b/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.lazy_boolean.txt similarity index 86% rename from src/test/run-make-fulldeps/coverage-reports-base/expected_show_coverage.lazy_boolean.txt rename to src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.lazy_boolean.txt index 1b503033911c5..bd349df2fbce2 100644 --- a/src/test/run-make-fulldeps/coverage-reports-base/expected_show_coverage.lazy_boolean.txt +++ b/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.lazy_boolean.txt @@ -1,9 +1,9 @@ 1| |#![allow(unused_assignments, unused_variables)] 2| | - 3| |fn main() { - 4| | // Initialize test constants in a way that cannot be determined at compile time, to ensure - 5| | // rustc and LLVM cannot optimize out statements (or coverage counters) downstream from - 6| | // dependent conditions. + 3| 1|fn main() { + 4| 1| // Initialize test constants in a way that cannot be determined at compile time, to ensure + 5| 1| // rustc and LLVM cannot optimize out statements (or coverage counters) downstream from + 6| 1| // dependent conditions. 7| 1| let is_true = std::env::args().len() == 1; 8| 1| 9| 1| let (mut a, mut b, mut c) = (0, 0, 0); @@ -18,8 +18,7 @@ 17| | = 18| 1| a < b 19| | || - 20| 1| b < c - ^0 + 20| 0| b < c 21| | ; 22| | let 23| 1| somebool diff --git a/src/test/run-make-fulldeps/coverage-reports-base/expected_show_coverage.loop_break_value.txt b/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.loop_break_value.txt similarity index 82% rename from src/test/run-make-fulldeps/coverage-reports-base/expected_show_coverage.loop_break_value.txt rename to src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.loop_break_value.txt index b0d668c6d76da..022fe4c596207 100644 --- a/src/test/run-make-fulldeps/coverage-reports-base/expected_show_coverage.loop_break_value.txt +++ b/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.loop_break_value.txt @@ -1,4 +1,4 @@ - 1| |#![allow(unused_assignments)] + 1| |#![allow(unused_assignments, unused_variables)] 2| | 3| 1|fn main() { 4| 1| let result diff --git a/src/test/run-make-fulldeps/coverage-reports-base/expected_show_coverage.loops_branches.txt b/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.loops_branches.txt similarity index 89% rename from src/test/run-make-fulldeps/coverage-reports-base/expected_show_coverage.loops_branches.txt rename to src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.loops_branches.txt index 3a969a6b89869..474f02b700734 100644 --- a/src/test/run-make-fulldeps/coverage-reports-base/expected_show_coverage.loops_branches.txt +++ b/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.loops_branches.txt @@ -1,4 +1,4 @@ - 1| |#![allow(unused_assignments)] + 1| |#![allow(unused_assignments, unused_variables, while_true)] 2| | 3| |// This test confirms an earlier problem was resolved, supporting the MIR graph generated by the 4| |// structure of this `fmt` function. @@ -6,7 +6,7 @@ 6| |struct DebugTest; 7| | 8| |impl std::fmt::Debug for DebugTest { - 9| | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + 9| 1| fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { 10| 1| if true { 11| 1| if false { 12| | while true { @@ -15,7 +15,7 @@ 15| 1| write!(f, "error")?; ^0 16| | } else { - 17| 1| } + 17| | } 18| 1| Ok(()) 19| 1| } 20| |} diff --git a/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_show_coverage.nested_loops.txt b/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.nested_loops.txt similarity index 84% rename from src/test/run-make-fulldeps/coverage-reports-deadcode/expected_show_coverage.nested_loops.txt rename to src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.nested_loops.txt index c9f373bf6a7c0..0dbd6bcf313e0 100644 --- a/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_show_coverage.nested_loops.txt +++ b/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.nested_loops.txt @@ -1,4 +1,4 @@ - 1| |fn main() { + 1| 1|fn main() { 2| 1| let is_true = std::env::args().len() == 1; 3| 1| let mut countdown = 10; 4| | @@ -8,19 +8,19 @@ 8| 3| for _ in 0..50 { 9| 3| if a < 30 { 10| 0| break; - 11| | } + 11| 3| } 12| 3| a -= 5; 13| 3| b -= 5; 14| 3| if b < 90 { 15| 1| a -= 10; 16| 1| if is_true { 17| 1| break 'outer; - 18| | } else { + 18| 0| } else { 19| 0| a -= 2; 20| 0| } 21| 2| } - 22| 2| } + 22| | } 23| 0| countdown -= 1; - 24| 0| } + 24| | } 25| 1|} diff --git a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.overflow.txt b/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.overflow.txt new file mode 100644 index 0000000000000..4dccb3413eae9 --- /dev/null +++ b/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.overflow.txt @@ -0,0 +1,64 @@ + 1| |#![allow(unused_assignments)] + 2| |// expect-exit-status-101 + 3| | + 4| 4|fn might_overflow(to_add: u32) -> u32 { + 5| 4| if to_add > 5 { + 6| 1| println!("this will probably overflow"); + 7| 3| } + 8| 4| let add_to = u32::MAX - 5; + 9| 4| println!("does {} + {} overflow?", add_to, to_add); + 10| 4| let result = to_add + add_to; + 11| 4| println!("continuing after overflow check"); + 12| 4| result + 13| 4|} + 14| | + 15| 1|fn main() -> Result<(),u8> { + 16| 1| let mut countdown = 10; + 17| 10| while countdown > 0 { + 18| 10| if countdown == 1 { + 19| 0| let result = might_overflow(10); + 20| 0| println!("Result: {}", result); + 21| 10| } else if countdown < 5 { + 22| 3| let result = might_overflow(1); + 23| 3| println!("Result: {}", result); + 24| 6| } + 25| 9| countdown -= 1; + 26| | } + 27| 0| Ok(()) + 28| 0|} + 29| | + 30| |// Notes: + 31| |// 1. Compare this program and its coverage results to those of the very similar test `assert.rs`, + 32| |// and similar tests `panic_unwind.rs`, abort.rs` and `try_error_result.rs`. + 33| |// 2. This test confirms the coverage generated when a program passes or fails a + 34| |// compiler-generated `TerminatorKind::Assert` (based on an overflow check, in this case). + 35| |// 3. Similar to how the coverage instrumentation handles `TerminatorKind::Call`, + 36| |// compiler-generated assertion failures are assumed to be a symptom of a program bug, not + 37| |// expected behavior. To simplify the coverage graphs and keep instrumented programs as + 38| |// small and fast as possible, `Assert` terminators are assumed to always succeed, and + 39| |// therefore are considered "non-branching" terminators. So, an `Assert` terminator does not + 40| |// get its own coverage counter. + 41| |// 4. After an unhandled panic or failed Assert, coverage results may not always be intuitive. + 42| |// In this test, the final count for the statements after the `if` block in `might_overflow()` + 43| |// is 4, even though the lines after `to_add + add_to` were executed only 3 times. Depending + 44| |// on the MIR graph and the structure of the code, this count could have been 3 (which might + 45| |// have been valid for the overflowed add `+`, but should have been 4 for the lines before + 46| |// the overflow. The reason for this potential uncertainty is, a `CounterKind` is incremented + 47| |// via StatementKind::Counter at the end of the block, but (as in the case in this test), + 48| |// a CounterKind::Expression is always evaluated. In this case, the expression was based on + 49| |// a `Counter` incremented as part of the evaluation of the `if` expression, which was + 50| |// executed, and counted, 4 times, before reaching the overflow add. + 51| | + 52| |// If the program did not overflow, the coverage for `might_overflow()` would look like this: + 53| |// + 54| |// 4| |fn might_overflow(to_add: u32) -> u32 { + 55| |// 5| 4| if to_add > 5 { + 56| |// 6| 0| println!("this will probably overflow"); + 57| |// 7| 4| } + 58| |// 8| 4| let add_to = u32::MAX - 5; + 59| |// 9| 4| println!("does {} + {} overflow?", add_to, to_add); + 60| |// 10| 4| let result = to_add + add_to; + 61| |// 11| 4| println!("continuing after overflow check"); + 62| |// 12| 4| result + 63| |// 13| 4|} + diff --git a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.panic_unwind.txt b/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.panic_unwind.txt new file mode 100644 index 0000000000000..9ae78fee4b5e1 --- /dev/null +++ b/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.panic_unwind.txt @@ -0,0 +1,50 @@ + 1| |#![allow(unused_assignments)] + 2| |// expect-exit-status-101 + 3| | + 4| 4|fn might_panic(should_panic: bool) { + 5| 4| if should_panic { + 6| 1| println!("panicking..."); + 7| 1| panic!("panics"); + 8| 3| } else { + 9| 3| println!("Don't Panic"); + 10| 3| } + 11| 3|} + 12| | + 13| 1|fn main() -> Result<(), u8> { + 14| 1| let mut countdown = 10; + 15| 10| while countdown > 0 { + 16| 10| if countdown == 1 { + 17| 0| might_panic(true); + 18| 10| } else if countdown < 5 { + 19| 3| might_panic(false); + 20| 6| } + 21| 9| countdown -= 1; + 22| | } + 23| 0| Ok(()) + 24| 0|} + 25| | + 26| |// Notes: + 27| |// 1. Compare this program and its coverage results to those of the similar tests `abort.rs` and + 28| |// `try_error_result.rs`. + 29| |// 2. Since the `panic_unwind.rs` test is allowed to unwind, it is also allowed to execute the + 30| |// normal program exit cleanup, including writing out the current values of the coverage + 31| |// counters. + 32| |// 3. The coverage results show (interestingly) that the `panic!()` call did execute, but it does + 33| |// not show coverage of the `if countdown == 1` branch in `main()` that calls + 34| |// `might_panic(true)` (causing the call to `panic!()`). + 35| |// 4. The reason `main()`s `if countdown == 1` branch, calling `might_panic(true)`, appears + 36| |// "uncovered" is, InstrumentCoverage (intentionally) treats `TerminatorKind::Call` terminators + 37| |// as non-branching, because when a program executes normally, they always are. Errors handled + 38| |// via the try `?` operator produce error handling branches that *are* treated as branches in + 39| |// coverage results. By treating calls without try `?` operators as non-branching (assumed to + 40| |// return normally and continue) the coverage graph can be simplified, producing smaller, + 41| |// faster binaries, and cleaner coverage results. + 42| |// 5. The reason the coverage results actually show `panic!()` was called is most likely because + 43| |// `panic!()` is a macro, not a simple function call, and there are other `Statement`s and/or + 44| |// `Terminator`s that execute with a coverage counter before the panic and unwind occur. + 45| |// 6. Since the common practice is not to use `panic!()` for error handling, the coverage + 46| |// implementation avoids incurring an additional cost (in program size and execution time) to + 47| |// improve coverage results for an event that is generally not "supposed" to happen. + 48| |// 7. FIXME(#78544): This issue describes a feature request for a proposed option to enable + 49| |// more accurate coverage results for tests that intentionally panic. + diff --git a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.partial_eq.txt b/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.partial_eq.txt new file mode 100644 index 0000000000000..0fe124f12d906 --- /dev/null +++ b/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.partial_eq.txt @@ -0,0 +1,63 @@ + 1| |// This test confirms an earlier problem was resolved, supporting the MIR graph generated by the + 2| |// structure of this test. + 3| | + 4| 2|#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)] + ^0 ^0 ^0 ^0 ^1 ^0 ^0^0 + 5| |pub struct Version { + 6| | major: usize, + 7| 1| minor: usize, // Count: 1 - `PartialOrd` compared `minor` values in 3.2.1 vs. 3.3.0 + 8| 0| patch: usize, // Count: 0 - `PartialOrd` was determined by `minor` (2 < 3) + 9| |} + 10| | + 11| |impl Version { + 12| 2| pub fn new(major: usize, minor: usize, patch: usize) -> Self { + 13| 2| Self { + 14| 2| major, + 15| 2| minor, + 16| 2| patch, + 17| 2| } + 18| 2| } + 19| |} + 20| | + 21| 1|fn main() { + 22| 1| let version_3_2_1 = Version::new(3, 2, 1); + 23| 1| let version_3_3_0 = Version::new(3, 3, 0); + 24| 1| + 25| 1| println!("{:?} < {:?} = {}", version_3_2_1, version_3_3_0, version_3_2_1 < version_3_3_0); + 26| 1|} + 27| | + 28| |/* + 29| | + 30| |This test verifies a bug was fixed that otherwise generated this error: + 31| | + 32| |thread 'rustc' panicked at 'No counters provided the source_hash for function: + 33| | Instance { + 34| | def: Item(WithOptConstParam { + 35| | did: DefId(0:101 ~ autocfg[c44a]::version::{impl#2}::partial_cmp), + 36| | const_param_did: None + 37| | }), + 38| | substs: [] + 39| | }' + 40| |The `PartialOrd` derived by `Version` happened to generate a MIR that generated coverage + 41| |without a code region associated with any `Counter`. Code regions were associated with at least + 42| |one expression, which is allowed, but the `function_source_hash` was only passed to the codegen + 43| |(coverage mapgen) phase from a `Counter`s code region. A new method was added to pass the + 44| |`function_source_hash` without a code region, if necessary. + 45| | + 46| |*/ + 47| | + 48| |// FIXME(#79626): The derived traits get coverage, which is great, but some of the traits appear + 49| |// to get two coverage execution counts at different positions: + 50| |// + 51| |// ```text + 52| |// 4| 2|#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)] + 53| |// ^0 ^0 ^0 ^0 ^1 ^0 ^0^0 + 54| |// ```text + 55| |// + 56| |// `PartialEq`, `PartialOrd`, and `Ord` (and possibly `Eq`, if the trait name was longer than 2 + 57| |// characters) have counts at their first and last characters. + 58| |// + 59| |// Why is this? Why does `PartialOrd` have two values (1 and 0)? This must mean we are checking + 60| |// distinct coverages, so maybe we don't want to eliminate one of them. Should we merge them? + 61| |// If merged, do we lose some information? + diff --git a/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_show_coverage.simple_loop.txt b/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.simple_loop.txt similarity index 75% rename from src/test/run-make-fulldeps/coverage-reports-deadcode/expected_show_coverage.simple_loop.txt rename to src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.simple_loop.txt index 064930dd75c93..feb83bad674d0 100644 --- a/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_show_coverage.simple_loop.txt +++ b/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.simple_loop.txt @@ -1,14 +1,14 @@ 1| |#![allow(unused_assignments)] 2| | - 3| |fn main() { - 4| | // Initialize test constants in a way that cannot be determined at compile time, to ensure - 5| | // rustc and LLVM cannot optimize out statements (or coverage counters) downstream from - 6| | // dependent conditions. + 3| 1|fn main() { + 4| 1| // Initialize test constants in a way that cannot be determined at compile time, to ensure + 5| 1| // rustc and LLVM cannot optimize out statements (or coverage counters) downstream from + 6| 1| // dependent conditions. 7| 1| let is_true = std::env::args().len() == 1; 8| 1| 9| 1| let mut countdown = 0; - 10| | - 11| | if + 10| 1| + 11| 1| if 12| 1| is_true 13| 1| { 14| 1| countdown @@ -27,11 +27,11 @@ 26| | { 27| 1| break 28| | ; - 29| | } + 29| 10| } 30| 10| countdown 31| 10| -= 32| 10| 1 33| | ; - 34| 1| } + 34| | } 35| 1|} diff --git a/src/test/run-make-fulldeps/coverage-reports-base/expected_show_coverage.simple_match.txt b/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.simple_match.txt similarity index 80% rename from src/test/run-make-fulldeps/coverage-reports-base/expected_show_coverage.simple_match.txt rename to src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.simple_match.txt index 1f7e71d3eb0e7..81b4c090a46c0 100644 --- a/src/test/run-make-fulldeps/coverage-reports-base/expected_show_coverage.simple_match.txt +++ b/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.simple_match.txt @@ -1,9 +1,9 @@ - 1| |#![allow(unused_assignments)] + 1| |#![allow(unused_assignments, unused_variables)] 2| | - 3| |fn main() { - 4| | // Initialize test constants in a way that cannot be determined at compile time, to ensure - 5| | // rustc and LLVM cannot optimize out statements (or coverage counters) downstream from - 6| | // dependent conditions. + 3| 1|fn main() { + 4| 1| // Initialize test constants in a way that cannot be determined at compile time, to ensure + 5| 1| // rustc and LLVM cannot optimize out statements (or coverage counters) downstream from + 6| 1| // dependent conditions. 7| 1| let is_true = std::env::args().len() == 1; 8| 1| 9| 1| let mut countdown = 1; @@ -27,7 +27,6 @@ 26| 2| x 27| 2| < 28| 2| 1 - ^1 29| | => 30| 1| { 31| 1| z = countdown @@ -41,6 +40,6 @@ 39| | => 40| 1| {} 41| | } - 42| 3| } + 42| | } 43| 1|} diff --git a/src/test/run-make-fulldeps/coverage-reports-base/expected_show_coverage.tight_inf_loop.txt b/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.tight_inf_loop.txt similarity index 62% rename from src/test/run-make-fulldeps/coverage-reports-base/expected_show_coverage.tight_inf_loop.txt rename to src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.tight_inf_loop.txt index e02eac03a6b15..5adeef7d0850b 100644 --- a/src/test/run-make-fulldeps/coverage-reports-base/expected_show_coverage.tight_inf_loop.txt +++ b/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.tight_inf_loop.txt @@ -1,6 +1,6 @@ - 1| |fn main() { + 1| 1|fn main() { 2| 1| if false { 3| | loop {} - 4| | } + 4| 1| } 5| 1|} diff --git a/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_show_coverage.try_error_result.txt b/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.try_error_result.txt similarity index 87% rename from src/test/run-make-fulldeps/coverage-reports-deadcode/expected_show_coverage.try_error_result.txt rename to src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.try_error_result.txt index 6b3a8c39c6338..c9ebffde039d8 100644 --- a/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_show_coverage.try_error_result.txt +++ b/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.try_error_result.txt @@ -1,7 +1,7 @@ 1| |#![allow(unused_assignments)] 2| |// expect-exit-status-1 3| | - 4| |fn call(return_error: bool) -> Result<(),()> { + 4| 6|fn call(return_error: bool) -> Result<(),()> { 5| 6| if return_error { 6| 1| Err(()) 7| | } else { @@ -9,7 +9,7 @@ 9| | } 10| 6|} 11| | - 12| |fn main() -> Result<(),()> { + 12| 1|fn main() -> Result<(),()> { 13| 1| let mut 14| 1| countdown = 10 15| | ; @@ -31,8 +31,8 @@ 31| | { 32| 5| call(/*return_error=*/ false)?; ^0 - 33| 5| } - 34| 5| } + 33| | } + 34| | } 35| 0| Ok(()) 36| 1|} diff --git a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.uses_crate.txt b/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.uses_crate.txt new file mode 100644 index 0000000000000..e14e733fff6d4 --- /dev/null +++ b/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.uses_crate.txt @@ -0,0 +1,142 @@ + 1| |#![allow(unused_assignments, unused_variables)] + 2| | + 3| |use std::fmt::Debug; + 4| | + 5| 1|pub fn used_function() { + 6| | // Initialize test constants in a way that cannot be determined at compile time, to ensure + 7| | // rustc and LLVM cannot optimize out statements (or coverage counters) downstream from + 8| | // dependent conditions. + 9| 1| let is_true = std::env::args().len() == 1; + 10| 1| let mut countdown = 0; + 11| 1| if is_true { + 12| 1| countdown = 10; + 13| 1| } + ^0 + 14| 1| use_this_lib_crate(); + 15| 1|} + 16| | + 17| 2|pub fn used_only_from_bin_crate_generic_function(arg: T) { + 18| 2| println!("used_only_from_bin_crate_generic_function with {:?}", arg); + 19| 2|} + ------------------ + | used_crate::used_only_from_bin_crate_generic_function::<&str>: + | 17| 1|pub fn used_only_from_bin_crate_generic_function(arg: T) { + | 18| 1| println!("used_only_from_bin_crate_generic_function with {:?}", arg); + | 19| 1|} + ------------------ + | used_crate::used_only_from_bin_crate_generic_function::<&alloc::vec::Vec>: + | 17| 1|pub fn used_only_from_bin_crate_generic_function(arg: T) { + | 18| 1| println!("used_only_from_bin_crate_generic_function with {:?}", arg); + | 19| 1|} + ------------------ + 20| | + 21| 2|pub fn used_only_from_this_lib_crate_generic_function(arg: T) { + 22| 2| println!("used_only_from_this_lib_crate_generic_function with {:?}", arg); + 23| 2|} + ------------------ + | used_crate::used_only_from_this_lib_crate_generic_function::>: + | 21| 1|pub fn used_only_from_this_lib_crate_generic_function(arg: T) { + | 22| 1| println!("used_only_from_this_lib_crate_generic_function with {:?}", arg); + | 23| 1|} + ------------------ + | used_crate::used_only_from_this_lib_crate_generic_function::<&str>: + | 21| 1|pub fn used_only_from_this_lib_crate_generic_function(arg: T) { + | 22| 1| println!("used_only_from_this_lib_crate_generic_function with {:?}", arg); + | 23| 1|} + ------------------ + 24| | + 25| 2|pub fn used_from_bin_crate_and_lib_crate_generic_function(arg: T) { + 26| 2| println!("used_from_bin_crate_and_lib_crate_generic_function with {:?}", arg); + 27| 2|} + ------------------ + | used_crate::used_from_bin_crate_and_lib_crate_generic_function::>: + | 25| 1|pub fn used_from_bin_crate_and_lib_crate_generic_function(arg: T) { + | 26| 1| println!("used_from_bin_crate_and_lib_crate_generic_function with {:?}", arg); + | 27| 1|} + ------------------ + | used_crate::used_from_bin_crate_and_lib_crate_generic_function::<&str>: + | 25| 1|pub fn used_from_bin_crate_and_lib_crate_generic_function(arg: T) { + | 26| 1| println!("used_from_bin_crate_and_lib_crate_generic_function with {:?}", arg); + | 27| 1|} + ------------------ + 28| | + 29| 2|pub fn used_with_same_type_from_bin_crate_and_lib_crate_generic_function(arg: T) { + 30| 2| println!("used_with_same_type_from_bin_crate_and_lib_crate_generic_function with {:?}", arg); + 31| 2|} + 32| | + 33| 0|pub fn unused_generic_function(arg: T) { + 34| 0| println!("unused_generic_function with {:?}", arg); + 35| 0|} + 36| | + 37| 0|pub fn unused_function() { + 38| 0| let is_true = std::env::args().len() == 1; + 39| 0| let mut countdown = 2; + 40| 0| if !is_true { + 41| 0| countdown = 20; + 42| 0| } + 43| 0|} + 44| | + 45| 0|fn unused_private_function() { + 46| 0| let is_true = std::env::args().len() == 1; + 47| 0| let mut countdown = 2; + 48| 0| if !is_true { + 49| 0| countdown = 20; + 50| 0| } + 51| 0|} + 52| | + 53| 1|fn use_this_lib_crate() { + 54| 1| used_from_bin_crate_and_lib_crate_generic_function("used from library used_crate.rs"); + 55| 1| used_with_same_type_from_bin_crate_and_lib_crate_generic_function( + 56| 1| "used from library used_crate.rs", + 57| 1| ); + 58| 1| let some_vec = vec![5, 6, 7, 8]; + 59| 1| used_only_from_this_lib_crate_generic_function(some_vec); + 60| 1| used_only_from_this_lib_crate_generic_function("used ONLY from library used_crate.rs"); + 61| 1|} + ------------------ + | Unexecuted instantiation: used_crate::use_this_lib_crate + ------------------ + 62| | + 63| |// FIXME(#79651): `used_from_bin_crate_and_lib_crate_generic_function()` is covered and executed + 64| |// `2` times, but the coverage output also shows (at the bottom of the coverage report): + 65| |// ------------------ + 66| |// | Unexecuted instantiation: + 67| |// ------------------ + 68| |// + 69| |// Note, the function name shown in the error seems to change depending on the structure of the + 70| |// code, for some reason, including: + 71| |// + 72| |// * used_crate::used_from_bin_crate_and_lib_crate_generic_function::<&str> + 73| |// * used_crate::use_this_lib_crate + 74| |// + 75| |// The `Unexecuted instantiation` error may be related to more than one generic function. Since the + 76| |// reporting is not consistent, it may not be obvious if there are multiple problems here; however, + 77| |// `used_crate::used_from_bin_crate_and_lib_crate_generic_function::<&str>` (which I have seen + 78| |// with this error) is the only generic function missing instantiaion coverage counts. + 79| |// + 80| |// The `&str` variant was called from within this `lib` crate, and the `bin` crate also calls this + 81| |// function, but with `T` type `&Vec`. + 82| |// + 83| |// I believe the reason is that one or both crates are generating `Zero` counters for what it + 84| |// believes are "Unreachable" instantiations, but those instantiations are counted from the + 85| |// coverage map in the other crate. + 86| |// + 87| |// See `add_unreachable_coverage()` in `mapgen.rs` for more on how these `Zero` counters are added + 88| |// for what the funciton believes are `DefId`s that did not get codegenned. I suspect the issue + 89| |// may be related to this process, but this needs to be confirmed. It may not be possible to know + 90| |// for sure if a function is truly unused and should be reported with `Zero` coverage if it may + 91| |// still get used from an external crate. (Something to look at: If the `DefId` in MIR corresponds + 92| |// _only_ to the generic function without type parameters, is the `DefId` in the codegenned set, + 93| |// instantiated with one of the type parameters (in either or both crates) a *different* `DefId`? + 94| |// If so, `add_unreachable_coverage()` would assume the MIR `DefId` was uncovered, and would add + 95| |// unreachable coverage. + 96| |// + 97| |// I didn't think they could be different, but if they can, we would need to find the `DefId` for + 98| |// the generic function MIR and include it in the set of "codegenned" DefIds if any instantiation + 99| |// of that generic function does exist. + 100| |// + 101| |// Note, however, for `used_with_same_type_from_bin_crate_and_lib_crate_generic_function()` both + 102| |// crates use this function with the same type variant. The function does not have multiple + 103| |// instantiations, so the coverage analysis is not confused. No "Unexecuted instantiations" errors + 104| |// are reported. + diff --git a/src/test/run-make-fulldeps/coverage-reports-base/expected_show_coverage.while.txt b/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.while.txt similarity index 80% rename from src/test/run-make-fulldeps/coverage-reports-base/expected_show_coverage.while.txt rename to src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.while.txt index 194325b6b9eca..efa7d083f0c6f 100644 --- a/src/test/run-make-fulldeps/coverage-reports-base/expected_show_coverage.while.txt +++ b/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.while.txt @@ -1,4 +1,4 @@ - 1| |fn main() { + 1| 1|fn main() { 2| 1| let num = 9; 3| 1| while num >= 10 { 4| 0| } diff --git a/src/test/run-make-fulldeps/coverage-reports-base/expected_show_coverage.while_early_ret.txt b/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.while_early_ret.txt similarity index 77% rename from src/test/run-make-fulldeps/coverage-reports-base/expected_show_coverage.while_early_ret.txt rename to src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.while_early_ret.txt index 26041136d2f4c..d19afc0de61d3 100644 --- a/src/test/run-make-fulldeps/coverage-reports-base/expected_show_coverage.while_early_ret.txt +++ b/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.while_early_ret.txt @@ -1,7 +1,7 @@ 1| |#![allow(unused_assignments)] 2| |// expect-exit-status-1 3| | - 4| |fn main() -> Result<(),u8> { + 4| 1|fn main() -> Result<(),u8> { 5| 1| let mut countdown = 10; 6| | while 7| 7| countdown @@ -26,7 +26,7 @@ 26| 1| Err(1) 27| | } 28| | ; - 29| | } + 29| 6| } 30| 6| countdown 31| 6| -= 32| 6| 1 @@ -40,9 +40,4 @@ 40| |// and MacOS. But on Windows (MSVC, at least), the call to `std::process::exit()` exits the program 41| |// without saving the InstrProf coverage counters. The use of `std::process:exit()` is not critical 42| |// to the coverage test for early returns, but this is a limitation that should be fixed. - 43| |// - 44| |// FIXME(richkadel): Consider creating a new tests for coverage when calling `std::process::exit()`, - 45| |// move the `ISSUE` comment to that test, and implement a new test directive that supports skipping - 46| |// coverage tests when targeting specific platforms (at least skipping Windows, or MSVC if the - 47| |// problem exists on MSVC only). diff --git a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.yield.txt b/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.yield.txt new file mode 100644 index 0000000000000..6e2f23ee77b8d --- /dev/null +++ b/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.yield.txt @@ -0,0 +1,38 @@ + 1| |#![feature(generators, generator_trait)] + 2| |#![allow(unused_assignments)] + 3| | + 4| |use std::ops::{Generator, GeneratorState}; + 5| |use std::pin::Pin; + 6| | + 7| 1|fn main() { + 8| 1| let mut generator = || { + 9| 1| yield 1; + 10| 1| return "foo" + 11| 1| }; + 12| | + 13| 1| match Pin::new(&mut generator).resume(()) { + 14| 1| GeneratorState::Yielded(1) => {} + 15| 0| _ => panic!("unexpected value from resume"), + 16| | } + 17| 1| match Pin::new(&mut generator).resume(()) { + 18| 1| GeneratorState::Complete("foo") => {} + 19| 0| _ => panic!("unexpected value from resume"), + 20| | } + 21| | + 22| 1| let mut generator = || { + 23| 1| yield 1; + 24| 1| yield 2; + 25| 0| yield 3; + 26| 0| return "foo" + 27| 0| }; + 28| | + 29| 1| match Pin::new(&mut generator).resume(()) { + 30| 1| GeneratorState::Yielded(1) => {} + 31| 0| _ => panic!("unexpected value from resume"), + 32| | } + 33| 1| match Pin::new(&mut generator).resume(()) { + 34| 1| GeneratorState::Yielded(2) => {} + 35| 0| _ => panic!("unexpected value from resume"), + 36| | } + 37| 1|} + diff --git a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage_counters.abort.txt b/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage_counters.abort.txt new file mode 100644 index 0000000000000..cbf7462eba5e6 --- /dev/null +++ b/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage_counters.abort.txt @@ -0,0 +1,67 @@ +Counter in file 0 14:1 -> 15:27, #1 +Counter in file 0 16:11 -> 16:24, (#1 + (#2 + #3)) +Counter in file 0 17:12 -> 17:25, ((#1 + (#2 + #3)) - #4) +Counter in file 0 17:26 -> 19:10, #5 +Counter in file 0 19:10 -> 19:11, (((#1 + (#2 + #3)) - #4) - #5) +Counter in file 0 21:12 -> 21:25, (#5 + (((#1 + (#2 + #3)) - #4) - #5)) +Counter in file 0 21:26 -> 21:49, #6 +Counter in file 0 21:49 -> 21:50, ((#5 + (((#1 + (#2 + #3)) - #4) - #5)) - #6) +Counter in file 0 25:12 -> 25:25, (#6 + ((#5 + (((#1 + (#2 + #3)) - #4) - #5)) - #6)) +Counter in file 0 25:26 -> 25:49, #2 +Counter in file 0 25:49 -> 25:50, #3 +Counter in file 0 26:9 -> 26:23, (#2 + #3) +Counter in file 0 28:5 -> 29:2, #4 +Counter in file 0 5:1 -> 5:36, #1 +Counter in file 0 6:8 -> 6:20, (#1 + 0) +Counter in file 0 7:9 -> 8:37, #2 +Counter in file 0 9:12 -> 12:2, (#1 - #2) +Emitting segments for file: ../coverage/abort.rs +Combined regions: + 5:1 -> 5:36 (count=12) + 6:8 -> 6:20 (count=12) + 7:9 -> 8:37 (count=0) + 9:12 -> 12:2 (count=12) + 14:1 -> 15:27 (count=1) + 16:11 -> 16:24 (count=11) + 17:12 -> 17:25 (count=10) + 17:26 -> 19:10 (count=4) + 19:10 -> 19:11 (count=6) + 21:12 -> 21:25 (count=10) + 21:26 -> 21:49 (count=4) + 21:49 -> 21:50 (count=6) + 25:12 -> 25:25 (count=10) + 25:26 -> 25:49 (count=4) + 25:49 -> 25:50 (count=6) + 26:9 -> 26:23 (count=10) + 28:5 -> 29:2 (count=1) +Segment at 5:1 (count = 12), RegionEntry +Segment at 5:36 (count = 0), Skipped +Segment at 6:8 (count = 12), RegionEntry +Segment at 6:20 (count = 0), Skipped +Segment at 7:9 (count = 0), RegionEntry +Segment at 8:37 (count = 0), Skipped +Segment at 9:12 (count = 12), RegionEntry +Segment at 12:2 (count = 0), Skipped +Segment at 14:1 (count = 1), RegionEntry +Segment at 15:27 (count = 0), Skipped +Segment at 16:11 (count = 11), RegionEntry +Segment at 16:24 (count = 0), Skipped +Segment at 17:12 (count = 10), RegionEntry +Segment at 17:25 (count = 0), Skipped +Segment at 17:26 (count = 4), RegionEntry +Segment at 19:10 (count = 6), RegionEntry +Segment at 19:11 (count = 0), Skipped +Segment at 21:12 (count = 10), RegionEntry +Segment at 21:25 (count = 0), Skipped +Segment at 21:26 (count = 4), RegionEntry +Segment at 21:49 (count = 6), RegionEntry +Segment at 21:50 (count = 0), Skipped +Segment at 25:12 (count = 10), RegionEntry +Segment at 25:25 (count = 0), Skipped +Segment at 25:26 (count = 4), RegionEntry +Segment at 25:49 (count = 6), RegionEntry +Segment at 25:50 (count = 0), Skipped +Segment at 26:9 (count = 10), RegionEntry +Segment at 26:23 (count = 0), Skipped +Segment at 28:5 (count = 1), RegionEntry +Segment at 29:2 (count = 0), Skipped diff --git a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage_counters.assert.txt b/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage_counters.assert.txt new file mode 100644 index 0000000000000..916ebbbcc29d3 --- /dev/null +++ b/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage_counters.assert.txt @@ -0,0 +1,57 @@ +Counter in file 0 9:1 -> 10:27, #1 +Counter in file 0 11:11 -> 11:24, (#1 + (#2 + (#3 + #4))) +Counter in file 0 12:12 -> 12:26, ((#1 + (#2 + (#3 + #4))) - #5) +Counter in file 0 12:27 -> 14:10, #2 +Counter in file 0 14:19 -> 14:32, (((#1 + (#2 + (#3 + #4))) - #5) - #2) +Counter in file 0 14:33 -> 16:10, #3 +Counter in file 0 16:10 -> 16:11, #4 +Counter in file 0 17:9 -> 17:23, (#2 + (#3 + #4)) +Counter in file 0 19:5 -> 20:2, #5 +Counter in file 0 4:1 -> 4:41, #1 +Counter in file 0 5:5 -> 5:48, (#1 + 0) +Counter in file 0 6:16 -> 6:21, (#1 + 0) +Counter in file 0 6:37 -> 6:61, #2 +Counter in file 0 7:1 -> 7:2, (#1 - #2) +Emitting segments for file: ../coverage/assert.rs +Combined regions: + 4:1 -> 4:41 (count=4) + 5:5 -> 5:48 (count=4) + 6:16 -> 6:21 (count=4) + 6:37 -> 6:61 (count=1) + 7:1 -> 7:2 (count=3) + 9:1 -> 10:27 (count=1) + 11:11 -> 11:24 (count=10) + 12:12 -> 12:26 (count=10) + 12:27 -> 14:10 (count=0) + 14:19 -> 14:32 (count=10) + 14:33 -> 16:10 (count=3) + 16:10 -> 16:11 (count=6) + 17:9 -> 17:23 (count=9) + 19:5 -> 20:2 (count=0) +Segment at 4:1 (count = 4), RegionEntry +Segment at 4:41 (count = 0), Skipped +Segment at 5:5 (count = 4), RegionEntry +Segment at 5:48 (count = 0), Skipped +Segment at 6:16 (count = 4), RegionEntry +Segment at 6:21 (count = 0), Skipped +Segment at 6:37 (count = 1), RegionEntry +Segment at 6:61 (count = 0), Skipped +Segment at 7:1 (count = 3), RegionEntry +Segment at 7:2 (count = 0), Skipped +Segment at 9:1 (count = 1), RegionEntry +Segment at 10:27 (count = 0), Skipped +Segment at 11:11 (count = 10), RegionEntry +Segment at 11:24 (count = 0), Skipped +Segment at 12:12 (count = 10), RegionEntry +Segment at 12:26 (count = 0), Skipped +Segment at 12:27 (count = 0), RegionEntry +Segment at 14:10 (count = 0), Skipped +Segment at 14:19 (count = 10), RegionEntry +Segment at 14:32 (count = 0), Skipped +Segment at 14:33 (count = 3), RegionEntry +Segment at 16:10 (count = 6), RegionEntry +Segment at 16:11 (count = 0), Skipped +Segment at 17:9 (count = 9), RegionEntry +Segment at 17:23 (count = 0), Skipped +Segment at 19:5 (count = 0), RegionEntry +Segment at 20:2 (count = 0), Skipped diff --git a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage_counters.async.txt b/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage_counters.async.txt new file mode 100644 index 0000000000000..82a4457b6ef1e --- /dev/null +++ b/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage_counters.async.txt @@ -0,0 +1,311 @@ +Counter in file 0 13:1 -> 13:20, #1 +Counter in file 0 15:1 -> 15:20, 0 +Counter in file 0 15:20 -> 15:21, 0 +Counter in file 0 19:1 -> 19:30, 0 +Counter in file 0 19:30 -> 19:31, 0 +Counter in file 0 21:23 -> 22:12, 0 +Counter in file 0 23:9 -> 23:10, 0 +Counter in file 0 23:14 -> 23:17, 0 +Counter in file 0 23:27 -> 23:28, 0 +Counter in file 0 23:32 -> 23:34, 0 +Counter in file 0 24:9 -> 24:10, 0 +Counter in file 0 24:14 -> 24:17, 0 +Counter in file 0 24:27 -> 24:28, 0 +Counter in file 0 24:32 -> 24:34, 0 +Counter in file 0 25:14 -> 25:16, 0 +Counter in file 0 27:1 -> 27:2, 0 +Counter in file 0 29:22 -> 32:12, 0 +Counter in file 0 33:9 -> 33:10, 0 +Counter in file 0 33:14 -> 33:19, 0 +Counter in file 0 33:26 -> 33:27, 0 +Counter in file 0 33:32 -> 33:34, 0 +Counter in file 0 34:14 -> 34:16, 0 +Counter in file 0 36:1 -> 36:2, 0 +Counter in file 0 75:1 -> 76:12, 0 +Counter in file 0 77:14 -> 77:16, 0 +Counter in file 0 78:14 -> 78:16, 0 +Counter in file 0 79:14 -> 79:16, 0 +Counter in file 0 81:1 -> 81:2, 0 +Counter in file 0 91:25 -> 91:34, 0 +Counter in file 0 5:1 -> 5:25, #1 +Counter in file 0 21:1 -> 21:23, #1 +Counter in file 0 17:20 -> 17:21, #1 +Counter in file 0 67:5 -> 67:23, #1 +Counter in file 0 38:1 -> 38:19, #1 +Counter in file 0 13:20 -> 13:21, #1 +Counter in file 0 29:1 -> 29:22, #1 +Counter in file 0 93:1 -> 101:2, #1 +Counter in file 0 91:1 -> 91:25, #1 +Counter in file 0 5:25 -> 6:14, #1 +Counter in file 0 7:9 -> 7:10, #2 +Counter in file 0 9:9 -> 9:10, (#1 - #2) +Counter in file 0 11:1 -> 11:2, (#2 + (#1 - #2)) +Counter in file 0 38:19 -> 42:12, #1 +Counter in file 0 43:9 -> 43:10, #3 +Counter in file 0 43:14 -> 43:18, (#1 + 0) +Counter in file 0 43:28 -> 43:33, #2 +Counter in file 0 43:39 -> 43:42, (#3 + 0) +Counter in file 0 44:9 -> 44:10, #6 +Counter in file 0 44:14 -> 44:17, #4 +Counter in file 0 44:27 -> 44:32, #8 +Counter in file 0 44:36 -> 44:38, (#6 + 0) +Counter in file 0 45:14 -> 45:16, #7 +Counter in file 0 47:1 -> 47:2, (#5 + (#6 + #7)) +Counter in file 0 51:5 -> 52:18, #1 +Counter in file 0 53:13 -> 53:14, #2 +Counter in file 0 63:13 -> 63:14, (#1 - #2) +Counter in file 0 65:5 -> 65:6, (#2 + (#1 - #2)) +Counter in file 0 49:1 -> 68:12, #1 +Counter in file 0 69:9 -> 69:10, #2 +Counter in file 0 69:14 -> 69:27, (#1 + 0) +Counter in file 0 69:31 -> 69:39, (#2 + 0) +Counter in file 0 70:9 -> 70:10, #3 +Counter in file 0 70:14 -> 70:26, #5 +Counter in file 0 70:30 -> 70:32, (#3 + 0) +Counter in file 0 71:14 -> 71:16, #4 +Counter in file 0 73:1 -> 73:2, (#2 + (#3 + #4)) +Counter in file 0 83:1 -> 84:12, #1 +Counter in file 0 85:14 -> 85:16, (#1 - (#3 + #2)) +Counter in file 0 86:14 -> 86:16, #2 +Counter in file 0 87:14 -> 87:16, #3 +Counter in file 0 89:1 -> 89:2, (#3 + (#2 + (#1 - (#3 + #2)))) +Counter in file 0 17:1 -> 17:20, #1 +Counter in file 0 66:5 -> 66:23, #1 +Counter in file 0 17:9 -> 17:10, #1 +Counter in file 0 17:9 -> 17:10, #1 +Counter in file 0 117:17 -> 117:19, #1 +Counter in file 0 17:9 -> 17:10, #1 +Counter in file 0 110:5 -> 120:54, #1 +Counter in file 0 123:32 -> 123:35, ((#1 + #2) - #2) +Counter in file 0 123:39 -> 123:73, (#1 + #2) +Counter in file 0 124:23 -> 124:26, (((#1 + #2) - #2) + 0) +Counter in file 0 125:14 -> 125:15, #2 +Counter in file 0 127:5 -> 127:6, (((#1 + #2) - #2) + 0) +Emitting segments for file: ../coverage/async.rs +Combined regions: + 5:1 -> 5:25 (count=1) + 5:25 -> 6:14 (count=1) + 7:9 -> 7:10 (count=1) + 9:9 -> 9:10 (count=0) + 11:1 -> 11:2 (count=1) + 13:1 -> 13:20 (count=0) + 15:1 -> 15:20 (count=0) + 15:20 -> 15:21 (count=0) + 17:1 -> 17:20 (count=1) + 17:20 -> 17:21 (count=1) + 19:1 -> 19:30 (count=0) + 19:30 -> 19:31 (count=0) + 21:1 -> 21:23 (count=1) + 21:23 -> 22:12 (count=0) + 23:9 -> 23:10 (count=0) + 23:14 -> 23:17 (count=0) + 23:27 -> 23:28 (count=0) + 23:32 -> 23:34 (count=0) + 24:9 -> 24:10 (count=0) + 24:14 -> 24:17 (count=0) + 24:27 -> 24:28 (count=0) + 24:32 -> 24:34 (count=0) + 25:14 -> 25:16 (count=0) + 27:1 -> 27:2 (count=0) + 29:1 -> 29:22 (count=1) + 29:22 -> 32:12 (count=0) + 33:9 -> 33:10 (count=0) + 33:14 -> 33:19 (count=0) + 33:26 -> 33:27 (count=0) + 33:32 -> 33:34 (count=0) + 34:14 -> 34:16 (count=0) + 36:1 -> 36:2 (count=0) + 38:1 -> 38:19 (count=1) + 38:19 -> 42:12 (count=1) + 43:9 -> 43:10 (count=0) + 43:14 -> 43:18 (count=1) + 43:28 -> 43:33 (count=1) + 43:39 -> 43:42 (count=0) + 44:9 -> 44:10 (count=0) + 44:14 -> 44:17 (count=1) + 44:27 -> 44:32 (count=1) + 44:36 -> 44:38 (count=0) + 45:14 -> 45:16 (count=1) + 47:1 -> 47:2 (count=1) + 49:1 -> 68:12 (count=1) + 51:5 -> 52:18 (count=1) + 53:13 -> 53:14 (count=0) + 63:13 -> 63:14 (count=1) + 65:5 -> 65:6 (count=1) + 67:5 -> 67:23 (count=1) + 69:9 -> 69:10 (count=0) + 69:14 -> 69:27 (count=1) + 69:31 -> 69:39 (count=0) + 70:9 -> 70:10 (count=0) + 70:14 -> 70:26 (count=1) + 70:30 -> 70:32 (count=0) + 71:14 -> 71:16 (count=1) + 73:1 -> 73:2 (count=1) + 75:1 -> 76:12 (count=0) + 77:14 -> 77:16 (count=0) + 78:14 -> 78:16 (count=0) + 79:14 -> 79:16 (count=0) + 81:1 -> 81:2 (count=0) + 83:1 -> 84:12 (count=1) + 85:14 -> 85:16 (count=0) + 86:14 -> 86:16 (count=0) + 87:14 -> 87:16 (count=1) + 89:1 -> 89:2 (count=1) + 91:1 -> 91:25 (count=1) + 91:25 -> 91:34 (count=0) + 93:1 -> 101:2 (count=1) + 110:5 -> 120:54 (count=1) + 117:17 -> 117:19 (count=1) + 123:32 -> 123:35 (count=1) + 123:39 -> 123:73 (count=1) + 124:23 -> 124:26 (count=1) + 125:14 -> 125:15 (count=0) + 127:5 -> 127:6 (count=1) +Segment at 5:1 (count = 1), RegionEntry +Segment at 5:25 (count = 1), RegionEntry +Segment at 6:14 (count = 0), Skipped +Segment at 7:9 (count = 1), RegionEntry +Segment at 7:10 (count = 0), Skipped +Segment at 9:9 (count = 0), RegionEntry +Segment at 9:10 (count = 0), Skipped +Segment at 11:1 (count = 1), RegionEntry +Segment at 11:2 (count = 0), Skipped +Segment at 13:1 (count = 0), RegionEntry +Segment at 13:20 (count = 0), Skipped +Segment at 15:1 (count = 0), RegionEntry +Segment at 15:20 (count = 0), RegionEntry +Segment at 15:21 (count = 0), Skipped +Segment at 17:1 (count = 1), RegionEntry +Segment at 17:20 (count = 1), RegionEntry +Segment at 17:21 (count = 0), Skipped +Segment at 19:1 (count = 0), RegionEntry +Segment at 19:30 (count = 0), RegionEntry +Segment at 19:31 (count = 0), Skipped +Segment at 21:1 (count = 1), RegionEntry +Segment at 21:23 (count = 0), RegionEntry +Segment at 22:12 (count = 0), Skipped +Segment at 23:9 (count = 0), RegionEntry +Segment at 23:10 (count = 0), Skipped +Segment at 23:14 (count = 0), RegionEntry +Segment at 23:17 (count = 0), Skipped +Segment at 23:27 (count = 0), RegionEntry +Segment at 23:28 (count = 0), Skipped +Segment at 23:32 (count = 0), RegionEntry +Segment at 23:34 (count = 0), Skipped +Segment at 24:9 (count = 0), RegionEntry +Segment at 24:10 (count = 0), Skipped +Segment at 24:14 (count = 0), RegionEntry +Segment at 24:17 (count = 0), Skipped +Segment at 24:27 (count = 0), RegionEntry +Segment at 24:28 (count = 0), Skipped +Segment at 24:32 (count = 0), RegionEntry +Segment at 24:34 (count = 0), Skipped +Segment at 25:14 (count = 0), RegionEntry +Segment at 25:16 (count = 0), Skipped +Segment at 27:1 (count = 0), RegionEntry +Segment at 27:2 (count = 0), Skipped +Segment at 29:1 (count = 1), RegionEntry +Segment at 29:22 (count = 0), RegionEntry +Segment at 32:12 (count = 0), Skipped +Segment at 33:9 (count = 0), RegionEntry +Segment at 33:10 (count = 0), Skipped +Segment at 33:14 (count = 0), RegionEntry +Segment at 33:19 (count = 0), Skipped +Segment at 33:26 (count = 0), RegionEntry +Segment at 33:27 (count = 0), Skipped +Segment at 33:32 (count = 0), RegionEntry +Segment at 33:34 (count = 0), Skipped +Segment at 34:14 (count = 0), RegionEntry +Segment at 34:16 (count = 0), Skipped +Segment at 36:1 (count = 0), RegionEntry +Segment at 36:2 (count = 0), Skipped +Segment at 38:1 (count = 1), RegionEntry +Segment at 38:19 (count = 1), RegionEntry +Segment at 42:12 (count = 0), Skipped +Segment at 43:9 (count = 0), RegionEntry +Segment at 43:10 (count = 0), Skipped +Segment at 43:14 (count = 1), RegionEntry +Segment at 43:18 (count = 0), Skipped +Segment at 43:28 (count = 1), RegionEntry +Segment at 43:33 (count = 0), Skipped +Segment at 43:39 (count = 0), RegionEntry +Segment at 43:42 (count = 0), Skipped +Segment at 44:9 (count = 0), RegionEntry +Segment at 44:10 (count = 0), Skipped +Segment at 44:14 (count = 1), RegionEntry +Segment at 44:17 (count = 0), Skipped +Segment at 44:27 (count = 1), RegionEntry +Segment at 44:32 (count = 0), Skipped +Segment at 44:36 (count = 0), RegionEntry +Segment at 44:38 (count = 0), Skipped +Segment at 45:14 (count = 1), RegionEntry +Segment at 45:16 (count = 0), Skipped +Segment at 47:1 (count = 1), RegionEntry +Segment at 47:2 (count = 0), Skipped +Segment at 49:1 (count = 1), RegionEntry +Segment at 51:5 (count = 1), RegionEntry +Segment at 52:18 (count = 1) +Segment at 53:13 (count = 0), RegionEntry +Segment at 53:14 (count = 1) +Segment at 63:13 (count = 1), RegionEntry +Segment at 63:14 (count = 1) +Segment at 65:5 (count = 1), RegionEntry +Segment at 65:6 (count = 1) +Segment at 67:5 (count = 1), RegionEntry +Segment at 67:23 (count = 1) +Segment at 68:12 (count = 0), Skipped +Segment at 69:9 (count = 0), RegionEntry +Segment at 69:10 (count = 0), Skipped +Segment at 69:14 (count = 1), RegionEntry +Segment at 69:27 (count = 0), Skipped +Segment at 69:31 (count = 0), RegionEntry +Segment at 69:39 (count = 0), Skipped +Segment at 70:9 (count = 0), RegionEntry +Segment at 70:10 (count = 0), Skipped +Segment at 70:14 (count = 1), RegionEntry +Segment at 70:26 (count = 0), Skipped +Segment at 70:30 (count = 0), RegionEntry +Segment at 70:32 (count = 0), Skipped +Segment at 71:14 (count = 1), RegionEntry +Segment at 71:16 (count = 0), Skipped +Segment at 73:1 (count = 1), RegionEntry +Segment at 73:2 (count = 0), Skipped +Segment at 75:1 (count = 0), RegionEntry +Segment at 76:12 (count = 0), Skipped +Segment at 77:14 (count = 0), RegionEntry +Segment at 77:16 (count = 0), Skipped +Segment at 78:14 (count = 0), RegionEntry +Segment at 78:16 (count = 0), Skipped +Segment at 79:14 (count = 0), RegionEntry +Segment at 79:16 (count = 0), Skipped +Segment at 81:1 (count = 0), RegionEntry +Segment at 81:2 (count = 0), Skipped +Segment at 83:1 (count = 1), RegionEntry +Segment at 84:12 (count = 0), Skipped +Segment at 85:14 (count = 0), RegionEntry +Segment at 85:16 (count = 0), Skipped +Segment at 86:14 (count = 0), RegionEntry +Segment at 86:16 (count = 0), Skipped +Segment at 87:14 (count = 1), RegionEntry +Segment at 87:16 (count = 0), Skipped +Segment at 89:1 (count = 1), RegionEntry +Segment at 89:2 (count = 0), Skipped +Segment at 91:1 (count = 1), RegionEntry +Segment at 91:25 (count = 0), RegionEntry +Segment at 91:34 (count = 0), Skipped +Segment at 93:1 (count = 1), RegionEntry +Segment at 101:2 (count = 0), Skipped +Segment at 110:5 (count = 1), RegionEntry +Segment at 117:17 (count = 1), RegionEntry +Segment at 117:19 (count = 1) +Segment at 120:54 (count = 0), Skipped +Segment at 123:32 (count = 1), RegionEntry +Segment at 123:35 (count = 0), Skipped +Segment at 123:39 (count = 1), RegionEntry +Segment at 123:73 (count = 0), Skipped +Segment at 124:23 (count = 1), RegionEntry +Segment at 124:26 (count = 0), Skipped +Segment at 125:14 (count = 0), RegionEntry +Segment at 125:15 (count = 0), Skipped +Segment at 127:5 (count = 1), RegionEntry +Segment at 127:6 (count = 0), Skipped diff --git a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage_counters.closure.txt b/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage_counters.closure.txt new file mode 100644 index 0000000000000..1aacac0ed2515 --- /dev/null +++ b/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage_counters.closure.txt @@ -0,0 +1,153 @@ +Counter in file 0 98:5 -> 100:20, #1 +Counter in file 0 100:21 -> 102:10, #2 +Counter in file 0 102:10 -> 102:11, (#1 - #2) +Counter in file 0 103:9 -> 104:6, (#2 + (#1 - #2)) +Counter in file 0 123:5 -> 124:20, 0 +Counter in file 0 124:21 -> 126:10, 0 +Counter in file 0 126:10 -> 126:11, 0 +Counter in file 0 127:9 -> 128:6, 0 +Counter in file 0 131:53 -> 131:67, 0 +Counter in file 0 141:59 -> 141:85, 0 +Counter in file 0 143:56 -> 145:6, 0 +Counter in file 0 149:7 -> 149:33, 0 +Counter in file 0 153:7 -> 153:33, 0 +Counter in file 0 3:1 -> 18:13, #1 +Counter in file 0 25:14 -> 33:9, (#1 + 0) +Counter in file 0 40:6 -> 60:13, (#1 + 0) +Counter in file 0 67:14 -> 75:9, (#1 + 0) +Counter in file 0 82:6 -> 97:9, (#1 + 0) +Counter in file 0 104:6 -> 120:9, (#1 + 0) +Counter in file 0 128:6 -> 131:33, (#1 + 0) +Counter in file 0 131:67 -> 136:33, (#1 + 0) +Counter in file 0 136:75 -> 141:39, (#1 + 0) +Counter in file 0 141:85 -> 143:36, (#1 + 0) +Counter in file 0 145:6 -> 147:36, (#1 + 0) +Counter in file 0 149:33 -> 151:43, (#1 + 0) +Counter in file 0 153:33 -> 155:2, (#1 + 0) +Counter in file 0 61:13 -> 63:28, #1 +Counter in file 0 63:29 -> 65:18, #2 +Counter in file 0 65:18 -> 65:19, (#1 - #2) +Counter in file 0 66:17 -> 67:14, (#2 + (#1 - #2)) +Counter in file 0 76:5 -> 78:20, #1 +Counter in file 0 78:21 -> 80:10, #2 +Counter in file 0 80:10 -> 80:11, (#1 - #2) +Counter in file 0 81:9 -> 82:6, (#2 + (#1 - #2)) +Counter in file 0 34:5 -> 36:20, #1 +Counter in file 0 36:21 -> 38:10, #2 +Counter in file 0 38:10 -> 38:11, (#1 - #2) +Counter in file 0 39:9 -> 40:6, (#2 + (#1 - #2)) +Counter in file 0 19:13 -> 21:28, #1 +Counter in file 0 21:29 -> 23:18, #2 +Counter in file 0 23:18 -> 23:19, (#1 - #2) +Counter in file 0 24:17 -> 25:14, (#2 + (#1 - #2)) +Emitting segments for file: ../coverage/closure.rs +Combined regions: + 3:1 -> 18:13 (count=1) + 19:13 -> 21:28 (count=0) + 21:29 -> 23:18 (count=0) + 23:18 -> 23:19 (count=0) + 24:17 -> 25:14 (count=0) + 25:14 -> 33:9 (count=1) + 34:5 -> 36:20 (count=0) + 36:21 -> 38:10 (count=0) + 38:10 -> 38:11 (count=0) + 39:9 -> 40:6 (count=0) + 40:6 -> 60:13 (count=1) + 61:13 -> 63:28 (count=1) + 63:29 -> 65:18 (count=0) + 65:18 -> 65:19 (count=1) + 66:17 -> 67:14 (count=1) + 67:14 -> 75:9 (count=1) + 76:5 -> 78:20 (count=1) + 78:21 -> 80:10 (count=0) + 80:10 -> 80:11 (count=1) + 81:9 -> 82:6 (count=1) + 82:6 -> 97:9 (count=1) + 98:5 -> 100:20 (count=5) + 100:21 -> 102:10 (count=0) + 102:10 -> 102:11 (count=5) + 103:9 -> 104:6 (count=5) + 104:6 -> 120:9 (count=1) + 123:5 -> 124:20 (count=0) + 124:21 -> 126:10 (count=0) + 126:10 -> 126:11 (count=0) + 127:9 -> 128:6 (count=0) + 128:6 -> 131:33 (count=1) + 131:53 -> 131:67 (count=0) + 131:67 -> 136:33 (count=1) + 136:75 -> 141:39 (count=1) + 141:59 -> 141:85 (count=0) + 141:85 -> 143:36 (count=1) + 143:56 -> 145:6 (count=0) + 145:6 -> 147:36 (count=1) + 149:7 -> 149:33 (count=0) + 149:33 -> 151:43 (count=1) + 153:7 -> 153:33 (count=0) + 153:33 -> 155:2 (count=1) +Segment at 3:1 (count = 1), RegionEntry +Segment at 18:13 (count = 0), Skipped +Segment at 19:13 (count = 0), RegionEntry +Segment at 21:28 (count = 0), Skipped +Segment at 21:29 (count = 0), RegionEntry +Segment at 23:18 (count = 0), RegionEntry +Segment at 23:19 (count = 0), Skipped +Segment at 24:17 (count = 0), RegionEntry +Segment at 25:14 (count = 1), RegionEntry +Segment at 33:9 (count = 0), Skipped +Segment at 34:5 (count = 0), RegionEntry +Segment at 36:20 (count = 0), Skipped +Segment at 36:21 (count = 0), RegionEntry +Segment at 38:10 (count = 0), RegionEntry +Segment at 38:11 (count = 0), Skipped +Segment at 39:9 (count = 0), RegionEntry +Segment at 40:6 (count = 1), RegionEntry +Segment at 60:13 (count = 0), Skipped +Segment at 61:13 (count = 1), RegionEntry +Segment at 63:28 (count = 0), Skipped +Segment at 63:29 (count = 0), RegionEntry +Segment at 65:18 (count = 1), RegionEntry +Segment at 65:19 (count = 0), Skipped +Segment at 66:17 (count = 1), RegionEntry +Segment at 67:14 (count = 1), RegionEntry +Segment at 75:9 (count = 0), Skipped +Segment at 76:5 (count = 1), RegionEntry +Segment at 78:20 (count = 0), Skipped +Segment at 78:21 (count = 0), RegionEntry +Segment at 80:10 (count = 1), RegionEntry +Segment at 80:11 (count = 0), Skipped +Segment at 81:9 (count = 1), RegionEntry +Segment at 82:6 (count = 1), RegionEntry +Segment at 97:9 (count = 0), Skipped +Segment at 98:5 (count = 5), RegionEntry +Segment at 100:20 (count = 0), Skipped +Segment at 100:21 (count = 0), RegionEntry +Segment at 102:10 (count = 5), RegionEntry +Segment at 102:11 (count = 0), Skipped +Segment at 103:9 (count = 5), RegionEntry +Segment at 104:6 (count = 1), RegionEntry +Segment at 120:9 (count = 0), Skipped +Segment at 123:5 (count = 0), RegionEntry +Segment at 124:20 (count = 0), Skipped +Segment at 124:21 (count = 0), RegionEntry +Segment at 126:10 (count = 0), RegionEntry +Segment at 126:11 (count = 0), Skipped +Segment at 127:9 (count = 0), RegionEntry +Segment at 128:6 (count = 1), RegionEntry +Segment at 131:33 (count = 0), Skipped +Segment at 131:53 (count = 0), RegionEntry +Segment at 131:67 (count = 1), RegionEntry +Segment at 136:33 (count = 0), Skipped +Segment at 136:75 (count = 1), RegionEntry +Segment at 141:39 (count = 0), Skipped +Segment at 141:59 (count = 0), RegionEntry +Segment at 141:85 (count = 1), RegionEntry +Segment at 143:36 (count = 0), Skipped +Segment at 143:56 (count = 0), RegionEntry +Segment at 145:6 (count = 1), RegionEntry +Segment at 147:36 (count = 0), Skipped +Segment at 149:7 (count = 0), RegionEntry +Segment at 149:33 (count = 1), RegionEntry +Segment at 151:43 (count = 0), Skipped +Segment at 153:7 (count = 0), RegionEntry +Segment at 153:33 (count = 1), RegionEntry +Segment at 155:2 (count = 0), Skipped diff --git a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage_counters.conditions.txt b/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage_counters.conditions.txt new file mode 100644 index 0000000000000..3a9c6a9b92e98 --- /dev/null +++ b/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage_counters.conditions.txt @@ -0,0 +1,253 @@ +Counter in file 0 3:1 -> 3:11, #1 +Counter in file 0 4:9 -> 5:12, (#1 + 0) +Counter in file 0 5:13 -> 7:6, #2 +Counter in file 0 10:9 -> 10:10, (#3 + (#12 + #13)) +Counter in file 0 10:16 -> 10:29, (#2 + 0) +Counter in file 0 11:9 -> 12:10, #3 +Counter in file 0 13:15 -> 13:28, ((#2 + 0) - #3) +Counter in file 0 14:12 -> 14:25, #4 +Counter in file 0 14:29 -> 14:42, (#4 - #15) +Counter in file 0 14:46 -> 14:60, #21 +Counter in file 0 14:61 -> 16:10, #12 +Counter in file 0 16:10 -> 16:11, #13 +Counter in file 0 17:9 -> 18:18, (#12 + #13) +Counter in file 0 20:9 -> 20:15, (((#2 + 0) - #3) - #4) +Counter in file 0 23:9 -> 24:12, ((#3 + (#12 + #13)) + 0) +Counter in file 0 24:13 -> 26:6, #14 +Counter in file 0 28:8 -> 28:21, (#14 + 0) +Counter in file 0 28:22 -> 30:6, #16 +Counter in file 0 30:15 -> 30:28, ((#14 + 0) - #16) +Counter in file 0 31:12 -> 31:25, (((#14 + 0) - #16) - #11) +Counter in file 0 31:29 -> 31:42, ((((#14 + 0) - #16) - #11) - #23) +Counter in file 0 31:46 -> 31:60, #31 +Counter in file 0 31:61 -> 33:10, #18 +Counter in file 0 33:10 -> 33:11, #19 +Counter in file 0 34:9 -> 34:23, (#18 + #19) +Counter in file 0 36:9 -> 36:15, #11 +Counter in file 0 39:8 -> 39:12, (#16 + (#18 + #19)) +Counter in file 0 40:13 -> 41:16, #20 +Counter in file 0 41:17 -> 43:10, #24 +Counter in file 0 45:12 -> 45:25, (#24 + 0) +Counter in file 0 45:26 -> 47:10, #25 +Counter in file 0 48:17 -> 48:30, ((#24 + 0) - #25) +Counter in file 0 49:16 -> 49:29, (((#24 + 0) - #25) - #10) +Counter in file 0 49:33 -> 49:46, ((((#24 + 0) - #25) - #10) - #35) +Counter in file 0 49:50 -> 49:64, #40 +Counter in file 0 49:65 -> 51:14, #26 +Counter in file 0 51:14 -> 51:15, #27 +Counter in file 0 52:13 -> 52:27, (#26 + #27) +Counter in file 0 54:13 -> 54:19, #10 +Counter in file 0 59:9 -> 60:12, ((#25 + (#26 + #27)) + 0) +Counter in file 0 60:13 -> 62:6, #28 +Counter in file 0 64:9 -> 64:10, (#30 + (#33 + #34)) +Counter in file 0 64:16 -> 64:29, (#28 + 0) +Counter in file 0 64:30 -> 66:6, #30 +Counter in file 0 66:15 -> 66:28, ((#28 + 0) - #30) +Counter in file 0 67:12 -> 67:25, (((#28 + 0) - #30) - #9) +Counter in file 0 67:29 -> 67:42, ((((#28 + 0) - #30) - #9) - #36) +Counter in file 0 67:46 -> 67:60, #42 +Counter in file 0 67:61 -> 69:10, #33 +Counter in file 0 69:10 -> 69:11, #34 +Counter in file 0 70:9 -> 70:23, (#33 + #34) +Counter in file 0 72:13 -> 74:15, #9 +Counter in file 0 77:9 -> 77:10, (#5 + (#6 + #7)) +Counter in file 0 77:16 -> 77:29, ((#30 + (#33 + #34)) + 0) +Counter in file 0 77:30 -> 79:6, #5 +Counter in file 0 79:15 -> 79:28, ((#30 + (#33 + #34)) - #5) +Counter in file 0 80:12 -> 80:25, (((#30 + (#33 + #34)) - #5) - #8) +Counter in file 0 80:29 -> 80:42, ((((#30 + (#33 + #34)) - #5) - #8) - #39) +Counter in file 0 80:46 -> 80:60, #45 +Counter in file 0 80:61 -> 82:10, #6 +Counter in file 0 82:10 -> 82:11, #7 +Counter in file 0 83:9 -> 83:23, (#6 + #7) +Counter in file 0 85:9 -> 85:15, #8 +Counter in file 0 87:1 -> 87:2, ((#5 + (#6 + #7)) + (((#8 + #9) + (#10 + #11)) + (((#2 + 0) - #3) - #4))) +Emitting segments for file: ../coverage/conditions.rs +Combined regions: + 3:1 -> 3:11 (count=1) + 4:9 -> 5:12 (count=1) + 5:13 -> 7:6 (count=1) + 10:9 -> 10:10 (count=1) + 10:16 -> 10:29 (count=1) + 11:9 -> 12:10 (count=1) + 13:15 -> 13:28 (count=0) + 14:12 -> 14:25 (count=0) + 14:29 -> 14:42 (count=0) + 14:46 -> 14:60 (count=0) + 14:61 -> 16:10 (count=0) + 16:10 -> 16:11 (count=0) + 17:9 -> 18:18 (count=0) + 20:9 -> 20:15 (count=0) + 23:9 -> 24:12 (count=1) + 24:13 -> 26:6 (count=1) + 28:8 -> 28:21 (count=1) + 28:22 -> 30:6 (count=1) + 30:15 -> 30:28 (count=0) + 31:12 -> 31:25 (count=0) + 31:29 -> 31:42 (count=0) + 31:46 -> 31:60 (count=0) + 31:61 -> 33:10 (count=0) + 33:10 -> 33:11 (count=0) + 34:9 -> 34:23 (count=0) + 36:9 -> 36:15 (count=0) + 39:8 -> 39:12 (count=1) + 40:13 -> 41:16 (count=1) + 41:17 -> 43:10 (count=1) + 45:12 -> 45:25 (count=1) + 45:26 -> 47:10 (count=1) + 48:17 -> 48:30 (count=0) + 49:16 -> 49:29 (count=0) + 49:33 -> 49:46 (count=0) + 49:50 -> 49:64 (count=0) + 49:65 -> 51:14 (count=0) + 51:14 -> 51:15 (count=0) + 52:13 -> 52:27 (count=0) + 54:13 -> 54:19 (count=0) + 59:9 -> 60:12 (count=1) + 60:13 -> 62:6 (count=1) + 64:9 -> 64:10 (count=0) + 64:16 -> 64:29 (count=1) + 64:30 -> 66:6 (count=0) + 66:15 -> 66:28 (count=1) + 67:12 -> 67:25 (count=0) + 67:29 -> 67:42 (count=0) + 67:46 -> 67:60 (count=0) + 67:61 -> 69:10 (count=0) + 69:10 -> 69:11 (count=0) + 70:9 -> 70:23 (count=0) + 72:13 -> 74:15 (count=1) + 77:9 -> 77:10 (count=0) + 77:16 -> 77:29 (count=0) + 77:30 -> 79:6 (count=0) + 79:15 -> 79:28 (count=0) + 80:12 -> 80:25 (count=0) + 80:29 -> 80:42 (count=0) + 80:46 -> 80:60 (count=0) + 80:61 -> 82:10 (count=0) + 82:10 -> 82:11 (count=0) + 83:9 -> 83:23 (count=0) + 85:9 -> 85:15 (count=0) + 87:1 -> 87:2 (count=1) +Segment at 3:1 (count = 1), RegionEntry +Segment at 3:11 (count = 0), Skipped +Segment at 4:9 (count = 1), RegionEntry +Segment at 5:12 (count = 0), Skipped +Segment at 5:13 (count = 1), RegionEntry +Segment at 7:6 (count = 0), Skipped +Segment at 10:9 (count = 1), RegionEntry +Segment at 10:10 (count = 0), Skipped +Segment at 10:16 (count = 1), RegionEntry +Segment at 10:29 (count = 0), Skipped +Segment at 11:9 (count = 1), RegionEntry +Segment at 12:10 (count = 0), Skipped +Segment at 13:15 (count = 0), RegionEntry +Segment at 13:28 (count = 0), Skipped +Segment at 14:12 (count = 0), RegionEntry +Segment at 14:25 (count = 0), Skipped +Segment at 14:29 (count = 0), RegionEntry +Segment at 14:42 (count = 0), Skipped +Segment at 14:46 (count = 0), RegionEntry +Segment at 14:60 (count = 0), Skipped +Segment at 14:61 (count = 0), RegionEntry +Segment at 16:10 (count = 0), RegionEntry +Segment at 16:11 (count = 0), Skipped +Segment at 17:9 (count = 0), RegionEntry +Segment at 18:18 (count = 0), Skipped +Segment at 20:9 (count = 0), RegionEntry +Segment at 20:15 (count = 0), Skipped +Segment at 23:9 (count = 1), RegionEntry +Segment at 24:12 (count = 0), Skipped +Segment at 24:13 (count = 1), RegionEntry +Segment at 26:6 (count = 0), Skipped +Segment at 28:8 (count = 1), RegionEntry +Segment at 28:21 (count = 0), Skipped +Segment at 28:22 (count = 1), RegionEntry +Segment at 30:6 (count = 0), Skipped +Segment at 30:15 (count = 0), RegionEntry +Segment at 30:28 (count = 0), Skipped +Segment at 31:12 (count = 0), RegionEntry +Segment at 31:25 (count = 0), Skipped +Segment at 31:29 (count = 0), RegionEntry +Segment at 31:42 (count = 0), Skipped +Segment at 31:46 (count = 0), RegionEntry +Segment at 31:60 (count = 0), Skipped +Segment at 31:61 (count = 0), RegionEntry +Segment at 33:10 (count = 0), RegionEntry +Segment at 33:11 (count = 0), Skipped +Segment at 34:9 (count = 0), RegionEntry +Segment at 34:23 (count = 0), Skipped +Segment at 36:9 (count = 0), RegionEntry +Segment at 36:15 (count = 0), Skipped +Segment at 39:8 (count = 1), RegionEntry +Segment at 39:12 (count = 0), Skipped +Segment at 40:13 (count = 1), RegionEntry +Segment at 41:16 (count = 0), Skipped +Segment at 41:17 (count = 1), RegionEntry +Segment at 43:10 (count = 0), Skipped +Segment at 45:12 (count = 1), RegionEntry +Segment at 45:25 (count = 0), Skipped +Segment at 45:26 (count = 1), RegionEntry +Segment at 47:10 (count = 0), Skipped +Segment at 48:17 (count = 0), RegionEntry +Segment at 48:30 (count = 0), Skipped +Segment at 49:16 (count = 0), RegionEntry +Segment at 49:29 (count = 0), Skipped +Segment at 49:33 (count = 0), RegionEntry +Segment at 49:46 (count = 0), Skipped +Segment at 49:50 (count = 0), RegionEntry +Segment at 49:64 (count = 0), Skipped +Segment at 49:65 (count = 0), RegionEntry +Segment at 51:14 (count = 0), RegionEntry +Segment at 51:15 (count = 0), Skipped +Segment at 52:13 (count = 0), RegionEntry +Segment at 52:27 (count = 0), Skipped +Segment at 54:13 (count = 0), RegionEntry +Segment at 54:19 (count = 0), Skipped +Segment at 59:9 (count = 1), RegionEntry +Segment at 60:12 (count = 0), Skipped +Segment at 60:13 (count = 1), RegionEntry +Segment at 62:6 (count = 0), Skipped +Segment at 64:9 (count = 0), RegionEntry +Segment at 64:10 (count = 0), Skipped +Segment at 64:16 (count = 1), RegionEntry +Segment at 64:29 (count = 0), Skipped +Segment at 64:30 (count = 0), RegionEntry +Segment at 66:6 (count = 0), Skipped +Segment at 66:15 (count = 1), RegionEntry +Segment at 66:28 (count = 0), Skipped +Segment at 67:12 (count = 0), RegionEntry +Segment at 67:25 (count = 0), Skipped +Segment at 67:29 (count = 0), RegionEntry +Segment at 67:42 (count = 0), Skipped +Segment at 67:46 (count = 0), RegionEntry +Segment at 67:60 (count = 0), Skipped +Segment at 67:61 (count = 0), RegionEntry +Segment at 69:10 (count = 0), RegionEntry +Segment at 69:11 (count = 0), Skipped +Segment at 70:9 (count = 0), RegionEntry +Segment at 70:23 (count = 0), Skipped +Segment at 72:13 (count = 1), RegionEntry +Segment at 74:15 (count = 0), Skipped +Segment at 77:9 (count = 0), RegionEntry +Segment at 77:10 (count = 0), Skipped +Segment at 77:16 (count = 0), RegionEntry +Segment at 77:29 (count = 0), Skipped +Segment at 77:30 (count = 0), RegionEntry +Segment at 79:6 (count = 0), Skipped +Segment at 79:15 (count = 0), RegionEntry +Segment at 79:28 (count = 0), Skipped +Segment at 80:12 (count = 0), RegionEntry +Segment at 80:25 (count = 0), Skipped +Segment at 80:29 (count = 0), RegionEntry +Segment at 80:42 (count = 0), Skipped +Segment at 80:46 (count = 0), RegionEntry +Segment at 80:60 (count = 0), Skipped +Segment at 80:61 (count = 0), RegionEntry +Segment at 82:10 (count = 0), RegionEntry +Segment at 82:11 (count = 0), Skipped +Segment at 83:9 (count = 0), RegionEntry +Segment at 83:23 (count = 0), Skipped +Segment at 85:9 (count = 0), RegionEntry +Segment at 85:15 (count = 0), Skipped +Segment at 87:1 (count = 1), RegionEntry +Segment at 87:2 (count = 0), Skipped diff --git a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage_counters.dead_code.txt b/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage_counters.dead_code.txt new file mode 100644 index 0000000000000..a2187d477c820 --- /dev/null +++ b/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage_counters.dead_code.txt @@ -0,0 +1,47 @@ +Counter in file 0 3:1 -> 10:15, 0 +Counter in file 0 10:16 -> 12:6, 0 +Counter in file 0 12:6 -> 12:7, 0 +Counter in file 0 13:1 -> 13:2, 0 +Counter in file 0 15:1 -> 22:15, 0 +Counter in file 0 22:16 -> 24:6, 0 +Counter in file 0 24:6 -> 24:7, 0 +Counter in file 0 25:1 -> 25:2, 0 +Counter in file 0 27:1 -> 34:15, #1 +Counter in file 0 34:16 -> 36:6, #2 +Counter in file 0 36:6 -> 36:7, (#1 - #2) +Counter in file 0 37:1 -> 37:2, (#2 + (#1 - #2)) +Emitting segments for file: ../coverage/dead_code.rs +Combined regions: + 3:1 -> 10:15 (count=0) + 10:16 -> 12:6 (count=0) + 12:6 -> 12:7 (count=0) + 13:1 -> 13:2 (count=0) + 15:1 -> 22:15 (count=0) + 22:16 -> 24:6 (count=0) + 24:6 -> 24:7 (count=0) + 25:1 -> 25:2 (count=0) + 27:1 -> 34:15 (count=1) + 34:16 -> 36:6 (count=1) + 36:6 -> 36:7 (count=0) + 37:1 -> 37:2 (count=1) +Segment at 3:1 (count = 0), RegionEntry +Segment at 10:15 (count = 0), Skipped +Segment at 10:16 (count = 0), RegionEntry +Segment at 12:6 (count = 0), RegionEntry +Segment at 12:7 (count = 0), Skipped +Segment at 13:1 (count = 0), RegionEntry +Segment at 13:2 (count = 0), Skipped +Segment at 15:1 (count = 0), RegionEntry +Segment at 22:15 (count = 0), Skipped +Segment at 22:16 (count = 0), RegionEntry +Segment at 24:6 (count = 0), RegionEntry +Segment at 24:7 (count = 0), Skipped +Segment at 25:1 (count = 0), RegionEntry +Segment at 25:2 (count = 0), Skipped +Segment at 27:1 (count = 1), RegionEntry +Segment at 34:15 (count = 0), Skipped +Segment at 34:16 (count = 1), RegionEntry +Segment at 36:6 (count = 0), RegionEntry +Segment at 36:7 (count = 0), Skipped +Segment at 37:1 (count = 1), RegionEntry +Segment at 37:2 (count = 0), Skipped diff --git a/src/test/run-make-fulldeps/coverage-reports-base/expected_show_coverage_counters.drop_trait.txt b/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage_counters.drop_trait.txt similarity index 55% rename from src/test/run-make-fulldeps/coverage-reports-base/expected_show_coverage_counters.drop_trait.txt rename to src/test/run-make-fulldeps/coverage-reports/expected_show_coverage_counters.drop_trait.txt index 375025fe8bcc2..66c51e3a2982d 100644 --- a/src/test/run-make-fulldeps/coverage-reports-base/expected_show_coverage_counters.drop_trait.txt +++ b/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage_counters.drop_trait.txt @@ -1,20 +1,16 @@ -Counter in file 0 9:24 -> 11:6, #1 -Counter in file 0 15:9 -> 17:42, #1 -Counter in file 0 19:8 -> 19:12, (#1 + 0) +Counter in file 0 9:5 -> 11:6, #1 +Counter in file 0 14:1 -> 19:12, #1 Counter in file 0 20:9 -> 21:22, #2 Counter in file 0 27:1 -> 27:2, (#2 + 0) Emitting segments for file: ../coverage/drop_trait.rs Combined regions: - 9:24 -> 11:6 (count=2) - 15:9 -> 17:42 (count=1) - 19:8 -> 19:12 (count=1) + 9:5 -> 11:6 (count=2) + 14:1 -> 19:12 (count=1) 20:9 -> 21:22 (count=1) 27:1 -> 27:2 (count=1) -Segment at 9:24 (count = 2), RegionEntry +Segment at 9:5 (count = 2), RegionEntry Segment at 11:6 (count = 0), Skipped -Segment at 15:9 (count = 1), RegionEntry -Segment at 17:42 (count = 0), Skipped -Segment at 19:8 (count = 1), RegionEntry +Segment at 14:1 (count = 1), RegionEntry Segment at 19:12 (count = 0), Skipped Segment at 20:9 (count = 1), RegionEntry Segment at 21:22 (count = 0), Skipped diff --git a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage_counters.generics.txt b/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage_counters.generics.txt new file mode 100644 index 0000000000000..e2cbf6f709e6e --- /dev/null +++ b/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage_counters.generics.txt @@ -0,0 +1,44 @@ +Counter in file 0 17:5 -> 19:6, #1 +Counter in file 0 17:5 -> 19:6, #1 +Counter in file 0 22:1 -> 30:12, #1 +Counter in file 0 31:9 -> 32:22, #2 +Counter in file 0 42:1 -> 42:2, (#2 + 0) +Counter in file 0 10:5 -> 12:6, #1 +Counter in file 0 10:5 -> 12:6, #1 +Emitting segments for file: ../coverage/generics.rs +Combined regions: + 10:5 -> 12:6 (count=3) + 17:5 -> 19:6 (count=2) + 22:1 -> 30:12 (count=1) + 31:9 -> 32:22 (count=1) + 42:1 -> 42:2 (count=1) +Segment at 10:5 (count = 3), RegionEntry +Segment at 12:6 (count = 0), Skipped +Segment at 17:5 (count = 2), RegionEntry +Segment at 19:6 (count = 0), Skipped +Segment at 22:1 (count = 1), RegionEntry +Segment at 30:12 (count = 0), Skipped +Segment at 31:9 (count = 1), RegionEntry +Segment at 32:22 (count = 0), Skipped +Segment at 42:1 (count = 1), RegionEntry +Segment at 42:2 (count = 0), Skipped +Emitting segments for function: _RNvMCs4fqI2P2rA04_8genericsINtB2_8FireworkdE12set_strengthB2_ +Combined regions: + 10:5 -> 12:6 (count=2) +Segment at 10:5 (count = 2), RegionEntry +Segment at 12:6 (count = 0), Skipped +Emitting segments for function: _RNvMCs4fqI2P2rA04_8genericsINtB2_8FireworklE12set_strengthB2_ +Combined regions: + 10:5 -> 12:6 (count=1) +Segment at 10:5 (count = 1), RegionEntry +Segment at 12:6 (count = 0), Skipped +Emitting segments for function: _RNvXs_Cs4fqI2P2rA04_8genericsINtB4_8FireworklENtNtNtCs3rFBWs28XFJ_4core3ops4drop4Drop4dropB4_ +Combined regions: + 17:5 -> 19:6 (count=1) +Segment at 17:5 (count = 1), RegionEntry +Segment at 19:6 (count = 0), Skipped +Emitting segments for function: _RNvXs_Cs4fqI2P2rA04_8genericsINtB4_8FireworkdENtNtNtCs3rFBWs28XFJ_4core3ops4drop4Drop4dropB4_ +Combined regions: + 17:5 -> 19:6 (count=1) +Segment at 17:5 (count = 1), RegionEntry +Segment at 19:6 (count = 0), Skipped diff --git a/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_show_coverage_counters.if.txt b/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage_counters.if.txt similarity index 66% rename from src/test/run-make-fulldeps/coverage-reports-deadcode/expected_show_coverage_counters.if.txt rename to src/test/run-make-fulldeps/coverage-reports/expected_show_coverage_counters.if.txt index c2bef365ea9d8..2e802a462ea2c 100644 --- a/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_show_coverage_counters.if.txt +++ b/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage_counters.if.txt @@ -1,18 +1,14 @@ -Counter in file 0 8:5 -> 18:10, #1 -Counter in file 0 21:9 -> 21:16, (#1 + 0) +Counter in file 0 3:1 -> 21:16, #1 Counter in file 0 22:5 -> 27:6, #2 Counter in file 0 27:6 -> 27:7, (#1 - #2) Counter in file 0 28:1 -> 28:2, (#2 + (#1 - #2)) Emitting segments for file: ../coverage/if.rs Combined regions: - 8:5 -> 18:10 (count=1) - 21:9 -> 21:16 (count=1) + 3:1 -> 21:16 (count=1) 22:5 -> 27:6 (count=1) 27:6 -> 27:7 (count=0) 28:1 -> 28:2 (count=1) -Segment at 8:5 (count = 1), RegionEntry -Segment at 18:10 (count = 0), Skipped -Segment at 21:9 (count = 1), RegionEntry +Segment at 3:1 (count = 1), RegionEntry Segment at 21:16 (count = 0), Skipped Segment at 22:5 (count = 1), RegionEntry Segment at 27:6 (count = 0), RegionEntry diff --git a/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_show_coverage_counters.if_else.txt b/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage_counters.if_else.txt similarity index 90% rename from src/test/run-make-fulldeps/coverage-reports-deadcode/expected_show_coverage_counters.if_else.txt rename to src/test/run-make-fulldeps/coverage-reports/expected_show_coverage_counters.if_else.txt index faf5c094bbaaa..03b35b0f00999 100644 --- a/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_show_coverage_counters.if_else.txt +++ b/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage_counters.if_else.txt @@ -1,4 +1,4 @@ -Counter in file 0 7:9 -> 11:16, #1 +Counter in file 0 3:1 -> 11:16, #1 Counter in file 0 12:5 -> 17:6, #2 Counter in file 0 20:9 -> 22:16, (#1 - #2) Counter in file 0 26:9 -> 26:16, (#2 + (#1 - #2)) @@ -7,14 +7,14 @@ Counter in file 0 34:5 -> 39:6, ((#2 + (#1 - #2)) - #3) Counter in file 0 40:1 -> 40:2, (#3 + ((#2 + (#1 - #2)) - #3)) Emitting segments for file: ../coverage/if_else.rs Combined regions: - 7:9 -> 11:16 (count=1) + 3:1 -> 11:16 (count=1) 12:5 -> 17:6 (count=1) 20:9 -> 22:16 (count=0) 26:9 -> 26:16 (count=1) 27:5 -> 32:6 (count=1) 34:5 -> 39:6 (count=0) 40:1 -> 40:2 (count=1) -Segment at 7:9 (count = 1), RegionEntry +Segment at 3:1 (count = 1), RegionEntry Segment at 11:16 (count = 0), Skipped Segment at 12:5 (count = 1), RegionEntry Segment at 17:6 (count = 0), Skipped diff --git a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage_counters.inner_items.txt b/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage_counters.inner_items.txt new file mode 100644 index 0000000000000..5dc704d6149f1 --- /dev/null +++ b/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage_counters.inner_items.txt @@ -0,0 +1,44 @@ +Counter in file 0 18:5 -> 22:6, #1 +Counter in file 0 3:1 -> 3:11, #1 +Counter in file 0 7:9 -> 10:15, (#1 + 0) +Counter in file 0 10:16 -> 12:6, #2 +Counter in file 0 12:6 -> 12:7, (#1 - #2) +Counter in file 0 48:8 -> 48:15, (#2 + (#1 - #2)) +Counter in file 0 48:16 -> 50:6, #3 +Counter in file 0 50:6 -> 50:7, ((#2 + (#1 - #2)) - #3) +Counter in file 0 52:9 -> 57:2, (#3 + ((#2 + (#1 - #2)) - #3)) +Counter in file 0 33:9 -> 36:10, #1 +Counter in file 0 40:9 -> 43:10, #1 +Emitting segments for file: ../coverage/inner_items.rs +Combined regions: + 3:1 -> 3:11 (count=1) + 7:9 -> 10:15 (count=1) + 10:16 -> 12:6 (count=1) + 12:6 -> 12:7 (count=0) + 18:5 -> 22:6 (count=3) + 33:9 -> 36:10 (count=1) + 40:9 -> 43:10 (count=1) + 48:8 -> 48:15 (count=1) + 48:16 -> 50:6 (count=1) + 50:6 -> 50:7 (count=0) + 52:9 -> 57:2 (count=1) +Segment at 3:1 (count = 1), RegionEntry +Segment at 3:11 (count = 0), Skipped +Segment at 7:9 (count = 1), RegionEntry +Segment at 10:15 (count = 0), Skipped +Segment at 10:16 (count = 1), RegionEntry +Segment at 12:6 (count = 0), RegionEntry +Segment at 12:7 (count = 0), Skipped +Segment at 18:5 (count = 3), RegionEntry +Segment at 22:6 (count = 0), Skipped +Segment at 33:9 (count = 1), RegionEntry +Segment at 36:10 (count = 0), Skipped +Segment at 40:9 (count = 1), RegionEntry +Segment at 43:10 (count = 0), Skipped +Segment at 48:8 (count = 1), RegionEntry +Segment at 48:15 (count = 0), Skipped +Segment at 48:16 (count = 1), RegionEntry +Segment at 50:6 (count = 0), RegionEntry +Segment at 50:7 (count = 0), Skipped +Segment at 52:9 (count = 1), RegionEntry +Segment at 57:2 (count = 0), Skipped diff --git a/src/test/run-make-fulldeps/coverage-reports-base/expected_show_coverage_counters.lazy_boolean.txt b/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage_counters.lazy_boolean.txt similarity index 54% rename from src/test/run-make-fulldeps/coverage-reports-base/expected_show_coverage_counters.lazy_boolean.txt rename to src/test/run-make-fulldeps/coverage-reports/expected_show_coverage_counters.lazy_boolean.txt index 8e56d79d9d2aa..d5667fb861e2c 100644 --- a/src/test/run-make-fulldeps/coverage-reports-base/expected_show_coverage_counters.lazy_boolean.txt +++ b/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage_counters.lazy_boolean.txt @@ -1,62 +1,48 @@ -Counter in file 0 7:9 -> 9:42, #1 -Counter in file 0 10:8 -> 10:15, (#1 + 0) +Counter in file 0 3:1 -> 10:15, #1 Counter in file 0 10:16 -> 14:6, #2 Counter in file 0 14:6 -> 14:7, (#1 - #2) Counter in file 0 16:9 -> 16:17, ((#3 + #4) + (((#2 + (#1 - #2)) - #3) - #4)) Counter in file 0 18:13 -> 18:18, (#2 + (#1 - #2)) Counter in file 0 20:13 -> 20:18, ((#2 + (#1 - #2)) - #3) -Counter in file 0 20:18 -> 20:19, (#3 + #4) -Counter in file 0 20:18 -> 20:19, (((#2 + (#1 - #2)) - #3) - #4) Counter in file 0 23:9 -> 23:17, ((#5 + #6) + ((((#3 + #4) + (((#2 + (#1 - #2)) - #3) - #4)) - #5) - #6)) Counter in file 0 25:13 -> 25:18, (((#3 + #4) + (((#2 + (#1 - #2)) - #3) - #4)) + 0) Counter in file 0 27:13 -> 27:18, (((#3 + #4) + (((#2 + (#1 - #2)) - #3) - #4)) - #5) -Counter in file 0 27:18 -> 27:19, (#5 + #6) -Counter in file 0 27:18 -> 27:19, ((((#3 + #4) + (((#2 + (#1 - #2)) - #3) - #4)) - #5) - #6) -Counter in file 0 29:9 -> 29:17, ((#7 - #8) + ((((#5 + #6) + ((((#3 + #4) + (((#2 + (#1 - #2)) - #3) - #4)) - #5) - #6)) - #7) + #8)) +Counter in file 0 29:9 -> 29:17, (#8 + ((((#5 + #6) + ((((#3 + #4) + (((#2 + (#1 - #2)) - #3) - #4)) - #5) - #6)) - #7) + (#7 - #8))) Counter in file 0 29:20 -> 29:25, (((#5 + #6) + ((((#3 + #4) + (((#2 + (#1 - #2)) - #3) - #4)) - #5) - #6)) + 0) Counter in file 0 29:29 -> 29:34, #7 -Counter in file 0 29:34 -> 29:35, ((((#5 + #6) + ((((#3 + #4) + (((#2 + (#1 - #2)) - #3) - #4)) - #5) - #6)) - #7) + #8) -Counter in file 0 29:34 -> 29:35, (#7 - #8) -Counter in file 0 30:9 -> 30:17, ((#9 - #10) + ((((#7 - #8) + ((((#5 + #6) + ((((#3 + #4) + (((#2 + (#1 - #2)) - #3) - #4)) - #5) - #6)) - #7) + #8)) - #9) + #10)) -Counter in file 0 30:20 -> 30:25, (((#7 - #8) + ((((#5 + #6) + ((((#3 + #4) + (((#2 + (#1 - #2)) - #3) - #4)) - #5) - #6)) - #7) + #8)) + 0) +Counter in file 0 30:9 -> 30:17, (#10 + (((#8 + ((((#5 + #6) + ((((#3 + #4) + (((#2 + (#1 - #2)) - #3) - #4)) - #5) - #6)) - #7) + (#7 - #8))) - #9) + (#9 - #10))) +Counter in file 0 30:20 -> 30:25, ((#8 + ((((#5 + #6) + ((((#3 + #4) + (((#2 + (#1 - #2)) - #3) - #4)) - #5) - #6)) - #7) + (#7 - #8))) + 0) Counter in file 0 30:29 -> 30:34, #9 -Counter in file 0 30:34 -> 30:35, ((((#7 - #8) + ((((#5 + #6) + ((((#3 + #4) + (((#2 + (#1 - #2)) - #3) - #4)) - #5) - #6)) - #7) + #8)) - #9) + #10) -Counter in file 0 30:34 -> 30:35, (#9 - #10) -Counter in file 0 33:9 -> 34:16, (((#9 - #10) + ((((#7 - #8) + ((((#5 + #6) + ((((#3 + #4) + (((#2 + (#1 - #2)) - #3) - #4)) - #5) - #6)) - #7) + #8)) - #9) + #10)) + 0) +Counter in file 0 33:9 -> 34:16, ((#10 + (((#8 + ((((#5 + #6) + ((((#3 + #4) + (((#2 + (#1 - #2)) - #3) - #4)) - #5) - #6)) - #7) + (#7 - #8))) - #9) + (#9 - #10))) + 0) Counter in file 0 35:5 -> 38:6, #11 -Counter in file 0 38:6 -> 38:7, (((#9 - #10) + ((((#7 - #8) + ((((#5 + #6) + ((((#3 + #4) + (((#2 + (#1 - #2)) - #3) - #4)) - #5) - #6)) - #7) + #8)) - #9) + #10)) - #11) -Counter in file 0 41:9 -> 41:16, (#11 + (((#9 - #10) + ((((#7 - #8) + ((((#5 + #6) + ((((#3 + #4) + (((#2 + (#1 - #2)) - #3) - #4)) - #5) - #6)) - #7) + #8)) - #9) + #10)) - #11)) +Counter in file 0 38:6 -> 38:7, ((#10 + (((#8 + ((((#5 + #6) + ((((#3 + #4) + (((#2 + (#1 - #2)) - #3) - #4)) - #5) - #6)) - #7) + (#7 - #8))) - #9) + (#9 - #10))) - #11) +Counter in file 0 41:9 -> 41:16, (#11 + ((#10 + (((#8 + ((((#5 + #6) + ((((#3 + #4) + (((#2 + (#1 - #2)) - #3) - #4)) - #5) - #6)) - #7) + (#7 - #8))) - #9) + (#9 - #10))) - #11)) Counter in file 0 42:5 -> 45:6, #12 -Counter in file 0 47:5 -> 50:6, ((#11 + (((#9 - #10) + ((((#7 - #8) + ((((#5 + #6) + ((((#3 + #4) + (((#2 + (#1 - #2)) - #3) - #4)) - #5) - #6)) - #7) + #8)) - #9) + #10)) - #11)) - #12) -Counter in file 0 52:8 -> 52:16, (#12 + ((#11 + (((#9 - #10) + ((((#7 - #8) + ((((#5 + #6) + ((((#3 + #4) + (((#2 + (#1 - #2)) - #3) - #4)) - #5) - #6)) - #7) + #8)) - #9) + #10)) - #11)) - #12)) +Counter in file 0 47:5 -> 50:6, ((#11 + ((#10 + (((#8 + ((((#5 + #6) + ((((#3 + #4) + (((#2 + (#1 - #2)) - #3) - #4)) - #5) - #6)) - #7) + (#7 - #8))) - #9) + (#9 - #10))) - #11)) - #12) +Counter in file 0 52:8 -> 52:16, (#12 + ((#11 + ((#10 + (((#8 + ((((#5 + #6) + ((((#3 + #4) + (((#2 + (#1 - #2)) - #3) - #4)) - #5) - #6)) - #7) + (#7 - #8))) - #9) + (#9 - #10))) - #11)) - #12)) Counter in file 0 52:17 -> 54:6, #13 -Counter in file 0 54:6 -> 54:7, ((#12 + ((#11 + (((#9 - #10) + ((((#7 - #8) + ((((#5 + #6) + ((((#3 + #4) + (((#2 + (#1 - #2)) - #3) - #4)) - #5) - #6)) - #7) + #8)) - #9) + #10)) - #11)) - #12)) - #13) -Counter in file 0 56:8 -> 56:15, (#13 + ((#12 + ((#11 + (((#9 - #10) + ((((#7 - #8) + ((((#5 + #6) + ((((#3 + #4) + (((#2 + (#1 - #2)) - #3) - #4)) - #5) - #6)) - #7) + #8)) - #9) + #10)) - #11)) - #12)) - #13)) +Counter in file 0 54:6 -> 54:7, ((#12 + ((#11 + ((#10 + (((#8 + ((((#5 + #6) + ((((#3 + #4) + (((#2 + (#1 - #2)) - #3) - #4)) - #5) - #6)) - #7) + (#7 - #8))) - #9) + (#9 - #10))) - #11)) - #12)) - #13) +Counter in file 0 56:8 -> 56:15, (#13 + ((#12 + ((#11 + ((#10 + (((#8 + ((((#5 + #6) + ((((#3 + #4) + (((#2 + (#1 - #2)) - #3) - #4)) - #5) - #6)) - #7) + (#7 - #8))) - #9) + (#9 - #10))) - #11)) - #12)) - #13)) Counter in file 0 56:16 -> 58:6, #14 -Counter in file 0 58:12 -> 60:6, ((#13 + ((#12 + ((#11 + (((#9 - #10) + ((((#7 - #8) + ((((#5 + #6) + ((((#3 + #4) + (((#2 + (#1 - #2)) - #3) - #4)) - #5) - #6)) - #7) + #8)) - #9) + #10)) - #11)) - #12)) - #13)) - #14) -Counter in file 0 61:1 -> 61:2, (#14 + ((#13 + ((#12 + ((#11 + (((#9 - #10) + ((((#7 - #8) + ((((#5 + #6) + ((((#3 + #4) + (((#2 + (#1 - #2)) - #3) - #4)) - #5) - #6)) - #7) + #8)) - #9) + #10)) - #11)) - #12)) - #13)) - #14)) +Counter in file 0 58:12 -> 60:6, ((#13 + ((#12 + ((#11 + ((#10 + (((#8 + ((((#5 + #6) + ((((#3 + #4) + (((#2 + (#1 - #2)) - #3) - #4)) - #5) - #6)) - #7) + (#7 - #8))) - #9) + (#9 - #10))) - #11)) - #12)) - #13)) - #14) +Counter in file 0 61:1 -> 61:2, (#14 + ((#13 + ((#12 + ((#11 + ((#10 + (((#8 + ((((#5 + #6) + ((((#3 + #4) + (((#2 + (#1 - #2)) - #3) - #4)) - #5) - #6)) - #7) + (#7 - #8))) - #9) + (#9 - #10))) - #11)) - #12)) - #13)) - #14)) Emitting segments for file: ../coverage/lazy_boolean.rs Combined regions: - 7:9 -> 9:42 (count=1) - 10:8 -> 10:15 (count=1) + 3:1 -> 10:15 (count=1) 10:16 -> 14:6 (count=1) 14:6 -> 14:7 (count=0) 16:9 -> 16:17 (count=1) 18:13 -> 18:18 (count=1) 20:13 -> 20:18 (count=0) - 20:18 -> 20:19 (count=1) 23:9 -> 23:17 (count=1) 25:13 -> 25:18 (count=1) 27:13 -> 27:18 (count=1) - 27:18 -> 27:19 (count=1) 29:9 -> 29:17 (count=1) 29:20 -> 29:25 (count=1) 29:29 -> 29:34 (count=1) - 29:34 -> 29:35 (count=1) 30:9 -> 30:17 (count=1) 30:20 -> 30:25 (count=1) 30:29 -> 30:34 (count=0) - 30:34 -> 30:35 (count=1) 33:9 -> 34:16 (count=1) 35:5 -> 38:6 (count=0) 38:6 -> 38:7 (count=1) @@ -70,9 +56,7 @@ Combined regions: 56:16 -> 58:6 (count=1) 58:12 -> 60:6 (count=0) 61:1 -> 61:2 (count=1) -Segment at 7:9 (count = 1), RegionEntry -Segment at 9:42 (count = 0), Skipped -Segment at 10:8 (count = 1), RegionEntry +Segment at 3:1 (count = 1), RegionEntry Segment at 10:15 (count = 0), Skipped Segment at 10:16 (count = 1), RegionEntry Segment at 14:6 (count = 0), RegionEntry @@ -82,29 +66,25 @@ Segment at 16:17 (count = 0), Skipped Segment at 18:13 (count = 1), RegionEntry Segment at 18:18 (count = 0), Skipped Segment at 20:13 (count = 0), RegionEntry -Segment at 20:18 (count = 1), RegionEntry -Segment at 20:19 (count = 0), Skipped +Segment at 20:18 (count = 0), Skipped Segment at 23:9 (count = 1), RegionEntry Segment at 23:17 (count = 0), Skipped Segment at 25:13 (count = 1), RegionEntry Segment at 25:18 (count = 0), Skipped Segment at 27:13 (count = 1), RegionEntry -Segment at 27:18 (count = 1), RegionEntry -Segment at 27:19 (count = 0), Skipped +Segment at 27:18 (count = 0), Skipped Segment at 29:9 (count = 1), RegionEntry Segment at 29:17 (count = 0), Skipped Segment at 29:20 (count = 1), RegionEntry Segment at 29:25 (count = 0), Skipped Segment at 29:29 (count = 1), RegionEntry -Segment at 29:34 (count = 1), RegionEntry -Segment at 29:35 (count = 0), Skipped +Segment at 29:34 (count = 0), Skipped Segment at 30:9 (count = 1), RegionEntry Segment at 30:17 (count = 0), Skipped Segment at 30:20 (count = 1), RegionEntry Segment at 30:25 (count = 0), Skipped Segment at 30:29 (count = 0), RegionEntry -Segment at 30:34 (count = 1), RegionEntry -Segment at 30:35 (count = 0), Skipped +Segment at 30:34 (count = 0), Skipped Segment at 33:9 (count = 1), RegionEntry Segment at 34:16 (count = 0), Skipped Segment at 35:5 (count = 0), RegionEntry diff --git a/src/test/run-make-fulldeps/coverage-reports-base/expected_show_coverage_counters.loop_break_value.txt b/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage_counters.loop_break_value.txt similarity index 53% rename from src/test/run-make-fulldeps/coverage-reports-base/expected_show_coverage_counters.loop_break_value.txt rename to src/test/run-make-fulldeps/coverage-reports/expected_show_coverage_counters.loop_break_value.txt index a6144b8072ace..17bd5c2ff3186 100644 --- a/src/test/run-make-fulldeps/coverage-reports-base/expected_show_coverage_counters.loop_break_value.txt +++ b/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage_counters.loop_break_value.txt @@ -1,6 +1,6 @@ -Counter in file 0 3:11 -> 13:2, #1 +Counter in file 0 3:1 -> 13:2, #1 Emitting segments for file: ../coverage/loop_break_value.rs Combined regions: - 3:11 -> 13:2 (count=1) -Segment at 3:11 (count = 1), RegionEntry + 3:1 -> 13:2 (count=1) +Segment at 3:1 (count = 1), RegionEntry Segment at 13:2 (count = 0), Skipped diff --git a/src/test/run-make-fulldeps/coverage-reports-base/expected_show_coverage_counters.loops_branches.txt b/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage_counters.loops_branches.txt similarity index 70% rename from src/test/run-make-fulldeps/coverage-reports-base/expected_show_coverage_counters.loops_branches.txt rename to src/test/run-make-fulldeps/coverage-reports/expected_show_coverage_counters.loops_branches.txt index d8af6998964cf..d1da50b1529e4 100644 --- a/src/test/run-make-fulldeps/coverage-reports-base/expected_show_coverage_counters.loops_branches.txt +++ b/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage_counters.loops_branches.txt @@ -1,24 +1,22 @@ -Counter in file 0 10:12 -> 10:16, #1 +Counter in file 0 9:5 -> 10:16, #1 Counter in file 0 11:16 -> 11:21, #2 Counter in file 0 14:14 -> 14:15, (#2 - #5) -Counter in file 0 15:13 -> 15:31, (0 + (#2 - #5)) +Counter in file 0 15:13 -> 15:31, ((0 - #6) + (#2 - #5)) Counter in file 0 15:31 -> 15:32, #4 -Counter in file 0 17:10 -> 17:11, #3 Counter in file 0 18:9 -> 18:15, (#3 + 0) Counter in file 0 19:5 -> 19:6, (#4 + (#3 + 0)) -Counter in file 0 22:11 -> 25:2, #1 +Counter in file 0 22:1 -> 25:2, #1 Emitting segments for file: ../coverage/loops_branches.rs Combined regions: - 10:12 -> 10:16 (count=1) + 9:5 -> 10:16 (count=1) 11:16 -> 11:21 (count=1) 14:14 -> 14:15 (count=1) 15:13 -> 15:31 (count=1) 15:31 -> 15:32 (count=0) - 17:10 -> 17:11 (count=1) 18:9 -> 18:15 (count=1) 19:5 -> 19:6 (count=1) - 22:11 -> 25:2 (count=1) -Segment at 10:12 (count = 1), RegionEntry + 22:1 -> 25:2 (count=1) +Segment at 9:5 (count = 1), RegionEntry Segment at 10:16 (count = 0), Skipped Segment at 11:16 (count = 1), RegionEntry Segment at 11:21 (count = 0), Skipped @@ -27,11 +25,9 @@ Segment at 14:15 (count = 0), Skipped Segment at 15:13 (count = 1), RegionEntry Segment at 15:31 (count = 0), RegionEntry Segment at 15:32 (count = 0), Skipped -Segment at 17:10 (count = 1), RegionEntry -Segment at 17:11 (count = 0), Skipped Segment at 18:9 (count = 1), RegionEntry Segment at 18:15 (count = 0), Skipped Segment at 19:5 (count = 1), RegionEntry Segment at 19:6 (count = 0), Skipped -Segment at 22:11 (count = 1), RegionEntry +Segment at 22:1 (count = 1), RegionEntry Segment at 25:2 (count = 0), Skipped diff --git a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage_counters.nested_loops.txt b/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage_counters.nested_loops.txt new file mode 100644 index 0000000000000..f30dd9e37164e --- /dev/null +++ b/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage_counters.nested_loops.txt @@ -0,0 +1,58 @@ +Counter in file 0 1:1 -> 3:27, #1 +Counter in file 0 5:19 -> 5:32, (#1 + (#2 + #3)) +Counter in file 0 6:13 -> 7:24, ((#1 + (#2 + #3)) - #4) +Counter in file 0 8:13 -> 8:14, ((((#1 + (#2 + #3)) - #4) + (#6 + #7)) - #3) +Counter in file 0 8:18 -> 8:23, (((#1 + (#2 + #3)) - #4) + (#6 + #7)) +Counter in file 0 9:16 -> 9:22, (((((#1 + (#2 + #3)) - #4) + (#6 + #7)) - #3) + 0) +Counter in file 0 10:17 -> 10:22, #2 +Counter in file 0 11:14 -> 14:22, (((((#1 + (#2 + #3)) - #4) + (#6 + #7)) - #3) - #2) +Counter in file 0 15:17 -> 16:27, ((((((#1 + (#2 + #3)) - #4) + (#6 + #7)) - #3) - #2) - #7) +Counter in file 0 17:21 -> 17:33, #5 +Counter in file 0 18:24 -> 20:18, #6 +Counter in file 0 21:14 -> 21:15, #7 +Counter in file 0 23:9 -> 23:23, (#2 + #3) +Counter in file 0 25:1 -> 25:2, (#5 + #4) +Emitting segments for file: ../coverage/nested_loops.rs +Combined regions: + 1:1 -> 3:27 (count=1) + 5:19 -> 5:32 (count=1) + 6:13 -> 7:24 (count=1) + 8:13 -> 8:14 (count=3) + 8:18 -> 8:23 (count=3) + 9:16 -> 9:22 (count=3) + 10:17 -> 10:22 (count=0) + 11:14 -> 14:22 (count=3) + 15:17 -> 16:27 (count=1) + 17:21 -> 17:33 (count=1) + 18:24 -> 20:18 (count=0) + 21:14 -> 21:15 (count=2) + 23:9 -> 23:23 (count=0) + 25:1 -> 25:2 (count=1) +Segment at 1:1 (count = 1), RegionEntry +Segment at 3:27 (count = 0), Skipped +Segment at 5:19 (count = 1), RegionEntry +Segment at 5:32 (count = 0), Skipped +Segment at 6:13 (count = 1), RegionEntry +Segment at 7:24 (count = 0), Skipped +Segment at 8:13 (count = 3), RegionEntry +Segment at 8:14 (count = 0), Skipped +Segment at 8:18 (count = 3), RegionEntry +Segment at 8:23 (count = 0), Skipped +Segment at 9:16 (count = 3), RegionEntry +Segment at 9:22 (count = 0), Skipped +Segment at 10:17 (count = 0), RegionEntry +Segment at 10:22 (count = 0), Skipped +Segment at 11:14 (count = 3), RegionEntry +Segment at 14:22 (count = 0), Skipped +Segment at 15:17 (count = 1), RegionEntry +Segment at 16:27 (count = 0), Skipped +Segment at 17:21 (count = 1), RegionEntry +Segment at 17:33 (count = 0), Skipped +Segment at 18:24 (count = 0), RegionEntry +Segment at 20:18 (count = 0), Skipped +Segment at 21:14 (count = 2), RegionEntry +Segment at 21:15 (count = 0), Skipped +Segment at 23:9 (count = 0), RegionEntry +Segment at 23:23 (count = 0), Skipped +Segment at 25:1 (count = 1), RegionEntry +Segment at 25:2 (count = 0), Skipped diff --git a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage_counters.overflow.txt b/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage_counters.overflow.txt new file mode 100644 index 0000000000000..fbc3adbfb6d70 --- /dev/null +++ b/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage_counters.overflow.txt @@ -0,0 +1,52 @@ +Counter in file 0 15:1 -> 16:27, #1 +Counter in file 0 17:11 -> 17:24, (#1 + (#2 + (#3 + #4))) +Counter in file 0 18:12 -> 18:26, ((#1 + (#2 + (#3 + #4))) - #5) +Counter in file 0 18:27 -> 21:10, #2 +Counter in file 0 21:19 -> 21:32, (((#1 + (#2 + (#3 + #4))) - #5) - #2) +Counter in file 0 21:33 -> 24:10, #3 +Counter in file 0 24:10 -> 24:11, #4 +Counter in file 0 25:9 -> 25:23, (#2 + (#3 + #4)) +Counter in file 0 27:5 -> 28:2, #5 +Counter in file 0 4:1 -> 5:18, #1 +Counter in file 0 5:19 -> 7:6, #2 +Counter in file 0 7:6 -> 7:7, (#1 - #2) +Counter in file 0 8:9 -> 13:2, (#2 + (#1 - #2)) +Emitting segments for file: ../coverage/overflow.rs +Combined regions: + 4:1 -> 5:18 (count=4) + 5:19 -> 7:6 (count=1) + 7:6 -> 7:7 (count=3) + 8:9 -> 13:2 (count=4) + 15:1 -> 16:27 (count=1) + 17:11 -> 17:24 (count=10) + 18:12 -> 18:26 (count=10) + 18:27 -> 21:10 (count=0) + 21:19 -> 21:32 (count=10) + 21:33 -> 24:10 (count=3) + 24:10 -> 24:11 (count=6) + 25:9 -> 25:23 (count=9) + 27:5 -> 28:2 (count=0) +Segment at 4:1 (count = 4), RegionEntry +Segment at 5:18 (count = 0), Skipped +Segment at 5:19 (count = 1), RegionEntry +Segment at 7:6 (count = 3), RegionEntry +Segment at 7:7 (count = 0), Skipped +Segment at 8:9 (count = 4), RegionEntry +Segment at 13:2 (count = 0), Skipped +Segment at 15:1 (count = 1), RegionEntry +Segment at 16:27 (count = 0), Skipped +Segment at 17:11 (count = 10), RegionEntry +Segment at 17:24 (count = 0), Skipped +Segment at 18:12 (count = 10), RegionEntry +Segment at 18:26 (count = 0), Skipped +Segment at 18:27 (count = 0), RegionEntry +Segment at 21:10 (count = 0), Skipped +Segment at 21:19 (count = 10), RegionEntry +Segment at 21:32 (count = 0), Skipped +Segment at 21:33 (count = 3), RegionEntry +Segment at 24:10 (count = 6), RegionEntry +Segment at 24:11 (count = 0), Skipped +Segment at 25:9 (count = 9), RegionEntry +Segment at 25:23 (count = 0), Skipped +Segment at 27:5 (count = 0), RegionEntry +Segment at 28:2 (count = 0), Skipped diff --git a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage_counters.panic_unwind.txt b/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage_counters.panic_unwind.txt new file mode 100644 index 0000000000000..ad87f03026d38 --- /dev/null +++ b/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage_counters.panic_unwind.txt @@ -0,0 +1,53 @@ +Counter in file 0 13:1 -> 14:27, #1 +Counter in file 0 15:11 -> 15:24, (#1 + (#2 + (#3 + #4))) +Counter in file 0 16:12 -> 16:26, ((#1 + (#2 + (#3 + #4))) - #5) +Counter in file 0 16:27 -> 18:10, #2 +Counter in file 0 18:19 -> 18:32, (((#1 + (#2 + (#3 + #4))) - #5) - #2) +Counter in file 0 18:33 -> 20:10, #3 +Counter in file 0 20:10 -> 20:11, #4 +Counter in file 0 21:9 -> 21:23, (#2 + (#3 + #4)) +Counter in file 0 23:5 -> 24:2, #5 +Counter in file 0 4:1 -> 4:36, #1 +Counter in file 0 5:8 -> 5:20, (#1 + 0) +Counter in file 0 6:9 -> 7:26, #2 +Counter in file 0 8:12 -> 11:2, (#1 - #2) +Emitting segments for file: ../coverage/panic_unwind.rs +Combined regions: + 4:1 -> 4:36 (count=4) + 5:8 -> 5:20 (count=4) + 6:9 -> 7:26 (count=1) + 8:12 -> 11:2 (count=3) + 13:1 -> 14:27 (count=1) + 15:11 -> 15:24 (count=10) + 16:12 -> 16:26 (count=10) + 16:27 -> 18:10 (count=0) + 18:19 -> 18:32 (count=10) + 18:33 -> 20:10 (count=3) + 20:10 -> 20:11 (count=6) + 21:9 -> 21:23 (count=9) + 23:5 -> 24:2 (count=0) +Segment at 4:1 (count = 4), RegionEntry +Segment at 4:36 (count = 0), Skipped +Segment at 5:8 (count = 4), RegionEntry +Segment at 5:20 (count = 0), Skipped +Segment at 6:9 (count = 1), RegionEntry +Segment at 7:26 (count = 0), Skipped +Segment at 8:12 (count = 3), RegionEntry +Segment at 11:2 (count = 0), Skipped +Segment at 13:1 (count = 1), RegionEntry +Segment at 14:27 (count = 0), Skipped +Segment at 15:11 (count = 10), RegionEntry +Segment at 15:24 (count = 0), Skipped +Segment at 16:12 (count = 10), RegionEntry +Segment at 16:26 (count = 0), Skipped +Segment at 16:27 (count = 0), RegionEntry +Segment at 18:10 (count = 0), Skipped +Segment at 18:19 (count = 10), RegionEntry +Segment at 18:32 (count = 0), Skipped +Segment at 18:33 (count = 3), RegionEntry +Segment at 20:10 (count = 6), RegionEntry +Segment at 20:11 (count = 0), Skipped +Segment at 21:9 (count = 9), RegionEntry +Segment at 21:23 (count = 0), Skipped +Segment at 23:5 (count = 0), RegionEntry +Segment at 24:2 (count = 0), Skipped diff --git a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage_counters.partial_eq.txt b/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage_counters.partial_eq.txt new file mode 100644 index 0000000000000..fa5c12bb6f8e0 --- /dev/null +++ b/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage_counters.partial_eq.txt @@ -0,0 +1,66 @@ +Counter in file 0 4:10 -> 4:15, 0 +Counter in file 0 4:24 -> 4:25, 0 +Counter in file 0 4:24 -> 4:25, 0 +Counter in file 0 4:32 -> 4:33, 0 +Counter in file 0 4:32 -> 4:33, 0 +Counter in file 0 4:35 -> 4:36, 0 +Counter in file 0 4:39 -> 4:40, 0 +Counter in file 0 4:39 -> 4:40, 0 +Counter in file 0 4:39 -> 4:40, 0 +Counter in file 0 4:39 -> 4:40, 0 +Counter in file 0 4:48 -> 4:49, 0 +Counter in file 0 4:51 -> 4:52, 0 +Counter in file 0 4:53 -> 4:54, 0 +Counter in file 0 7:5 -> 7:6, #1 +Counter in file 0 7:5 -> 7:6, 0 +Counter in file 0 7:5 -> 7:6, 0 +Counter in file 0 7:5 -> 7:6, 0 +Counter in file 0 8:5 -> 8:17, 0 +Counter in file 0 8:5 -> 8:17, 0 +Counter in file 0 8:5 -> 8:17, 0 +Counter in file 0 21:1 -> 26:2, #1 +Counter in file 0 4:17 -> 4:22, #1 +Counter in file 0 12:5 -> 18:6, #1 +Counter in file 0 4:39 -> 4:40, #1 +Counter in file 0 8:5 -> 8:17, #1 +Emitting segments for file: ../coverage/partial_eq.rs +Combined regions: + 4:10 -> 4:15 (count=0) + 4:17 -> 4:22 (count=2) + 4:24 -> 4:25 (count=0) + 4:32 -> 4:33 (count=0) + 4:35 -> 4:36 (count=0) + 4:39 -> 4:40 (count=1) + 4:48 -> 4:49 (count=0) + 4:51 -> 4:52 (count=0) + 4:53 -> 4:54 (count=0) + 7:5 -> 7:6 (count=1) + 8:5 -> 8:17 (count=0) + 12:5 -> 18:6 (count=2) + 21:1 -> 26:2 (count=1) +Segment at 4:10 (count = 0), RegionEntry +Segment at 4:15 (count = 0), Skipped +Segment at 4:17 (count = 2), RegionEntry +Segment at 4:22 (count = 0), Skipped +Segment at 4:24 (count = 0), RegionEntry +Segment at 4:25 (count = 0), Skipped +Segment at 4:32 (count = 0), RegionEntry +Segment at 4:33 (count = 0), Skipped +Segment at 4:35 (count = 0), RegionEntry +Segment at 4:36 (count = 0), Skipped +Segment at 4:39 (count = 1), RegionEntry +Segment at 4:40 (count = 0), Skipped +Segment at 4:48 (count = 0), RegionEntry +Segment at 4:49 (count = 0), Skipped +Segment at 4:51 (count = 0), RegionEntry +Segment at 4:52 (count = 0), Skipped +Segment at 4:53 (count = 0), RegionEntry +Segment at 4:54 (count = 0), Skipped +Segment at 7:5 (count = 1), RegionEntry +Segment at 7:6 (count = 0), Skipped +Segment at 8:5 (count = 0), RegionEntry +Segment at 8:17 (count = 0), Skipped +Segment at 12:5 (count = 2), RegionEntry +Segment at 18:6 (count = 0), Skipped +Segment at 21:1 (count = 1), RegionEntry +Segment at 26:2 (count = 0), Skipped diff --git a/src/test/run-make-fulldeps/coverage-reports-base/expected_show_coverage_counters.simple_loop.txt b/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage_counters.simple_loop.txt similarity index 57% rename from src/test/run-make-fulldeps/coverage-reports-base/expected_show_coverage_counters.simple_loop.txt rename to src/test/run-make-fulldeps/coverage-reports/expected_show_coverage_counters.simple_loop.txt index 255173e5534d1..c0b09486dfba4 100644 --- a/src/test/run-make-fulldeps/coverage-reports-base/expected_show_coverage_counters.simple_loop.txt +++ b/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage_counters.simple_loop.txt @@ -1,26 +1,20 @@ -Counter in file 0 7:9 -> 9:26, #1 -Counter in file 0 12:9 -> 12:16, (#1 + 0) +Counter in file 0 3:1 -> 12:16, #1 Counter in file 0 13:5 -> 18:6, #2 Counter in file 0 18:6 -> 18:7, (#1 - #2) Counter in file 0 23:13 -> 25:14, ((#2 + (#1 - #2)) + #3) -Counter in file 0 27:13 -> 27:18, #4 -Counter in file 0 30:9 -> 32:10, #3 -Counter in file 0 34:6 -> 34:7, (#2 + (#1 - #2)) -Counter in file 0 35:1 -> 35:2, (#4 + 0) +Counter in file 0 27:13 -> 27:18, (((#2 + (#1 - #2)) + #3) - #3) +Counter in file 0 29:10 -> 32:10, #3 +Counter in file 0 35:1 -> 35:2, ((((#2 + (#1 - #2)) + #3) - #3) + 0) Emitting segments for file: ../coverage/simple_loop.rs Combined regions: - 7:9 -> 9:26 (count=1) - 12:9 -> 12:16 (count=1) + 3:1 -> 12:16 (count=1) 13:5 -> 18:6 (count=1) 18:6 -> 18:7 (count=0) 23:13 -> 25:14 (count=11) 27:13 -> 27:18 (count=1) - 30:9 -> 32:10 (count=10) - 34:6 -> 34:7 (count=1) + 29:10 -> 32:10 (count=10) 35:1 -> 35:2 (count=1) -Segment at 7:9 (count = 1), RegionEntry -Segment at 9:26 (count = 0), Skipped -Segment at 12:9 (count = 1), RegionEntry +Segment at 3:1 (count = 1), RegionEntry Segment at 12:16 (count = 0), Skipped Segment at 13:5 (count = 1), RegionEntry Segment at 18:6 (count = 0), RegionEntry @@ -29,9 +23,7 @@ Segment at 23:13 (count = 11), RegionEntry Segment at 25:14 (count = 0), Skipped Segment at 27:13 (count = 1), RegionEntry Segment at 27:18 (count = 0), Skipped -Segment at 30:9 (count = 10), RegionEntry +Segment at 29:10 (count = 10), RegionEntry Segment at 32:10 (count = 0), Skipped -Segment at 34:6 (count = 1), RegionEntry -Segment at 34:7 (count = 0), Skipped Segment at 35:1 (count = 1), RegionEntry Segment at 35:2 (count = 0), Skipped diff --git a/src/test/run-make-fulldeps/coverage-reports-base/expected_show_coverage_counters.simple_match.txt b/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage_counters.simple_match.txt similarity index 72% rename from src/test/run-make-fulldeps/coverage-reports-base/expected_show_coverage_counters.simple_match.txt rename to src/test/run-make-fulldeps/coverage-reports/expected_show_coverage_counters.simple_match.txt index 1682a379bc0ff..c01630bd87bc9 100644 --- a/src/test/run-make-fulldeps/coverage-reports-base/expected_show_coverage_counters.simple_match.txt +++ b/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage_counters.simple_match.txt @@ -1,5 +1,4 @@ -Counter in file 0 7:9 -> 9:26, #1 -Counter in file 0 10:8 -> 10:15, (#1 + 0) +Counter in file 0 3:1 -> 10:15, #1 Counter in file 0 10:16 -> 12:6, #2 Counter in file 0 12:6 -> 12:7, (#1 - #2) Counter in file 0 15:9 -> 15:10, (((#2 + (#1 - #2)) + (#3 + #4)) - #5) @@ -7,16 +6,12 @@ Counter in file 0 17:9 -> 17:13, ((#2 + (#1 - #2)) + (#3 + #4)) Counter in file 0 22:13 -> 22:22, ((((#2 + (#1 - #2)) + (#3 + #4)) - #5) + 0) Counter in file 0 24:13 -> 24:14, #3 Counter in file 0 26:17 -> 28:18, ((((#2 + (#1 - #2)) + (#3 + #4)) - #5) + 0) -Counter in file 0 28:18 -> 28:19, ((((#2 + (#1 - #2)) + (#3 + #4)) - #5) - #3) Counter in file 0 30:13 -> 37:14, (#3 + 0) Counter in file 0 40:13 -> 40:15, #4 -Counter in file 0 42:6 -> 42:7, (#2 + (#1 - #2)) -Counter in file 0 42:6 -> 42:7, (#3 + #4) Counter in file 0 43:1 -> 43:2, #5 Emitting segments for file: ../coverage/simple_match.rs Combined regions: - 7:9 -> 9:26 (count=1) - 10:8 -> 10:15 (count=1) + 3:1 -> 10:15 (count=1) 10:16 -> 12:6 (count=1) 12:6 -> 12:7 (count=0) 15:9 -> 15:10 (count=2) @@ -24,14 +19,10 @@ Combined regions: 22:13 -> 22:22 (count=2) 24:13 -> 24:14 (count=1) 26:17 -> 28:18 (count=2) - 28:18 -> 28:19 (count=1) 30:13 -> 37:14 (count=1) 40:13 -> 40:15 (count=1) - 42:6 -> 42:7 (count=3) 43:1 -> 43:2 (count=1) -Segment at 7:9 (count = 1), RegionEntry -Segment at 9:26 (count = 0), Skipped -Segment at 10:8 (count = 1), RegionEntry +Segment at 3:1 (count = 1), RegionEntry Segment at 10:15 (count = 0), Skipped Segment at 10:16 (count = 1), RegionEntry Segment at 12:6 (count = 0), RegionEntry @@ -45,13 +36,10 @@ Segment at 22:22 (count = 0), Skipped Segment at 24:13 (count = 1), RegionEntry Segment at 24:14 (count = 0), Skipped Segment at 26:17 (count = 2), RegionEntry -Segment at 28:18 (count = 1), RegionEntry -Segment at 28:19 (count = 0), Skipped +Segment at 28:18 (count = 0), Skipped Segment at 30:13 (count = 1), RegionEntry Segment at 37:14 (count = 0), Skipped Segment at 40:13 (count = 1), RegionEntry Segment at 40:15 (count = 0), Skipped -Segment at 42:6 (count = 3), RegionEntry -Segment at 42:7 (count = 0), Skipped Segment at 43:1 (count = 1), RegionEntry Segment at 43:2 (count = 0), Skipped diff --git a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage_counters.tight_inf_loop.txt b/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage_counters.tight_inf_loop.txt new file mode 100644 index 0000000000000..a6cd429880856 --- /dev/null +++ b/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage_counters.tight_inf_loop.txt @@ -0,0 +1,10 @@ +Counter in file 0 1:1 -> 2:13, #1 +Counter in file 0 4:6 -> 5:2, (#1 - #2) +Emitting segments for file: ../coverage/tight_inf_loop.rs +Combined regions: + 1:1 -> 2:13 (count=1) + 4:6 -> 5:2 (count=1) +Segment at 1:1 (count = 1), RegionEntry +Segment at 2:13 (count = 0), Skipped +Segment at 4:6 (count = 1), RegionEntry +Segment at 5:2 (count = 0), Skipped diff --git a/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_show_coverage_counters.try_error_result.txt b/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage_counters.try_error_result.txt similarity index 73% rename from src/test/run-make-fulldeps/coverage-reports-deadcode/expected_show_coverage_counters.try_error_result.txt rename to src/test/run-make-fulldeps/coverage-reports/expected_show_coverage_counters.try_error_result.txt index a317cd792910d..2b7962df2f9f9 100644 --- a/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_show_coverage_counters.try_error_result.txt +++ b/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage_counters.try_error_result.txt @@ -1,29 +1,26 @@ -Counter in file 0 13:9 -> 14:23, #1 +Counter in file 0 12:1 -> 14:23, #1 Counter in file 0 17:9 -> 17:10, ((#1 + (#2 + #3)) - #4) Counter in file 0 19:9 -> 19:14, (#1 + (#2 + #3)) -Counter in file 0 21:9 -> 25:26, #8 -Counter in file 0 27:13 -> 27:41, #9 +Counter in file 0 21:9 -> 25:26, (((#1 + (#2 + #3)) - #4) + 0) +Counter in file 0 27:13 -> 27:41, #8 Counter in file 0 27:41 -> 27:42, #5 -Counter in file 0 28:13 -> 28:42, (#9 - #5) +Counter in file 0 28:13 -> 28:42, (#8 - #5) Counter in file 0 28:42 -> 28:43, #6 -Counter in file 0 32:13 -> 32:42, (#8 - #9) +Counter in file 0 32:13 -> 32:42, (((#1 + (#2 + #3)) - #4) - #8) Counter in file 0 32:42 -> 32:43, #7 -Counter in file 0 33:10 -> 33:11, #2 -Counter in file 0 33:10 -> 33:11, #3 -Counter in file 0 34:6 -> 34:7, (#2 + #3) Counter in file 0 35:5 -> 35:11, #4 Counter in file 0 36:1 -> 36:2, ((#5 + (#6 + #7)) + #4) -Counter in file 0 5:8 -> 5:20, #1 +Counter in file 0 4:1 -> 5:20, #1 Counter in file 0 6:9 -> 6:16, #2 Counter in file 0 8:9 -> 8:15, (#1 - #2) Counter in file 0 10:1 -> 10:2, (#2 + (#1 - #2)) Emitting segments for file: ../coverage/try_error_result.rs Combined regions: - 5:8 -> 5:20 (count=6) + 4:1 -> 5:20 (count=6) 6:9 -> 6:16 (count=1) 8:9 -> 8:15 (count=5) 10:1 -> 10:2 (count=6) - 13:9 -> 14:23 (count=1) + 12:1 -> 14:23 (count=1) 17:9 -> 17:10 (count=6) 19:9 -> 19:14 (count=6) 21:9 -> 25:26 (count=6) @@ -33,11 +30,9 @@ Combined regions: 28:42 -> 28:43 (count=0) 32:13 -> 32:42 (count=5) 32:42 -> 32:43 (count=0) - 33:10 -> 33:11 (count=5) - 34:6 -> 34:7 (count=5) 35:5 -> 35:11 (count=0) 36:1 -> 36:2 (count=1) -Segment at 5:8 (count = 6), RegionEntry +Segment at 4:1 (count = 6), RegionEntry Segment at 5:20 (count = 0), Skipped Segment at 6:9 (count = 1), RegionEntry Segment at 6:16 (count = 0), Skipped @@ -45,7 +40,7 @@ Segment at 8:9 (count = 5), RegionEntry Segment at 8:15 (count = 0), Skipped Segment at 10:1 (count = 6), RegionEntry Segment at 10:2 (count = 0), Skipped -Segment at 13:9 (count = 1), RegionEntry +Segment at 12:1 (count = 1), RegionEntry Segment at 14:23 (count = 0), Skipped Segment at 17:9 (count = 6), RegionEntry Segment at 17:10 (count = 0), Skipped @@ -62,10 +57,6 @@ Segment at 28:43 (count = 0), Skipped Segment at 32:13 (count = 5), RegionEntry Segment at 32:42 (count = 0), RegionEntry Segment at 32:43 (count = 0), Skipped -Segment at 33:10 (count = 5), RegionEntry -Segment at 33:11 (count = 0), Skipped -Segment at 34:6 (count = 5), RegionEntry -Segment at 34:7 (count = 0), Skipped Segment at 35:5 (count = 0), RegionEntry Segment at 35:11 (count = 0), Skipped Segment at 36:1 (count = 1), RegionEntry diff --git a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage_counters.uses_crate.txt b/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage_counters.uses_crate.txt new file mode 100644 index 0000000000000..b0319cd9e1896 --- /dev/null +++ b/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage_counters.uses_crate.txt @@ -0,0 +1,110 @@ +Counter in file 0 17:1 -> 19:2, #1 +Counter in file 0 25:1 -> 27:2, #1 +Counter in file 0 17:1 -> 19:2, #1 +Counter in file 0 5:1 -> 12:2, #1 +Counter in file 0 17:1 -> 19:2, 0 +Counter in file 0 33:1 -> 35:2, 0 +Counter in file 0 45:1 -> 48:16, 0 +Counter in file 0 48:17 -> 50:6, 0 +Counter in file 0 50:6 -> 50:7, 0 +Counter in file 0 51:1 -> 51:2, 0 +Counter in file 0 53:1 -> 61:2, #1 +Counter in file 0 25:1 -> 27:2, #1 +Counter in file 0 29:1 -> 31:2, #1 +Counter in file 0 21:1 -> 23:2, #1 +Counter in file 0 5:1 -> 5:24, #1 +Counter in file 0 9:9 -> 11:15, (#1 + 0) +Counter in file 0 11:16 -> 13:6, #2 +Counter in file 0 13:6 -> 13:7, (#1 - #2) +Counter in file 0 14:5 -> 15:2, (#2 + (#1 - #2)) +Counter in file 0 21:1 -> 23:2, #1 +Counter in file 0 37:1 -> 40:16, #1 +Counter in file 0 40:17 -> 42:6, #2 +Counter in file 0 42:6 -> 42:7, (#1 - #2) +Counter in file 0 43:1 -> 43:2, (#2 + (#1 - #2)) +Emitting segments for file: ../coverage/lib/used_crate.rs +Combined regions: + 5:1 -> 5:24 (count=1) + 9:9 -> 11:15 (count=1) + 11:16 -> 13:6 (count=1) + 13:6 -> 13:7 (count=0) + 14:5 -> 15:2 (count=1) + 17:1 -> 19:2 (count=2) + 21:1 -> 23:2 (count=2) + 25:1 -> 27:2 (count=2) + 29:1 -> 31:2 (count=2) + 33:1 -> 35:2 (count=0) + 37:1 -> 40:16 (count=0) + 40:17 -> 42:6 (count=0) + 42:6 -> 42:7 (count=0) + 43:1 -> 43:2 (count=0) + 45:1 -> 48:16 (count=0) + 48:17 -> 50:6 (count=0) + 50:6 -> 50:7 (count=0) + 51:1 -> 51:2 (count=0) + 53:1 -> 61:2 (count=1) +Segment at 5:1 (count = 1), RegionEntry +Segment at 5:24 (count = 0), Skipped +Segment at 9:9 (count = 1), RegionEntry +Segment at 11:15 (count = 0), Skipped +Segment at 11:16 (count = 1), RegionEntry +Segment at 13:6 (count = 0), RegionEntry +Segment at 13:7 (count = 0), Skipped +Segment at 14:5 (count = 1), RegionEntry +Segment at 15:2 (count = 0), Skipped +Segment at 17:1 (count = 2), RegionEntry +Segment at 19:2 (count = 0), Skipped +Segment at 21:1 (count = 2), RegionEntry +Segment at 23:2 (count = 0), Skipped +Segment at 25:1 (count = 2), RegionEntry +Segment at 27:2 (count = 0), Skipped +Segment at 29:1 (count = 2), RegionEntry +Segment at 31:2 (count = 0), Skipped +Segment at 33:1 (count = 0), RegionEntry +Segment at 35:2 (count = 0), Skipped +Segment at 37:1 (count = 0), RegionEntry +Segment at 40:16 (count = 0), Skipped +Segment at 40:17 (count = 0), RegionEntry +Segment at 42:6 (count = 0), RegionEntry +Segment at 42:7 (count = 0), Skipped +Segment at 43:1 (count = 0), RegionEntry +Segment at 43:2 (count = 0), Skipped +Segment at 45:1 (count = 0), RegionEntry +Segment at 48:16 (count = 0), Skipped +Segment at 48:17 (count = 0), RegionEntry +Segment at 50:6 (count = 0), RegionEntry +Segment at 50:7 (count = 0), Skipped +Segment at 51:1 (count = 0), RegionEntry +Segment at 51:2 (count = 0), Skipped +Segment at 53:1 (count = 1), RegionEntry +Segment at 61:2 (count = 0), Skipped +Emitting segments for function: _RINvCsbDqzXfLQacH_10used_crate41used_only_from_bin_crate_generic_functionReECs4fqI2P2rA04_10uses_crate +Combined regions: + 17:1 -> 19:2 (count=1) +Segment at 17:1 (count = 1), RegionEntry +Segment at 19:2 (count = 0), Skipped +Emitting segments for function: _RINvCsbDqzXfLQacH_10used_crate41used_only_from_bin_crate_generic_functionRINtNtCs3QflaznQylx_5alloc3vec3VeclEECs4fqI2P2rA04_10uses_crate +Combined regions: + 17:1 -> 19:2 (count=1) +Segment at 17:1 (count = 1), RegionEntry +Segment at 19:2 (count = 0), Skipped +Emitting segments for function: _RINvCsbDqzXfLQacH_10used_crate46used_only_from_this_lib_crate_generic_functionINtNtCs3QflaznQylx_5alloc3vec3VeclEEB2_ +Combined regions: + 21:1 -> 23:2 (count=1) +Segment at 21:1 (count = 1), RegionEntry +Segment at 23:2 (count = 0), Skipped +Emitting segments for function: _RINvCsbDqzXfLQacH_10used_crate46used_only_from_this_lib_crate_generic_functionReEB2_ +Combined regions: + 21:1 -> 23:2 (count=1) +Segment at 21:1 (count = 1), RegionEntry +Segment at 23:2 (count = 0), Skipped +Emitting segments for function: _RINvCsbDqzXfLQacH_10used_crate50used_from_bin_crate_and_lib_crate_generic_functionINtNtCs3QflaznQylx_5alloc3vec3VeclEECs4fqI2P2rA04_10uses_crate +Combined regions: + 25:1 -> 27:2 (count=1) +Segment at 25:1 (count = 1), RegionEntry +Segment at 27:2 (count = 0), Skipped +Emitting segments for function: _RINvCsbDqzXfLQacH_10used_crate50used_from_bin_crate_and_lib_crate_generic_functionReEB2_ +Combined regions: + 25:1 -> 27:2 (count=1) +Segment at 25:1 (count = 1), RegionEntry +Segment at 27:2 (count = 0), Skipped diff --git a/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_show_coverage_counters.while.txt b/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage_counters.while.txt similarity index 84% rename from src/test/run-make-fulldeps/coverage-reports-deadcode/expected_show_coverage_counters.while.txt rename to src/test/run-make-fulldeps/coverage-reports/expected_show_coverage_counters.while.txt index b0e881da7c8cb..90629ac84cdf6 100644 --- a/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_show_coverage_counters.while.txt +++ b/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage_counters.while.txt @@ -1,14 +1,14 @@ -Counter in file 0 2:9 -> 2:16, #1 +Counter in file 0 1:1 -> 2:16, #1 Counter in file 0 3:11 -> 3:20, (#1 + #2) Counter in file 0 3:21 -> 4:6, #2 Counter in file 0 5:1 -> 5:2, ((#1 + #2) - #2) Emitting segments for file: ../coverage/while.rs Combined regions: - 2:9 -> 2:16 (count=1) + 1:1 -> 2:16 (count=1) 3:11 -> 3:20 (count=1) 3:21 -> 4:6 (count=0) 5:1 -> 5:2 (count=1) -Segment at 2:9 (count = 1), RegionEntry +Segment at 1:1 (count = 1), RegionEntry Segment at 2:16 (count = 0), Skipped Segment at 3:11 (count = 1), RegionEntry Segment at 3:20 (count = 0), Skipped diff --git a/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_show_coverage_counters.while_early_ret.txt b/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage_counters.while_early_ret.txt similarity index 81% rename from src/test/run-make-fulldeps/coverage-reports-deadcode/expected_show_coverage_counters.while_early_ret.txt rename to src/test/run-make-fulldeps/coverage-reports/expected_show_coverage_counters.while_early_ret.txt index f541baec50c0b..12f444945a18a 100644 --- a/src/test/run-make-fulldeps/coverage-reports-deadcode/expected_show_coverage_counters.while_early_ret.txt +++ b/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage_counters.while_early_ret.txt @@ -1,24 +1,24 @@ -Counter in file 0 5:9 -> 5:27, #1 +Counter in file 0 4:1 -> 5:27, #1 Counter in file 0 7:9 -> 9:10, (#1 + #2) Counter in file 0 12:13 -> 14:14, ((#1 + #2) - #3) -Counter in file 0 18:21 -> 20:22, #6 +Counter in file 0 18:21 -> 20:22, (((#1 + #2) - #3) - #2) Counter in file 0 22:21 -> 22:27, #4 Counter in file 0 26:21 -> 26:27, #5 -Counter in file 0 30:9 -> 32:10, #2 +Counter in file 0 29:10 -> 32:10, #2 Counter in file 0 35:5 -> 35:11, #3 Counter in file 0 36:1 -> 36:2, ((#4 + #5) + #3) Emitting segments for file: ../coverage/while_early_ret.rs Combined regions: - 5:9 -> 5:27 (count=1) + 4:1 -> 5:27 (count=1) 7:9 -> 9:10 (count=7) 12:13 -> 14:14 (count=7) 18:21 -> 20:22 (count=1) 22:21 -> 22:27 (count=0) 26:21 -> 26:27 (count=1) - 30:9 -> 32:10 (count=6) + 29:10 -> 32:10 (count=6) 35:5 -> 35:11 (count=0) 36:1 -> 36:2 (count=1) -Segment at 5:9 (count = 1), RegionEntry +Segment at 4:1 (count = 1), RegionEntry Segment at 5:27 (count = 0), Skipped Segment at 7:9 (count = 7), RegionEntry Segment at 9:10 (count = 0), Skipped @@ -30,7 +30,7 @@ Segment at 22:21 (count = 0), RegionEntry Segment at 22:27 (count = 0), Skipped Segment at 26:21 (count = 1), RegionEntry Segment at 26:27 (count = 0), Skipped -Segment at 30:9 (count = 6), RegionEntry +Segment at 29:10 (count = 6), RegionEntry Segment at 32:10 (count = 0), Skipped Segment at 35:5 (count = 0), RegionEntry Segment at 35:11 (count = 0), Skipped diff --git a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage_counters.yield.txt b/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage_counters.yield.txt new file mode 100644 index 0000000000000..6ed3e465611e9 --- /dev/null +++ b/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage_counters.yield.txt @@ -0,0 +1,94 @@ +Counter in file 0 7:1 -> 7:11, #1 +Counter in file 0 8:9 -> 8:22, (#1 + 0) +Counter in file 0 13:11 -> 14:35, (#1 + 0) +Counter in file 0 14:39 -> 14:41, #4 +Counter in file 0 15:14 -> 15:52, (#2 + #3) +Counter in file 0 17:11 -> 17:46, (#4 + 0) +Counter in file 0 18:34 -> 18:39, (#4 - #5) +Counter in file 0 18:44 -> 18:46, ((#4 - #5) - #6) +Counter in file 0 19:14 -> 19:52, (#5 + #6) +Counter in file 0 22:9 -> 22:22, (((#4 - #5) - #6) + 0) +Counter in file 0 29:11 -> 30:35, (((#4 - #5) - #6) + 0) +Counter in file 0 30:39 -> 30:41, #9 +Counter in file 0 31:14 -> 31:52, (#7 + #8) +Counter in file 0 33:11 -> 34:35, (#9 + 0) +Counter in file 0 34:39 -> 34:41, #12 +Counter in file 0 35:14 -> 35:52, (#10 + #11) +Counter in file 0 37:1 -> 37:2, (#12 + 0) +Counter in file 0 8:28 -> 9:16, #1 +Counter in file 0 10:16 -> 11:6, #2 +Counter in file 0 22:28 -> 23:16, #1 +Counter in file 0 24:9 -> 24:16, #2 +Counter in file 0 25:9 -> 25:16, #3 +Counter in file 0 26:16 -> 27:6, #4 +Emitting segments for file: ../coverage/yield.rs +Combined regions: + 7:1 -> 7:11 (count=1) + 8:9 -> 8:22 (count=1) + 8:28 -> 9:16 (count=1) + 10:16 -> 11:6 (count=1) + 13:11 -> 14:35 (count=1) + 14:39 -> 14:41 (count=1) + 15:14 -> 15:52 (count=0) + 17:11 -> 17:46 (count=1) + 18:34 -> 18:39 (count=1) + 18:44 -> 18:46 (count=1) + 19:14 -> 19:52 (count=0) + 22:9 -> 22:22 (count=1) + 22:28 -> 23:16 (count=1) + 24:9 -> 24:16 (count=1) + 25:9 -> 25:16 (count=0) + 26:16 -> 27:6 (count=0) + 29:11 -> 30:35 (count=1) + 30:39 -> 30:41 (count=1) + 31:14 -> 31:52 (count=0) + 33:11 -> 34:35 (count=1) + 34:39 -> 34:41 (count=1) + 35:14 -> 35:52 (count=0) + 37:1 -> 37:2 (count=1) +Segment at 7:1 (count = 1), RegionEntry +Segment at 7:11 (count = 0), Skipped +Segment at 8:9 (count = 1), RegionEntry +Segment at 8:22 (count = 0), Skipped +Segment at 8:28 (count = 1), RegionEntry +Segment at 9:16 (count = 0), Skipped +Segment at 10:16 (count = 1), RegionEntry +Segment at 11:6 (count = 0), Skipped +Segment at 13:11 (count = 1), RegionEntry +Segment at 14:35 (count = 0), Skipped +Segment at 14:39 (count = 1), RegionEntry +Segment at 14:41 (count = 0), Skipped +Segment at 15:14 (count = 0), RegionEntry +Segment at 15:52 (count = 0), Skipped +Segment at 17:11 (count = 1), RegionEntry +Segment at 17:46 (count = 0), Skipped +Segment at 18:34 (count = 1), RegionEntry +Segment at 18:39 (count = 0), Skipped +Segment at 18:44 (count = 1), RegionEntry +Segment at 18:46 (count = 0), Skipped +Segment at 19:14 (count = 0), RegionEntry +Segment at 19:52 (count = 0), Skipped +Segment at 22:9 (count = 1), RegionEntry +Segment at 22:22 (count = 0), Skipped +Segment at 22:28 (count = 1), RegionEntry +Segment at 23:16 (count = 0), Skipped +Segment at 24:9 (count = 1), RegionEntry +Segment at 24:16 (count = 0), Skipped +Segment at 25:9 (count = 0), RegionEntry +Segment at 25:16 (count = 0), Skipped +Segment at 26:16 (count = 0), RegionEntry +Segment at 27:6 (count = 0), Skipped +Segment at 29:11 (count = 1), RegionEntry +Segment at 30:35 (count = 0), Skipped +Segment at 30:39 (count = 1), RegionEntry +Segment at 30:41 (count = 0), Skipped +Segment at 31:14 (count = 0), RegionEntry +Segment at 31:52 (count = 0), Skipped +Segment at 33:11 (count = 1), RegionEntry +Segment at 34:35 (count = 0), Skipped +Segment at 34:39 (count = 1), RegionEntry +Segment at 34:41 (count = 0), Skipped +Segment at 35:14 (count = 0), RegionEntry +Segment at 35:52 (count = 0), Skipped +Segment at 37:1 (count = 1), RegionEntry +Segment at 37:2 (count = 0), Skipped diff --git a/src/test/run-make-fulldeps/coverage-reports-base/prettify_json.py b/src/test/run-make-fulldeps/coverage-reports/prettify_json.py similarity index 100% rename from src/test/run-make-fulldeps/coverage-reports-base/prettify_json.py rename to src/test/run-make-fulldeps/coverage-reports/prettify_json.py diff --git a/src/test/run-make-fulldeps/coverage-spanview-base/expected_mir_dump.closure/closure.main-{closure#0}.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview-base/expected_mir_dump.closure/closure.main-{closure#0}.-------.InstrumentCoverage.0.html deleted file mode 100644 index 2d179aa0f1147..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview-base/expected_mir_dump.closure/closure.main-{closure#0}.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,95 +0,0 @@ - - - - -closure.main-{closure#0} - Coverage Spans - - - -
|| - { - let @0⦊mut countdown = 0⦉@0; - if @0⦊is_false⦉@0 @1,3⦊{ - countdown = 10; - }⦉@1,3@2⦊⦉@2 - @4,5⦊"alt string 2".to_owned() - }⦉@4,5
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview-base/expected_mir_dump.closure/closure.main-{closure#2}.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview-base/expected_mir_dump.closure/closure.main-{closure#2}.-------.InstrumentCoverage.0.html deleted file mode 100644 index 0614da6cee27f..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview-base/expected_mir_dump.closure/closure.main-{closure#2}.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,95 +0,0 @@ - - - - -closure.main-{closure#2} - Coverage Spans - - - -
|| - { - let @0⦊mut countdown = 0⦉@0; - if @0⦊is_false⦉@0 @1,3⦊{ - countdown = 10; - }⦉@1,3@2⦊⦉@2 - @4,5⦊"alt string 1".to_owned() - }⦉@4,5
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview-base/expected_mir_dump.closure/closure.main-{closure#3}.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview-base/expected_mir_dump.closure/closure.main-{closure#3}.-------.InstrumentCoverage.0.html deleted file mode 100644 index bbafb44017cf9..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview-base/expected_mir_dump.closure/closure.main-{closure#3}.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,95 +0,0 @@ - - - - -closure.main-{closure#3} - Coverage Spans - - - -
|| - { - let @0⦊mut countdown = 0⦉@0; - if @0⦊is_false⦉@0 @1,3⦊{ - countdown = 10; - }⦉@1,3@2⦊⦉@2 - @4,5⦊"alt string 3".to_owned() - }⦉@4,5
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview-base/expected_mir_dump.closure/closure.main.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview-base/expected_mir_dump.closure/closure.main.-------.InstrumentCoverage.0.html deleted file mode 100644 index 8d1938c0922be..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview-base/expected_mir_dump.closure/closure.main.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,4515 +0,0 @@ - - - - -closure.main - Coverage Spans - - - -
fn main() @0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34⦊{ - // Initialize test constants in a way that cannot be determined at compile time, to ensure - // rustc and LLVM cannot optimize out statements (or coverage counters) downstream from - // dependent conditions. - let is_true = std::env::args().len() == 1; - let is_false = ! is_true; - - let mut some_string = Some(String::from("the string content")); - println!( - "The string or alt: {}" - , - some_string - . - unwrap_or_else - ( - ⦉@0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34|| - { - let mut countdown = 0; - if is_false { - countdown = 10; - } - "alt string 1".to_owned() - }@0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34⦊ - ) - ); - - some_string = Some(String::from("the string content")); - let - a - = - ⦉@0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34|| - { - let mut countdown = 0; - if is_false { - countdown = 10; - } - "alt string 2".to_owned() - }@0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34⦊; - println!( - "The string or alt: {}" - , - some_string - . - unwrap_or_else - ( - a - ) - ); - - some_string = None; - println!( - "The string or alt: {}" - , - some_string - . - unwrap_or_else - ( - ⦉@0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34|| - { - let mut countdown = 0; - if is_false { - countdown = 10; - } - "alt string 3".to_owned() - }@0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34⦊ - ) - ); - - some_string = None; - let - a - = - ⦉@0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34|| - { - let mut countdown = 0; - if is_false { - countdown = 10; - } - "alt string 4".to_owned() - }@0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34⦊; - println!( - "The string or alt: {}" - , - some_string - . - unwrap_or_else - ( - a - ) - ); -}⦉@0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview-base/expected_mir_dump.conditions/conditions.main.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview-base/expected_mir_dump.conditions/conditions.main.-------.InstrumentCoverage.0.html deleted file mode 100644 index cda1040c29114..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview-base/expected_mir_dump.conditions/conditions.main.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,263 +0,0 @@ - - - - -conditions.main - Coverage Spans - - - -
fn main() { - let @0⦊mut countdown = 0⦉@0; - if @0⦊true⦉@0 @1,3⦊{ - countdown = 10; - }⦉@1,3@2⦊⦉@2 - - const B: u32 = 100; - let @25⦊x⦉@25 = if @4⦊countdown > 7⦉@4 { - @8⦊countdown -= 4; - B⦉@8 - } else if @6⦊countdown > 2⦉@6 { - if @9,11⦊countdown < 1⦉@9,11 || @18⦊countdown > 5⦉@18@16⦊⦉@16@17⦊⦉@17 || @14⦊countdown != 9⦉@14@12⦊⦉@12@13⦊⦉@13 @20,22⦊{ - countdown = 0; - }⦉@20,22@21⦊⦉@21 - @24⦊countdown -= 5; - countdown⦉@24 - } else { - @10⦊return⦉@10; - }; - - let @25⦊mut countdown = 0⦉@25; - if @25⦊true⦉@25 @26,28⦊{ - countdown = 10; - }⦉@26,28@27⦊⦉@27 - - if @29⦊countdown > 7⦉@29 { - @33⦊countdown -= 4⦉@33; - } else if @31⦊countdown > 2⦉@31 { - if @34,36⦊countdown < 1⦉@34,36 || @43⦊countdown > 5⦉@43@41⦊⦉@41@42⦊⦉@42 || @39⦊countdown != 9⦉@39@37⦊⦉@37@38⦊⦉@38 @45,47⦊{ - countdown = 0; - }⦉@45,47@46⦊⦉@46 - @49⦊countdown -= 5⦉@49; - } else { - @35⦊return⦉@35; - } - - let @50⦊mut countdown = 0⦉@50; - if @50⦊true⦉@50 @51,53⦊{ - countdown = 1; - }⦉@51,53@52⦊⦉@52 - - let @77⦊z⦉@77 = if @54⦊countdown > 7⦉@54 { - @58⦊countdown -= 4⦉@58; - } else if @56⦊countdown > 2⦉@56 { - if @59,61⦊countdown < 1⦉@59,61 || @68⦊countdown > 5⦉@68@66⦊⦉@66@67⦊⦉@67 || @64⦊countdown != 9⦉@64@62⦊⦉@62@63⦊⦉@63 @70,72⦊{ - countdown = 0; - }⦉@70,72@71⦊⦉@71 - @74⦊countdown -= 5⦉@74; - } else { - let @60,75,76⦊should_be_reachable = countdown; - println!("reached"); - return⦉@60,75,76; - }; - - let @98⦊w⦉@98 = if @77⦊countdown > 7⦉@77 { - @81⦊countdown -= 4⦉@81; - } else if @79⦊countdown > 2⦉@79 { - if @82,84⦊countdown < 1⦉@82,84 || @91⦊countdown > 5⦉@91@89⦊⦉@89@90⦊⦉@90 || @87⦊countdown != 9⦉@87@85⦊⦉@85@86⦊⦉@86 @93,95⦊{ - countdown = 0; - }⦉@93,95@94⦊⦉@94 - @97⦊countdown -= 5⦉@97; - } else { - @83⦊return⦉@83; - }; -}@101⦊⦉@101@102⦊⦉@102
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview-base/expected_mir_dump.drop_trait/drop_trait.main.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview-base/expected_mir_dump.drop_trait/drop_trait.main.-------.InstrumentCoverage.0.html deleted file mode 100644 index aebeb39fd5179..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview-base/expected_mir_dump.drop_trait/drop_trait.main.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,129 +0,0 @@ - - - - -drop_trait.main - Coverage Spans - - - -
fn main() -> Result<(),u8> { - let @0⦊_firecracker = Firework { strength: 1 }; - - let _tnt = Firework { strength: 100 }⦉@0; - - if @0⦊true⦉@0 { - @1,3,4,5,9,10⦊println!("Exiting with error..."); - return Err(1)⦉@1,3,4,5,9,10; - } - - let _ = @2,6,7,8⦊Firework { strength: 1000 }; - - Ok(())⦉@2,6,7,8 -}@11⦊⦉@11
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview-base/expected_mir_dump.generics/generics.main.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview-base/expected_mir_dump.generics/generics.main.-------.InstrumentCoverage.0.html deleted file mode 100644 index 80a3d52fe43c9..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview-base/expected_mir_dump.generics/generics.main.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,177 +0,0 @@ - - - - -generics.main - Coverage Spans - - - -
fn main() -> Result<(),u8> { - let @0,1,2,3⦊mut firecracker = Firework { strength: 1 }; - firecracker.set_strength(2); - - let mut tnt = Firework { strength: 100.1 }; - tnt.set_strength(200.1); - tnt.set_strength(300.3)⦉@0,1,2,3; - - if @0,1,2,3⦊true⦉@0,1,2,3 { - @4,6,7,8,12,13⦊println!("Exiting with error..."); - return Err(1)⦉@4,6,7,8,12,13; - } - - let _ = @5,9,10,11⦊Firework { strength: 1000 }; - - Ok(())⦉@5,9,10,11 -}@14⦊⦉@14
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview-base/expected_mir_dump.if/if.main.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview-base/expected_mir_dump.if/if.main.-------.InstrumentCoverage.0.html deleted file mode 100644 index 77983f8539086..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview-base/expected_mir_dump.if/if.main.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,178 +0,0 @@ - - - - -if.main - Coverage Spans - - - -
fn main() { - // Initialize test constants in a way that cannot be determined at compile time, to ensure - // rustc and LLVM cannot optimize out statements (or coverage counters) downstream from - // dependent conditions. - let - @0,1,2,3⦊is_true - = - std::env::args().len() - == - 1 - ; - let - mut - countdown - = - 0⦉@0,1,2,3 - ; - if - @0,1,2,3⦊is_true⦉@0,1,2,3 - @4,6⦊{ - countdown - = - 10 - ; - }⦉@4,6@5⦊⦉@5 -}@7⦊⦉@7
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview-base/expected_mir_dump.if_else/if_else.main.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview-base/expected_mir_dump.if_else/if_else.main.-------.InstrumentCoverage.0.html deleted file mode 100644 index 8716ac45d5714..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview-base/expected_mir_dump.if_else/if_else.main.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,173 +0,0 @@ - - - - -if_else.main - Coverage Spans - - - -
fn main() { - // Initialize test constants in a way that cannot be determined at compile time, to ensure - // rustc and LLVM cannot optimize out statements (or coverage counters) downstream from - // dependent conditions. - let @0,1,2,3⦊is_true = std::env::args().len() == 1; - - let mut countdown = 0; - if - is_true⦉@0,1,2,3 - @4,6⦊{ - countdown - = - 10 - ; - }⦉@4,6 - else // Note coverage region difference without semicolon - { - @5⦊countdown - = - 100⦉@5 - } - - if - @7⦊is_true⦉@7 - @8,10⦊{ - countdown - = - 10 - ; - }⦉@8,10 - else - @9⦊{ - countdown - = - 100 - ; - }⦉@9 -}@11⦊⦉@11
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview-base/expected_mir_dump.inner_items/inner_items.main-in_func.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview-base/expected_mir_dump.inner_items/inner_items.main-in_func.-------.InstrumentCoverage.0.html deleted file mode 100644 index 31bb57be81b53..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview-base/expected_mir_dump.inner_items/inner_items.main-in_func.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,116 +0,0 @@ - - - - -inner_items.main-in_func - Coverage Spans - - - -
fn in_func(a: u32) { - let @0⦊b = 1⦉@0; - let @1,2,3,4⦊c⦉@1,2,3,4 = @0⦊a + b⦉@0; - @1,2,3,4⦊println!("c = {}", c) - }⦉@1,2,3,4
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview-base/expected_mir_dump.lazy_boolean/lazy_boolean.main.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview-base/expected_mir_dump.lazy_boolean/lazy_boolean.main.-------.InstrumentCoverage.0.html deleted file mode 100644 index 0388ca42ac88b..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview-base/expected_mir_dump.lazy_boolean/lazy_boolean.main.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,229 +0,0 @@ - - - - -lazy_boolean.main - Coverage Spans - - - -
fn main() { - // Initialize test constants in a way that cannot be determined at compile time, to ensure - // rustc and LLVM cannot optimize out statements (or coverage counters) downstream from - // dependent conditions. - let @0,1,2,3⦊is_true = std::env::args().len() == 1; - - let (mut a, mut b, mut c) = (0, 0, 0)⦉@0,1,2,3; - if @0,1,2,3⦊is_true⦉@0,1,2,3 @4,6⦊{ - a = 1; - b = 10; - c = 100; - }⦉@4,6@5⦊⦉@5 - let - @11⦊somebool⦉@11 - = - @7⦊a < b⦉@7 - || - @10⦊b < c⦉@10@8⦊⦉@8@9⦊⦉@9 - ; - let - @15⦊somebool⦉@15 - = - @11⦊b < a⦉@11 - || - @14⦊b < c⦉@14@12⦊⦉@12@13⦊⦉@13 - ; - let @19⦊somebool⦉@19 = @15⦊a < b⦉@15 && @18⦊b < c⦉@18@16⦊⦉@16@17⦊⦉@17; - let @23⦊somebool⦉@23 = @19⦊b < a⦉@19 && @22⦊b < c⦉@22@20⦊⦉@20@21⦊⦉@21; - - if - @23⦊! - is_true⦉@23 - @24,26⦊{ - a = 2 - ; - }⦉@24,26@25⦊⦉@25 - - if - @27⦊is_true⦉@27 - @28,30⦊{ - b = 30 - ; - }⦉@28,30 - else - @29⦊{ - c = 400 - ; - }⦉@29 - - if @31⦊!is_true⦉@31 @32,34⦊{ - a = 2; - }⦉@32,34@33⦊⦉@33 - - if @35⦊is_true⦉@35 @36,38⦊{ - b = 30; - }⦉@36,38 else @37⦊{ - c = 400; - }⦉@37 -}@39⦊⦉@39
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview-base/expected_mir_dump.loop_break_value/loop_break_value.main.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview-base/expected_mir_dump.loop_break_value/loop_break_value.main.-------.InstrumentCoverage.0.html deleted file mode 100644 index 941bfca76f321..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview-base/expected_mir_dump.loop_break_value/loop_break_value.main.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,128 +0,0 @@ - - - - -loop_break_value.main - Coverage Spans - - - -
fn main() @0,1⦊{ - let result - = - loop - { - break - 10 - ; - } - ; -}⦉@0,1
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview-base/expected_mir_dump.loops_branches/loops_branches.{impl#0}-fmt.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview-base/expected_mir_dump.loops_branches/loops_branches.{impl#0}-fmt.-------.InstrumentCoverage.0.html deleted file mode 100644 index 334a64b0bb8f9..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview-base/expected_mir_dump.loops_branches/loops_branches.{impl#0}-fmt.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,104 +0,0 @@ - - - - -loops_branches.{impl#0}-fmt - Coverage Spans - - - -
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - if @0⦊true⦉@0 { - if @1,3⦊false⦉@1,3 { - while @6,7⦊true⦉@6,7 @8,10⦊{ - }⦉@8,10 - }@9⦊⦉@9@5⦊⦉@5 - @11,12,13,14⦊write!(f, "error")⦉@11,12,13,14@16,18,19,20⦊?⦉@16,18,19,20; - } else @2⦊{ - }⦉@2@15⦊⦉@15 - @21⦊Ok(())⦉@21 - }@22⦊⦉@22
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview-base/expected_mir_dump.nested_loops/nested_loops.main.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview-base/expected_mir_dump.nested_loops/nested_loops.main.-------.InstrumentCoverage.0.html deleted file mode 100644 index 7fbda5d0b3d2c..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview-base/expected_mir_dump.nested_loops/nested_loops.main.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,135 +0,0 @@ - - - - -nested_loops.main - Coverage Spans - - - -
fn main() { - let @0,1,2,3⦊is_true = std::env::args().len() == 1; - let mut countdown = 10⦉@0,1,2,3; - - 'outer: while @4,5⦊countdown > 0⦉@4,5 { - let @6,8,9⦊mut a = 100; - let mut b = 100⦉@6,8,9; - for @14,16⦊_⦉@14,16 in @10,11,12⦊0..50⦉@10,11,12 { - if @14,16⦊a < 30⦉@14,16 { - @17,19⦊break⦉@17,19; - } - @20⦊a -= 5⦉@20; - @21⦊b -= 5⦉@21; - if @21⦊b < 90⦉@21 { - @25⦊a -= 10; - if is_true⦉@25 { - @26,28⦊break 'outer⦉@26,28; - } else { - @29⦊a -= 2; - } - }⦉@29@23⦊⦉@23 - }@30⦊⦉@30 - @32⦊countdown -= 1⦉@32; - }@7⦊⦉@7 -}@33⦊⦉@33
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview-base/expected_mir_dump.partial_eq/partial_eq.{impl#0}-new.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview-base/expected_mir_dump.partial_eq/partial_eq.{impl#0}-new.-------.InstrumentCoverage.0.html deleted file mode 100644 index a3c98e97bbd87..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview-base/expected_mir_dump.partial_eq/partial_eq.{impl#0}-new.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,104 +0,0 @@ - - - - -partial_eq.{impl#0}-new - Coverage Spans - - - -
pub fn new(major: usize, minor: usize, patch: usize) -> Self { - @0⦊Self { - major, - minor, - patch, - } - }⦉@0
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview-base/expected_mir_dump.partial_eq/partial_eq.{impl#2}-gt-{closure#0}.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview-base/expected_mir_dump.partial_eq/partial_eq.{impl#2}-gt-{closure#0}.-------.InstrumentCoverage.0.html deleted file mode 100644 index 00b5d91b1cf91..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview-base/expected_mir_dump.partial_eq/partial_eq.{impl#2}-gt-{closure#0}.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,83 +0,0 @@ - - - - -partial_eq.{impl#2}-gt-{closure#0} - Coverage Spans - - - -
major: usize, - @0,1,2,3⦊⦉@0,1,2,3minor: usize
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview-base/expected_mir_dump.partial_eq/partial_eq.{impl#2}-gt.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview-base/expected_mir_dump.partial_eq/partial_eq.{impl#2}-gt.-------.InstrumentCoverage.0.html deleted file mode 100644 index f1f78e4663949..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview-base/expected_mir_dump.partial_eq/partial_eq.{impl#2}-gt.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,92 +0,0 @@ - - - - -partial_eq.{impl#2}-gt - Coverage Spans - - - -
@0,1,2,3,4⦊⦉@0,1,2,3,4PartialOrd@0,1,2,3,4⦊⦉@0,1,2,3,4
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview-base/expected_mir_dump.partial_eq/partial_eq.{impl#2}-le.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview-base/expected_mir_dump.partial_eq/partial_eq.{impl#2}-le.-------.InstrumentCoverage.0.html deleted file mode 100644 index 49ebcfaafb54e..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview-base/expected_mir_dump.partial_eq/partial_eq.{impl#2}-le.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,92 +0,0 @@ - - - - -partial_eq.{impl#2}-le - Coverage Spans - - - -
@0,1,2,3,4⦊⦉@0,1,2,3,4PartialOrd@0,1,2,3,4⦊⦉@0,1,2,3,4
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview-base/expected_mir_dump.partial_eq/partial_eq.{impl#2}-lt-{closure#0}.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview-base/expected_mir_dump.partial_eq/partial_eq.{impl#2}-lt-{closure#0}.-------.InstrumentCoverage.0.html deleted file mode 100644 index 812dc622ec038..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview-base/expected_mir_dump.partial_eq/partial_eq.{impl#2}-lt-{closure#0}.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,83 +0,0 @@ - - - - -partial_eq.{impl#2}-lt-{closure#0} - Coverage Spans - - - -
major: usize, - @0,1,2,3⦊⦉@0,1,2,3minor: usize
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview-base/expected_mir_dump.partial_eq/partial_eq.{impl#2}-lt.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview-base/expected_mir_dump.partial_eq/partial_eq.{impl#2}-lt.-------.InstrumentCoverage.0.html deleted file mode 100644 index 742b45773232b..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview-base/expected_mir_dump.partial_eq/partial_eq.{impl#2}-lt.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,92 +0,0 @@ - - - - -partial_eq.{impl#2}-lt - Coverage Spans - - - -
@0,1,2,3,4⦊⦉@0,1,2,3,4PartialOrd@0,1,2,3,4⦊⦉@0,1,2,3,4
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview-base/expected_mir_dump.partial_eq/partial_eq.{impl#2}-partial_cmp.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview-base/expected_mir_dump.partial_eq/partial_eq.{impl#2}-partial_cmp.-------.InstrumentCoverage.0.html deleted file mode 100644 index 3714c774bae3f..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview-base/expected_mir_dump.partial_eq/partial_eq.{impl#2}-partial_cmp.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,78 +0,0 @@ - - - - -partial_eq.{impl#2}-partial_cmp - Coverage Spans - - - -
@17⦊@14,15⦊@16⦊PartialOrd⦉@16⦉@14,15⦉@17@18⦊⦉@18
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview-base/expected_mir_dump.partial_eq/partial_eq.{impl#6}-ne.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview-base/expected_mir_dump.partial_eq/partial_eq.{impl#6}-ne.-------.InstrumentCoverage.0.html deleted file mode 100644 index be1f7f7d2e726..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview-base/expected_mir_dump.partial_eq/partial_eq.{impl#6}-ne.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,81 +0,0 @@ - - - - -partial_eq.{impl#6}-ne - Coverage Spans - - - -
@2⦊@5⦊@6⦊@1⦊PartialEq⦉@1⦉@6⦉@5⦉@2@4⦊⦉@4
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview-base/expected_mir_dump.simple_loop/simple_loop.main.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview-base/expected_mir_dump.simple_loop/simple_loop.main.-------.InstrumentCoverage.0.html deleted file mode 100644 index 914e829faa0bd..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview-base/expected_mir_dump.simple_loop/simple_loop.main.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,143 +0,0 @@ - - - - -simple_loop.main - Coverage Spans - - - -
fn main() { - // Initialize test constants in a way that cannot be determined at compile time, to ensure - // rustc and LLVM cannot optimize out statements (or coverage counters) downstream from - // dependent conditions. - let @0,1,2,3⦊is_true = std::env::args().len() == 1; - - let mut countdown = 0⦉@0,1,2,3; - - if - @0,1,2,3⦊is_true⦉@0,1,2,3 - @4,6⦊{ - countdown - = - 10 - ; - }⦉@4,6@5⦊⦉@5 - - loop - { - if - @8,9⦊countdown - == - 0⦉@8,9 - { - @10,12⦊break⦉@10,12 - ; - } - @13⦊countdown - -= - 1⦉@13 - ; - }@7⦊⦉@7 -}@10,12⦊⦉@10,12
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview-base/expected_mir_dump.try_error_result/try_error_result.main.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview-base/expected_mir_dump.try_error_result/try_error_result.main.-------.InstrumentCoverage.0.html deleted file mode 100644 index 5c9baee5d8050..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview-base/expected_mir_dump.try_error_result/try_error_result.main.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,128 +0,0 @@ - - - - -try_error_result.main - Coverage Spans - - - -
fn main() -> Result<(),()> { - let @0,1⦊mut - countdown = 10⦉@0,1 - ; - for - @6,8⦊_⦉@6,8 - in - @2,3,4⦊0..10⦉@2,3,4 - { - @9⦊countdown - -= 1 - ; - if - countdown < 5⦉@9 - { - @10,12,13,14⦊call(/*return_error=*/ true)⦉@10,12,13,14@16,18,19,20⦊?⦉@16,18,19,20; - @15,21,22⦊call(/*return_error=*/ false)⦉@15,21,22@24,26,27,28⦊?⦉@24,26,27,28; - } - else - { - @11,29,30⦊call(/*return_error=*/ false)⦉@11,29,30@32,34,35,36⦊?⦉@32,34,35,36; - }@23⦊⦉@23@31⦊⦉@31 - }@37⦊⦉@37 - @5⦊Ok(())⦉@5 -}@38⦊⦉@38@39⦊⦉@39
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview-base/expected_mir_dump.while_early_ret/while_early_ret.main.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview-base/expected_mir_dump.while_early_ret/while_early_ret.main.-------.InstrumentCoverage.0.html deleted file mode 100644 index 765e3b62c11c2..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview-base/expected_mir_dump.while_early_ret/while_early_ret.main.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,127 +0,0 @@ - - - - -while_early_ret.main - Coverage Spans - - - -
fn main() -> Result<(),u8> { - let @0⦊mut countdown = 10⦉@0; - while - @1,2⦊countdown - > - 0⦉@1,2 - { - if - @3,5⦊countdown - < - 5⦉@3,5 - { - return - if - @6,8⦊countdown - > - 8⦉@6,8 - { - @9,11⦊Ok(())⦉@9,11 - } - else - { - @10⦊Err(1)⦉@10 - } - ; - } - @12⦊countdown - -= - 1⦉@12 - ; - } - @4⦊Ok(())⦉@4 -}@13⦊⦉@13@14⦊⦉@14
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview-deadcode/Makefile b/src/test/run-make-fulldeps/coverage-spanview-deadcode/Makefile deleted file mode 100644 index 826e85b35e5ff..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview-deadcode/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -# needs-profiler-support -# ignore-msvc - -# LINK_DEAD_CODE requires ignore-msvc due to Issue #76038 -LINK_DEAD_CODE=yes - --include ../coverage-spanview-base/Makefile - -# ISSUE(76038): When targeting MSVC, Rust binaries built with both `-Z instrument-coverage` and -# `-C link-dead-code` typically crash (with a seg-fault) or at best generate an empty `*.profraw`. -# See ../coverage/coverage_tools.mk for more information. diff --git a/src/test/run-make-fulldeps/coverage-spanview-deadcode/expected_mir_dump.closure/closure.main-{closure#1}.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview-deadcode/expected_mir_dump.closure/closure.main-{closure#1}.-------.InstrumentCoverage.0.html deleted file mode 100644 index 58e81a221d3a8..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview-deadcode/expected_mir_dump.closure/closure.main-{closure#1}.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,95 +0,0 @@ - - - - -closure.main-{closure#1} - Coverage Spans - - - -
|| - { - let @0⦊mut countdown = 0⦉@0; - if @0⦊is_false⦉@0 @1,3⦊{ - countdown = 10; - }⦉@1,3@2⦊⦉@2 - @4,5⦊"alt string 4".to_owned() - }⦉@4,5
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview-deadcode/expected_mir_dump.closure/closure.main.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview-deadcode/expected_mir_dump.closure/closure.main.-------.InstrumentCoverage.0.html deleted file mode 100644 index 8d1938c0922be..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview-deadcode/expected_mir_dump.closure/closure.main.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,4515 +0,0 @@ - - - - -closure.main - Coverage Spans - - - -
fn main() @0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34⦊{ - // Initialize test constants in a way that cannot be determined at compile time, to ensure - // rustc and LLVM cannot optimize out statements (or coverage counters) downstream from - // dependent conditions. - let is_true = std::env::args().len() == 1; - let is_false = ! is_true; - - let mut some_string = Some(String::from("the string content")); - println!( - "The string or alt: {}" - , - some_string - . - unwrap_or_else - ( - ⦉@0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34|| - { - let mut countdown = 0; - if is_false { - countdown = 10; - } - "alt string 1".to_owned() - }@0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34⦊ - ) - ); - - some_string = Some(String::from("the string content")); - let - a - = - ⦉@0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34|| - { - let mut countdown = 0; - if is_false { - countdown = 10; - } - "alt string 2".to_owned() - }@0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34⦊; - println!( - "The string or alt: {}" - , - some_string - . - unwrap_or_else - ( - a - ) - ); - - some_string = None; - println!( - "The string or alt: {}" - , - some_string - . - unwrap_or_else - ( - ⦉@0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34|| - { - let mut countdown = 0; - if is_false { - countdown = 10; - } - "alt string 3".to_owned() - }@0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34⦊ - ) - ); - - some_string = None; - let - a - = - ⦉@0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34|| - { - let mut countdown = 0; - if is_false { - countdown = 10; - } - "alt string 4".to_owned() - }@0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34⦊; - println!( - "The string or alt: {}" - , - some_string - . - unwrap_or_else - ( - a - ) - ); -}⦉@0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview-deadcode/expected_mir_dump.conditions/conditions.main.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview-deadcode/expected_mir_dump.conditions/conditions.main.-------.InstrumentCoverage.0.html deleted file mode 100644 index cda1040c29114..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview-deadcode/expected_mir_dump.conditions/conditions.main.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,263 +0,0 @@ - - - - -conditions.main - Coverage Spans - - - -
fn main() { - let @0⦊mut countdown = 0⦉@0; - if @0⦊true⦉@0 @1,3⦊{ - countdown = 10; - }⦉@1,3@2⦊⦉@2 - - const B: u32 = 100; - let @25⦊x⦉@25 = if @4⦊countdown > 7⦉@4 { - @8⦊countdown -= 4; - B⦉@8 - } else if @6⦊countdown > 2⦉@6 { - if @9,11⦊countdown < 1⦉@9,11 || @18⦊countdown > 5⦉@18@16⦊⦉@16@17⦊⦉@17 || @14⦊countdown != 9⦉@14@12⦊⦉@12@13⦊⦉@13 @20,22⦊{ - countdown = 0; - }⦉@20,22@21⦊⦉@21 - @24⦊countdown -= 5; - countdown⦉@24 - } else { - @10⦊return⦉@10; - }; - - let @25⦊mut countdown = 0⦉@25; - if @25⦊true⦉@25 @26,28⦊{ - countdown = 10; - }⦉@26,28@27⦊⦉@27 - - if @29⦊countdown > 7⦉@29 { - @33⦊countdown -= 4⦉@33; - } else if @31⦊countdown > 2⦉@31 { - if @34,36⦊countdown < 1⦉@34,36 || @43⦊countdown > 5⦉@43@41⦊⦉@41@42⦊⦉@42 || @39⦊countdown != 9⦉@39@37⦊⦉@37@38⦊⦉@38 @45,47⦊{ - countdown = 0; - }⦉@45,47@46⦊⦉@46 - @49⦊countdown -= 5⦉@49; - } else { - @35⦊return⦉@35; - } - - let @50⦊mut countdown = 0⦉@50; - if @50⦊true⦉@50 @51,53⦊{ - countdown = 1; - }⦉@51,53@52⦊⦉@52 - - let @77⦊z⦉@77 = if @54⦊countdown > 7⦉@54 { - @58⦊countdown -= 4⦉@58; - } else if @56⦊countdown > 2⦉@56 { - if @59,61⦊countdown < 1⦉@59,61 || @68⦊countdown > 5⦉@68@66⦊⦉@66@67⦊⦉@67 || @64⦊countdown != 9⦉@64@62⦊⦉@62@63⦊⦉@63 @70,72⦊{ - countdown = 0; - }⦉@70,72@71⦊⦉@71 - @74⦊countdown -= 5⦉@74; - } else { - let @60,75,76⦊should_be_reachable = countdown; - println!("reached"); - return⦉@60,75,76; - }; - - let @98⦊w⦉@98 = if @77⦊countdown > 7⦉@77 { - @81⦊countdown -= 4⦉@81; - } else if @79⦊countdown > 2⦉@79 { - if @82,84⦊countdown < 1⦉@82,84 || @91⦊countdown > 5⦉@91@89⦊⦉@89@90⦊⦉@90 || @87⦊countdown != 9⦉@87@85⦊⦉@85@86⦊⦉@86 @93,95⦊{ - countdown = 0; - }⦉@93,95@94⦊⦉@94 - @97⦊countdown -= 5⦉@97; - } else { - @83⦊return⦉@83; - }; -}@101⦊⦉@101@102⦊⦉@102
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview-deadcode/expected_mir_dump.drop_trait/drop_trait.{impl#0}-drop.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview-deadcode/expected_mir_dump.drop_trait/drop_trait.{impl#0}-drop.-------.InstrumentCoverage.0.html deleted file mode 100644 index 577491a4e247c..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview-deadcode/expected_mir_dump.drop_trait/drop_trait.{impl#0}-drop.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,133 +0,0 @@ - - - - -drop_trait.{impl#0}-drop - Coverage Spans - - - -
fn drop(&mut self) @0,1,2,3⦊{ - println!("BOOM times {}!!!", self.strength); - }⦉@0,1,2,3
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview-deadcode/expected_mir_dump.generics/generics.{impl#0}-set_strength.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview-deadcode/expected_mir_dump.generics/generics.{impl#0}-set_strength.-------.InstrumentCoverage.0.html deleted file mode 100644 index bfd7f6b4bb5a0..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview-deadcode/expected_mir_dump.generics/generics.{impl#0}-set_strength.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,85 +0,0 @@ - - - - -generics.{impl#0}-set_strength - Coverage Spans - - - -
fn set_strength(&mut self, new_strength: T) @0⦊{ - self.strength = new_strength; - }⦉@0
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview-deadcode/expected_mir_dump.generics/generics.{impl#1}-drop.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview-deadcode/expected_mir_dump.generics/generics.{impl#1}-drop.-------.InstrumentCoverage.0.html deleted file mode 100644 index 58a528e341bef..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview-deadcode/expected_mir_dump.generics/generics.{impl#1}-drop.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,133 +0,0 @@ - - - - -generics.{impl#1}-drop - Coverage Spans - - - -
fn drop(&mut self) @0,1,2,3⦊{ - println!("BOOM times {}!!!", self.strength); - }⦉@0,1,2,3
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview-deadcode/expected_mir_dump.inner_items/inner_items.main-in_func.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview-deadcode/expected_mir_dump.inner_items/inner_items.main-in_func.-------.InstrumentCoverage.0.html deleted file mode 100644 index 31bb57be81b53..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview-deadcode/expected_mir_dump.inner_items/inner_items.main-in_func.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,116 +0,0 @@ - - - - -inner_items.main-in_func - Coverage Spans - - - -
fn in_func(a: u32) { - let @0⦊b = 1⦉@0; - let @1,2,3,4⦊c⦉@1,2,3,4 = @0⦊a + b⦉@0; - @1,2,3,4⦊println!("c = {}", c) - }⦉@1,2,3,4
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview-deadcode/expected_mir_dump.inner_items/inner_items.main.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview-deadcode/expected_mir_dump.inner_items/inner_items.main.-------.InstrumentCoverage.0.html deleted file mode 100644 index 815d5efbce69f..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview-deadcode/expected_mir_dump.inner_items/inner_items.main.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,187 +0,0 @@ - - - - -inner_items.main - Coverage Spans - - - -
fn main() { - // Initialize test constants in a way that cannot be determined at compile time, to ensure - // rustc and LLVM cannot optimize out statements (or coverage counters) downstream from - // dependent conditions. - let @0,1,2,3⦊is_true = std::env::args().len() == 1; - - let mut countdown = 0⦉@0,1,2,3; - if @0,1,2,3⦊is_true⦉@0,1,2,3 @4,6⦊{ - countdown = 10; - }⦉@4,6@5⦊⦉@5 - - mod in_mod { - const IN_MOD_CONST: u32 = 1000; - } - - fn in_func(a: u32) { - let b = 1; - let c = a + b; - println!("c = {}", c) - } - - struct InStruct { - in_struct_field: u32, - } - - const IN_CONST: u32 = 1234; - - trait InTrait { - fn trait_func(&mut self, incr: u32); - - fn default_trait_func(&mut self) { - in_func(IN_CONST); - self.trait_func(IN_CONST); - } - } - - impl InTrait for InStruct { - fn trait_func(&mut self, incr: u32) { - self.in_struct_field += incr; - in_func(self.in_struct_field); - } - } - - type InType = String; - - if @7⦊is_true⦉@7 @8,10,11⦊{ - in_func(countdown); - }⦉@8,10,11@9⦊⦉@9 - - let @12,13⦊mut val = InStruct { - in_struct_field: 101, - }; - - val.default_trait_func(); -}⦉@12,13
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview-deadcode/expected_mir_dump.loops_branches/loops_branches.main.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview-deadcode/expected_mir_dump.loops_branches/loops_branches.main.-------.InstrumentCoverage.0.html deleted file mode 100644 index f1488d644d044..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview-deadcode/expected_mir_dump.loops_branches/loops_branches.main.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,161 +0,0 @@ - - - - -loops_branches.main - Coverage Spans - - - -
fn main() @0,1,2,3⦊{ - let debug_test = DebugTest; - println!("{:?}", debug_test); -}⦉@0,1,2,3
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview-deadcode/expected_mir_dump.partial_eq/partial_eq.main.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview-deadcode/expected_mir_dump.partial_eq/partial_eq.main.-------.InstrumentCoverage.0.html deleted file mode 100644 index a7830911376bf..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview-deadcode/expected_mir_dump.partial_eq/partial_eq.main.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,295 +0,0 @@ - - - - -partial_eq.main - Coverage Spans - - - -
fn main() @0,1,2,3,4,5,6,7,8⦊{ - let version_3_2_1 = Version::new(3, 2, 1); - let version_3_3_0 = Version::new(3, 3, 0); - - println!("{:?} < {:?} = {}", version_3_2_1, version_3_3_0, version_3_2_1 < version_3_3_0); -}⦉@0,1,2,3,4,5,6,7,8
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview-deadcode/expected_mir_dump.partial_eq/partial_eq.{impl#1}-cmp.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview-deadcode/expected_mir_dump.partial_eq/partial_eq.{impl#1}-cmp.-------.InstrumentCoverage.0.html deleted file mode 100644 index 1a40b30099da6..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview-deadcode/expected_mir_dump.partial_eq/partial_eq.{impl#1}-cmp.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,76 +0,0 @@ - - - - -partial_eq.{impl#1}-cmp - Coverage Spans - - - -
@14⦊@11,12⦊@13⦊Ord⦉@13⦉@11,12⦉@14@15⦊⦉@15
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview-deadcode/expected_mir_dump.partial_eq/partial_eq.{impl#2}-ge-{closure#0}.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview-deadcode/expected_mir_dump.partial_eq/partial_eq.{impl#2}-ge-{closure#0}.-------.InstrumentCoverage.0.html deleted file mode 100644 index 5399895992e11..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview-deadcode/expected_mir_dump.partial_eq/partial_eq.{impl#2}-ge-{closure#0}.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,83 +0,0 @@ - - - - -partial_eq.{impl#2}-ge-{closure#0} - Coverage Spans - - - -
major: usize, - @0,1,2,3⦊⦉@0,1,2,3minor: usize
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview-deadcode/expected_mir_dump.partial_eq/partial_eq.{impl#2}-ge.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview-deadcode/expected_mir_dump.partial_eq/partial_eq.{impl#2}-ge.-------.InstrumentCoverage.0.html deleted file mode 100644 index 044dd7eb9f577..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview-deadcode/expected_mir_dump.partial_eq/partial_eq.{impl#2}-ge.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,92 +0,0 @@ - - - - -partial_eq.{impl#2}-ge - Coverage Spans - - - -
@0,1,2,3,4⦊⦉@0,1,2,3,4PartialOrd@0,1,2,3,4⦊⦉@0,1,2,3,4
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview-deadcode/expected_mir_dump.partial_eq/partial_eq.{impl#2}-gt-{closure#0}-{closure#0}.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview-deadcode/expected_mir_dump.partial_eq/partial_eq.{impl#2}-gt-{closure#0}-{closure#0}.-------.InstrumentCoverage.0.html deleted file mode 100644 index 30047ab79725b..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview-deadcode/expected_mir_dump.partial_eq/partial_eq.{impl#2}-gt-{closure#0}-{closure#0}.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,82 +0,0 @@ - - - - -partial_eq.{impl#2}-gt-{closure#0}-{closure#0} - Coverage Spans - - - -
minor: usize, - @0,1,2⦊patch: usize⦉@0,1,2
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview-deadcode/expected_mir_dump.partial_eq/partial_eq.{impl#2}-le-{closure#0}-{closure#0}.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview-deadcode/expected_mir_dump.partial_eq/partial_eq.{impl#2}-le-{closure#0}-{closure#0}.-------.InstrumentCoverage.0.html deleted file mode 100644 index e8da313d18e08..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview-deadcode/expected_mir_dump.partial_eq/partial_eq.{impl#2}-le-{closure#0}-{closure#0}.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,82 +0,0 @@ - - - - -partial_eq.{impl#2}-le-{closure#0}-{closure#0} - Coverage Spans - - - -
minor: usize, - @0,1,2⦊patch: usize⦉@0,1,2
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview-deadcode/expected_mir_dump.partial_eq/partial_eq.{impl#2}-lt-{closure#0}-{closure#0}.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview-deadcode/expected_mir_dump.partial_eq/partial_eq.{impl#2}-lt-{closure#0}-{closure#0}.-------.InstrumentCoverage.0.html deleted file mode 100644 index 55438a463c420..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview-deadcode/expected_mir_dump.partial_eq/partial_eq.{impl#2}-lt-{closure#0}-{closure#0}.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,82 +0,0 @@ - - - - -partial_eq.{impl#2}-lt-{closure#0}-{closure#0} - Coverage Spans - - - -
minor: usize, - @0,1,2⦊patch: usize⦉@0,1,2
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview-deadcode/expected_mir_dump.partial_eq/partial_eq.{impl#2}-partial_cmp.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview-deadcode/expected_mir_dump.partial_eq/partial_eq.{impl#2}-partial_cmp.-------.InstrumentCoverage.0.html deleted file mode 100644 index 3714c774bae3f..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview-deadcode/expected_mir_dump.partial_eq/partial_eq.{impl#2}-partial_cmp.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,78 +0,0 @@ - - - - -partial_eq.{impl#2}-partial_cmp - Coverage Spans - - - -
@17⦊@14,15⦊@16⦊PartialOrd⦉@16⦉@14,15⦉@17@18⦊⦉@18
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview-deadcode/expected_mir_dump.partial_eq/partial_eq.{impl#6}-ne.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview-deadcode/expected_mir_dump.partial_eq/partial_eq.{impl#6}-ne.-------.InstrumentCoverage.0.html deleted file mode 100644 index be1f7f7d2e726..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview-deadcode/expected_mir_dump.partial_eq/partial_eq.{impl#6}-ne.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,81 +0,0 @@ - - - - -partial_eq.{impl#6}-ne - Coverage Spans - - - -
@2⦊@5⦊@6⦊@1⦊PartialEq⦉@1⦉@6⦉@5⦉@2@4⦊⦉@4
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview-deadcode/expected_mir_dump.partial_eq/partial_eq.{impl#7}-fmt.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview-deadcode/expected_mir_dump.partial_eq/partial_eq.{impl#7}-fmt.-------.InstrumentCoverage.0.html deleted file mode 100644 index 65b95bae78d6e..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview-deadcode/expected_mir_dump.partial_eq/partial_eq.{impl#7}-fmt.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,109 +0,0 @@ - - - - -partial_eq.{impl#7}-fmt - Coverage Spans - - - -
@0,1,2,3,4,5⦊Debug⦉@0,1,2,3,4,5
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview-deadcode/expected_mir_dump.simple_loop/simple_loop.main.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview-deadcode/expected_mir_dump.simple_loop/simple_loop.main.-------.InstrumentCoverage.0.html deleted file mode 100644 index 914e829faa0bd..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview-deadcode/expected_mir_dump.simple_loop/simple_loop.main.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,143 +0,0 @@ - - - - -simple_loop.main - Coverage Spans - - - -
fn main() { - // Initialize test constants in a way that cannot be determined at compile time, to ensure - // rustc and LLVM cannot optimize out statements (or coverage counters) downstream from - // dependent conditions. - let @0,1,2,3⦊is_true = std::env::args().len() == 1; - - let mut countdown = 0⦉@0,1,2,3; - - if - @0,1,2,3⦊is_true⦉@0,1,2,3 - @4,6⦊{ - countdown - = - 10 - ; - }⦉@4,6@5⦊⦉@5 - - loop - { - if - @8,9⦊countdown - == - 0⦉@8,9 - { - @10,12⦊break⦉@10,12 - ; - } - @13⦊countdown - -= - 1⦉@13 - ; - }@7⦊⦉@7 -}@10,12⦊⦉@10,12
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview-deadcode/expected_mir_dump.simple_match/simple_match.main.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview-deadcode/expected_mir_dump.simple_match/simple_match.main.-------.InstrumentCoverage.0.html deleted file mode 100644 index 2488ac563e77e..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview-deadcode/expected_mir_dump.simple_match/simple_match.main.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,188 +0,0 @@ - - - - -simple_match.main - Coverage Spans - - - -
fn main() { - // Initialize test constants in a way that cannot be determined at compile time, to ensure - // rustc and LLVM cannot optimize out statements (or coverage counters) downstream from - // dependent conditions. - let @0,1,2,3⦊is_true = std::env::args().len() == 1; - - let mut countdown = 1⦉@0,1,2,3; - if @0,1,2,3⦊is_true⦉@0,1,2,3 @4,6⦊{ - countdown = 0; - }⦉@4,6@5⦊⦉@5 - - for - @13,15,17⦊_⦉@13,15,17 - in - @9,10,11⦊0..2⦉@9,10,11 - { - let z - ; - match - @13,15,17⦊countdown⦉@13,15,17 - { - @18⦊x⦉@18 - if - @13,15,17⦊x - < - 1⦉@13,15,17@19⦊⦉@19 - => - @18⦊{ - z = countdown - ; - let y = countdown - ; - countdown = 10 - ; - }⦉@18 - _ - => - @16⦊{}⦉@16 - } - }@7,8⦊⦉@7,8@20⦊⦉@20 -}@12⦊⦉@12
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview-deadcode/expected_mir_dump.while/while.main.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview-deadcode/expected_mir_dump.while/while.main.-------.InstrumentCoverage.0.html deleted file mode 100644 index 3ba5135122b93..0000000000000 --- a/src/test/run-make-fulldeps/coverage-spanview-deadcode/expected_mir_dump.while/while.main.-------.InstrumentCoverage.0.html +++ /dev/null @@ -1,81 +0,0 @@ - - - - -while.main - Coverage Spans - - - -
fn main() { - let @0⦊num = 9⦉@0; - while @1,2⦊num >= 10⦉@1,2 @3,5⦊{ - }⦉@3,5 -}@4⦊⦉@4
- - diff --git a/src/test/run-make-fulldeps/coverage-spanview-base/Makefile b/src/test/run-make-fulldeps/coverage-spanview/Makefile similarity index 50% rename from src/test/run-make-fulldeps/coverage-spanview-base/Makefile rename to src/test/run-make-fulldeps/coverage-spanview/Makefile index 9f9440340e0ed..84b5d0e522f8c 100644 --- a/src/test/run-make-fulldeps/coverage-spanview-base/Makefile +++ b/src/test/run-make-fulldeps/coverage-spanview/Makefile @@ -1,12 +1,8 @@ # needs-profiler-support -# ISSUE(76038): When targeting MSVC, Rust binaries built with both `-Z instrument-coverage` and -# `-C link-dead-code` typically crash (with a seg-fault) or at best generate an empty `*.profraw`. -# See ../coverage/coverage_tools.mk for more information. - -include ../coverage/coverage_tools.mk -BASEDIR=../coverage-spanview-base +BASEDIR=../coverage-spanview SOURCEDIR=../coverage define SPANVIEW_HEADER @@ -14,7 +10,7 @@ define SPANVIEW_HEADER + + +abort.main - Coverage Spans + + + +
@0⦊fn main() -> Result<(), u8> { + let mut countdown = 10⦉@0; + while @1,2⦊countdown > 0⦉@1,2 { + if @3,5⦊countdown < 5⦉@3,5 @6,8,9⦊{ + might_abort(false); + }⦉@6,8,9@7⦊⦉@7 + // See discussion (below the `Notes` section) on coverage results for the closing brace. + if @10⦊countdown < 5⦉@10 @11,13,14⦊{ might_abort(false); }⦉@11,13,14@12⦊⦉@12 // Counts for different regions on one line. + // For the following example, the closing brace is the last character on the line. + // This shows the character after the closing brace is highlighted, even if that next + // character is a newline. + if @15⦊countdown < 5⦉@15 @16,18,19⦊{ might_abort(false); }⦉@16,18,19@17⦊⦉@17 + @20,21⦊countdown -= 1⦉@20,21; + } + @4⦊Ok(()) +}⦉@4
+ + diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.abort/abort.might_abort.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.abort/abort.might_abort.-------.InstrumentCoverage.0.html new file mode 100644 index 0000000000000..ab7108ae570b7 --- /dev/null +++ b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.abort/abort.might_abort.-------.InstrumentCoverage.0.html @@ -0,0 +1,164 @@ + + + + +abort.might_abort - Coverage Spans + + + +
@0⦊fn might_abort(should_abort: bool) ⦉@0{ + if @0⦊should_abort⦉@0 { + @1,3,4,5⦊println!("aborting..."); + panic!("panics and aborts");⦉@1,3,4,5 + } else @2,6,7⦊{ + println!("Don't Panic"); + } +}⦉@2,6,7
+ + diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.assert/assert.main.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.assert/assert.main.-------.InstrumentCoverage.0.html new file mode 100644 index 0000000000000..f24de8e08432a --- /dev/null +++ b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.assert/assert.main.-------.InstrumentCoverage.0.html @@ -0,0 +1,104 @@ + + + + +assert.main - Coverage Spans + + + +
@0⦊fn main() -> Result<(),u8> { + let mut countdown = 10⦉@0; + while @1,2⦊countdown > 0⦉@1,2 { + if @3,5⦊countdown == 1⦉@3,5 @6,8,9⦊{ + might_fail_assert(3); + }⦉@6,8,9 else if @7⦊countdown < 5⦉@7 @10,12,13⦊{ + might_fail_assert(2); + }⦉@10,12,13@11⦊⦉@11 + @15,16⦊countdown -= 1⦉@15,16; + } + @4⦊Ok(()) +}⦉@4
+ + diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.assert/assert.might_fail_assert.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.assert/assert.might_fail_assert.-------.InstrumentCoverage.0.html new file mode 100644 index 0000000000000..13cfebfe6e50e --- /dev/null +++ b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.assert/assert.might_fail_assert.-------.InstrumentCoverage.0.html @@ -0,0 +1,97 @@ + + + + +assert.might_fail_assert - Coverage Spans + + + +
@0,1,2,3,4⦊fn might_fail_assert(one_plus_one: u32) ⦉@0,1,2,3,4{ + @0,1,2,3,4⦊println!("does 1 + 1 = {}?", one_plus_one);⦉@0,1,2,3,4 + assert_eq!(@0,1,2,3,4⦊1 + 1⦉@0,1,2,3,4, one_plus_one, @5,7,8,9,10,11,12⦊"the argument was wrong"⦉@5,7,8,9,10,11,12); +}@6⦊⦉@6
+ + diff --git a/src/test/run-make-fulldeps/coverage-spanview-deadcode/expected_mir_dump.try_error_result/try_error_result.call.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.c-{closure#0}.-------.InstrumentCoverage.0.html similarity index 63% rename from src/test/run-make-fulldeps/coverage-spanview-deadcode/expected_mir_dump.try_error_result/try_error_result.call.-------.InstrumentCoverage.0.html rename to src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.c-{closure#0}.-------.InstrumentCoverage.0.html index dfe2eb073aa18..82a22ccb4e673 100644 --- a/src/test/run-make-fulldeps/coverage-spanview-deadcode/expected_mir_dump.try_error_result/try_error_result.call.-------.InstrumentCoverage.0.html +++ b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.c-{closure#0}.-------.InstrumentCoverage.0.html @@ -2,7 +2,7 @@ -try_error_result.call - Coverage Spans +async.c-{closure#0} - Coverage Spans -
fn call(return_error: bool) -> Result<(),()> { - if @0⦊return_error⦉@0 { - @1,3⦊Err(())⦉@1,3 +
@0⦊{ + if x == 8⦉@0 { + @1,3⦊1⦉@1,3 } else { - @2⦊Ok(())⦉@2 + @2⦊0⦉@2 } -}@4⦊⦉@4
+}@4⦊⦉@4
diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.c.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.c.-------.InstrumentCoverage.0.html new file mode 100644 index 0000000000000..3eee0dd4100ed --- /dev/null +++ b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.c.-------.InstrumentCoverage.0.html @@ -0,0 +1,80 @@ + + + + +async.c - Coverage Spans + + + +
@0,1⦊async fn c(x: u8) -> u8 ⦉@0,1{ + if x == 8 { + 1 + } else { + 0 + } +}
+ + diff --git a/src/test/run-make-fulldeps/coverage-spanview-deadcode/expected_mir_dump.partial_eq/partial_eq.{impl#4}-assert_receiver_is_total_eq.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.d-{closure#0}.-------.InstrumentCoverage.0.html similarity index 75% rename from src/test/run-make-fulldeps/coverage-spanview-deadcode/expected_mir_dump.partial_eq/partial_eq.{impl#4}-assert_receiver_is_total_eq.-------.InstrumentCoverage.0.html rename to src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.d-{closure#0}.-------.InstrumentCoverage.0.html index b908a35f1b799..7cf34f077954f 100644 --- a/src/test/run-make-fulldeps/coverage-spanview-deadcode/expected_mir_dump.partial_eq/partial_eq.{impl#4}-assert_receiver_is_total_eq.-------.InstrumentCoverage.0.html +++ b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.d-{closure#0}.-------.InstrumentCoverage.0.html @@ -2,7 +2,7 @@ -partial_eq.{impl#4}-assert_receiver_is_total_eq - Coverage Spans +async.d-{closure#0} - Coverage Spans -
@0⦊Eq⦉@0
+
@0⦊⦉@0{ 1 }
diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.d.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.d.-------.InstrumentCoverage.0.html new file mode 100644 index 0000000000000..5c7f6e00224a0 --- /dev/null +++ b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.d.-------.InstrumentCoverage.0.html @@ -0,0 +1,74 @@ + + + + +async.d - Coverage Spans + + + +
@0,1⦊async fn d() -> u8 ⦉@0,1{ 1 }
+ + diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.e-{closure#0}.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.e-{closure#0}.-------.InstrumentCoverage.0.html new file mode 100644 index 0000000000000..1f95a7d35af88 --- /dev/null +++ b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.e-{closure#0}.-------.InstrumentCoverage.0.html @@ -0,0 +1,75 @@ + + + + +async.e-{closure#0} - Coverage Spans + + + +
@0⦊⦉@0{ 1 }
+ + diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.e.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.e.-------.InstrumentCoverage.0.html new file mode 100644 index 0000000000000..ee3b7b1d7ffc7 --- /dev/null +++ b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.e.-------.InstrumentCoverage.0.html @@ -0,0 +1,74 @@ + + + + +async.e - Coverage Spans + + + +
@0,1⦊async fn e() -> u8 ⦉@0,1{ 1 }
+ + diff --git a/src/test/run-make-fulldeps/coverage-spanview-base/expected_mir_dump.partial_eq/partial_eq.{impl#1}-cmp.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.executor-block_on-VTABLE-{closure#0}.-------.InstrumentCoverage.0.html similarity index 55% rename from src/test/run-make-fulldeps/coverage-spanview-base/expected_mir_dump.partial_eq/partial_eq.{impl#1}-cmp.-------.InstrumentCoverage.0.html rename to src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.executor-block_on-VTABLE-{closure#0}.-------.InstrumentCoverage.0.html index 1a40b30099da6..8f61257ca1bac 100644 --- a/src/test/run-make-fulldeps/coverage-spanview-base/expected_mir_dump.partial_eq/partial_eq.{impl#1}-cmp.-------.InstrumentCoverage.0.html +++ b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.executor-block_on-VTABLE-{closure#0}.-------.InstrumentCoverage.0.html @@ -2,7 +2,7 @@ -partial_eq.{impl#1}-cmp - Coverage Spans +async.executor-block_on-VTABLE-{closure#0} - Coverage Spans -
@14⦊@11,12⦊@13⦊Ord⦉@13⦉@11,12⦉@14@15⦊⦉@15
+
@0,1,2,3⦊⦉@0,1,2,3$crate::panicking::panic_fmt($crate::format_args!($fmt, $($arg)+))
diff --git a/src/test/run-make-fulldeps/coverage-spanview-base/expected_mir_dump.partial_eq/partial_eq.{impl#2}-ge-{closure#0}-{closure#0}.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.executor-block_on-VTABLE-{closure#1}.-------.InstrumentCoverage.0.html similarity index 55% rename from src/test/run-make-fulldeps/coverage-spanview-base/expected_mir_dump.partial_eq/partial_eq.{impl#2}-ge-{closure#0}-{closure#0}.-------.InstrumentCoverage.0.html rename to src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.executor-block_on-VTABLE-{closure#1}.-------.InstrumentCoverage.0.html index 0fa59ade1398d..923c669e72d11 100644 --- a/src/test/run-make-fulldeps/coverage-spanview-base/expected_mir_dump.partial_eq/partial_eq.{impl#2}-ge-{closure#0}-{closure#0}.-------.InstrumentCoverage.0.html +++ b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.executor-block_on-VTABLE-{closure#1}.-------.InstrumentCoverage.0.html @@ -2,7 +2,7 @@ -partial_eq.{impl#2}-ge-{closure#0}-{closure#0} - Coverage Spans +async.executor-block_on-VTABLE-{closure#1} - Coverage Spans -
minor: usize, - @0,1,2⦊patch: usize⦉@0,1,2
+
@0,1,2,3⦊⦉@0,1,2,3$crate::panicking::panic_fmt($crate::format_args!($fmt, $($arg)+))
diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.executor-block_on-VTABLE-{closure#2}.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.executor-block_on-VTABLE-{closure#2}.-------.InstrumentCoverage.0.html new file mode 100644 index 0000000000000..59f62959998ce --- /dev/null +++ b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.executor-block_on-VTABLE-{closure#2}.-------.InstrumentCoverage.0.html @@ -0,0 +1,84 @@ + + + + +async.executor-block_on-VTABLE-{closure#2} - Coverage Spans + + + +
@0,1,2,3⦊⦉@0,1,2,3$crate::panicking::panic_fmt($crate::format_args!($fmt, $($arg)+))
+ + diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.executor-block_on-VTABLE-{closure#3}.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.executor-block_on-VTABLE-{closure#3}.-------.InstrumentCoverage.0.html new file mode 100644 index 0000000000000..ef2fe7d06825d --- /dev/null +++ b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.executor-block_on-VTABLE-{closure#3}.-------.InstrumentCoverage.0.html @@ -0,0 +1,75 @@ + + + + +async.executor-block_on-VTABLE-{closure#3} - Coverage Spans + + + +
|_| @0⦊()⦉@0
+ + diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.executor-block_on.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.executor-block_on.-------.InstrumentCoverage.0.html new file mode 100644 index 0000000000000..81310c8cb25aa --- /dev/null +++ b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.executor-block_on.-------.InstrumentCoverage.0.html @@ -0,0 +1,239 @@ + + + + +async.executor-block_on - Coverage Spans + + + +
@0,1,2,3,4,5⦊pub fn block_on<F: Future>(mut future: F) -> F::Output { + let mut future = unsafe { Pin::new_unchecked(&mut future) }; + + static VTABLE: RawWakerVTable = RawWakerVTable::new( + |_| unimplemented!("clone"), + |_| unimplemented!("wake"), + |_| unimplemented!("wake_by_ref"), + |_| (), + ); + let waker = unsafe { Waker::from_raw(RawWaker::new(core::ptr::null(), &VTABLE)) }; + let mut context = Context::from_waker(&waker)⦉@0,1,2,3,4,5; + + loop { + if let Poll::Ready(@10,12,14,15,16,17⦊val⦉@10,12,14,15,16,17) = @6,7,8,9⦊future.as_mut().poll(&mut context)⦉@6,7,8,9 { + break @10,12,14,15,16,17⦊val⦉@10,12,14,15,16,17; + }@11,13⦊⦉@11,13 + } + }@10,12,14,15,16,17⦊⦉@10,12,14,15,16,17
+ + diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.f-{closure#0}.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.f-{closure#0}.-------.InstrumentCoverage.0.html new file mode 100644 index 0000000000000..74b62673ac94b --- /dev/null +++ b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.f-{closure#0}.-------.InstrumentCoverage.0.html @@ -0,0 +1,75 @@ + + + + +async.f-{closure#0} - Coverage Spans + + + +
@0⦊⦉@0{ 1 }
+ + diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.f.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.f.-------.InstrumentCoverage.0.html new file mode 100644 index 0000000000000..a31bca54df2e5 --- /dev/null +++ b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.f.-------.InstrumentCoverage.0.html @@ -0,0 +1,74 @@ + + + + +async.f - Coverage Spans + + + +
@0,1⦊async fn f() -> u8 ⦉@0,1{ 1 }
+ + diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.foo-{closure#0}.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.foo-{closure#0}.-------.InstrumentCoverage.0.html new file mode 100644 index 0000000000000..b8c53cccabda1 --- /dev/null +++ b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.foo-{closure#0}.-------.InstrumentCoverage.0.html @@ -0,0 +1,75 @@ + + + + +async.foo-{closure#0} - Coverage Spans + + + +
@0⦊⦉@0{ [false; 10] }
+ + diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.foo.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.foo.-------.InstrumentCoverage.0.html new file mode 100644 index 0000000000000..cf72a9d532c79 --- /dev/null +++ b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.foo.-------.InstrumentCoverage.0.html @@ -0,0 +1,74 @@ + + + + +async.foo - Coverage Spans + + + +
@0,1⦊async fn foo() -> [bool; 10] ⦉@0,1{ [false; 10] }
+ + diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.g-{closure#0}.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.g-{closure#0}.-------.InstrumentCoverage.0.html new file mode 100644 index 0000000000000..b10012621b7dd --- /dev/null +++ b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.g-{closure#0}.-------.InstrumentCoverage.0.html @@ -0,0 +1,82 @@ + + + + +async.g-{closure#0} - Coverage Spans + + + +
@0,3,4⦊{ + match x⦉@0,3,4 { + @17⦊y⦉@17 if @0,3,4⦊e()⦉@0,3,4.await == @10,13,15,16⦊y⦉@10,13,15,16 => @17⦊()⦉@17, + @33⦊y⦉@33 if @1,19,20⦊f()⦉@1,19,20.await == @26,29,31,32⦊y⦉@26,29,31,32 => @33⦊()⦉@33, + _ => @2⦊()⦉@2, + } +}@35,36⦊⦉@35,36
+ + diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.g.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.g.-------.InstrumentCoverage.0.html new file mode 100644 index 0000000000000..973995477b9aa --- /dev/null +++ b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.g.-------.InstrumentCoverage.0.html @@ -0,0 +1,80 @@ + + + + +async.g - Coverage Spans + + + +
@0,1⦊pub async fn g(x: u8) ⦉@0,1{ + match x { + y if e().await == y => (), + y if f().await == y => (), + _ => (), + } +}
+ + diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.h-{closure#0}.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.h-{closure#0}.-------.InstrumentCoverage.0.html new file mode 100644 index 0000000000000..6b4b43f836580 --- /dev/null +++ b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.h-{closure#0}.-------.InstrumentCoverage.0.html @@ -0,0 +1,82 @@ + + + + +async.h-{closure#0} - Coverage Spans + + + +
@0,2,3⦊{ // The function signature is counted when called, but the body is not + // executed (not awaited) so the open brace has a `0` count (at least when + // displayed with `llvm-cov show` in color-mode). + match x⦉@0,2,3 { + @17⦊y⦉@17 if @0,2,3⦊foo()⦉@0,2,3.await[@9,12,14,15,16⦊y⦉@9,12,14,15,16] => @17⦊()⦉@17, + _ => @1⦊()⦉@1, + } +}@19,20⦊⦉@19,20
+ + diff --git a/src/test/run-make-fulldeps/coverage-spanview-deadcode/expected_mir_dump.inner_items/inner_items.main-{impl#0}-trait_func.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.h.-------.InstrumentCoverage.0.html similarity index 60% rename from src/test/run-make-fulldeps/coverage-spanview-deadcode/expected_mir_dump.inner_items/inner_items.main-{impl#0}-trait_func.-------.InstrumentCoverage.0.html rename to src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.h.-------.InstrumentCoverage.0.html index 6c4ce72305e53..f2ea01281fe1e 100644 --- a/src/test/run-make-fulldeps/coverage-spanview-deadcode/expected_mir_dump.inner_items/inner_items.main-{impl#0}-trait_func.-------.InstrumentCoverage.0.html +++ b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.h.-------.InstrumentCoverage.0.html @@ -2,7 +2,7 @@ -inner_items.main-{impl#0}-trait_func - Coverage Spans +async.h - Coverage Spans -
fn trait_func(&mut self, incr: u32) { - self.in_struct_field += @0⦊incr⦉@0; - @1,2⦊in_func(self.in_struct_field); - }⦉@1,2
+
@0,1⦊async fn h(x: usize) ⦉@0,1{ // The function signature is counted when called, but the body is not + // executed (not awaited) so the open brace has a `0` count (at least when + // displayed with `llvm-cov show` in color-mode). + match x { + y if foo().await[y] => (), + _ => (), + } +}
diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.i-{closure#0}.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.i-{closure#0}.-------.InstrumentCoverage.0.html new file mode 100644 index 0000000000000..49297870fa0a7 --- /dev/null +++ b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.i-{closure#0}.-------.InstrumentCoverage.0.html @@ -0,0 +1,91 @@ + + + + +async.i-{closure#0} - Coverage Spans + + + +
@0,3,4⦊{ // line coverage is 1, but there are 2 regions: + // (a) the function signature, counted when the function is called; and + // (b) the open brace for the function body, counted once when the body is + // executed asynchronously. + match x⦉@0,3,4 { + @18,20⦊y⦉@18,20 if @0,3,4⦊c(x)⦉@0,3,4.await == @10,13,15,16,17⦊y + 1⦉@10,13,15,16,17 => { @18,20⦊d()⦉@18,20.await; } + @48⦊y⦉@48 if @1,33,34⦊f()⦉@1,33,34.await == @40,43,45,46,47⦊y + 1⦉@40,43,45,46,47 => @48⦊()⦉@48, + _ => @2⦊()⦉@2, + } +}@50,51⦊⦉@50,51
+ + diff --git a/src/test/run-make-fulldeps/coverage-spanview-deadcode/expected_mir_dump.tight_inf_loop/tight_inf_loop.main.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.i.-------.InstrumentCoverage.0.html similarity index 59% rename from src/test/run-make-fulldeps/coverage-spanview-deadcode/expected_mir_dump.tight_inf_loop/tight_inf_loop.main.-------.InstrumentCoverage.0.html rename to src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.i.-------.InstrumentCoverage.0.html index 033707a87bb69..e5dc6ecd4eb63 100644 --- a/src/test/run-make-fulldeps/coverage-spanview-deadcode/expected_mir_dump.tight_inf_loop/tight_inf_loop.main.-------.InstrumentCoverage.0.html +++ b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.i.-------.InstrumentCoverage.0.html @@ -2,7 +2,7 @@ -tight_inf_loop.main - Coverage Spans +async.i - Coverage Spans -
fn main() { - if @0⦊false⦉@0 { - @4,5⦊loop {}⦉@4,5@1,3⦊⦉@1,3 +
@0,1⦊async fn i(x: u8) ⦉@0,1{ // line coverage is 1, but there are 2 regions: + // (a) the function signature, counted when the function is called; and + // (b) the open brace for the function body, counted once when the body is + // executed asynchronously. + match x { + y if c(x).await == y + 1 => { d().await; } + y if f().await == y + 1 => (), + _ => (), } -}@2⦊⦉@2
+}
diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.j-c.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.j-c.-------.InstrumentCoverage.0.html new file mode 100644 index 0000000000000..a8e2d7e2f396e --- /dev/null +++ b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.j-c.-------.InstrumentCoverage.0.html @@ -0,0 +1,92 @@ + + + + +async.j-c - Coverage Spans + + + +
@0⦊fn c(x: u8) -> u8 { + if x == 8⦉@0 { + @1,3⦊1⦉@1,3 // This line appears covered, but the 1-character expression span covering the `1` + // is not executed. (`llvm-cov show` displays a `^0` below the `1` ). This is because + // `fn j()` executes the open brace for the funciton body, followed by the function's + // first executable statement, `match x`. Inner function declarations are not + // "visible" to the MIR for `j()`, so the code region counts all lines between the + // open brace and the first statement as executed, which is, in a sense, true. + // `llvm-cov show` overcomes this kind of situation by showing the actual counts + // of the enclosed coverages, (that is, the `1` expression was not executed, and + // accurately displays a `0`). + } else { + @2⦊0⦉@2 + } + }@4⦊⦉@4
+ + diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.j-d.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.j-d.-------.InstrumentCoverage.0.html new file mode 100644 index 0000000000000..4eed8ee60dd64 --- /dev/null +++ b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.j-d.-------.InstrumentCoverage.0.html @@ -0,0 +1,75 @@ + + + + +async.j-d - Coverage Spans + + + +
@0⦊fn d() -> u8 { 1 }⦉@0
+ + diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.j-f.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.j-f.-------.InstrumentCoverage.0.html new file mode 100644 index 0000000000000..6e80c8c786ecb --- /dev/null +++ b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.j-f.-------.InstrumentCoverage.0.html @@ -0,0 +1,75 @@ + + + + +async.j-f - Coverage Spans + + + +
@0⦊fn f() -> u8 { 1 }⦉@0
+ + diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.j.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.j.-------.InstrumentCoverage.0.html new file mode 100644 index 0000000000000..7cc751074a077 --- /dev/null +++ b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.j.-------.InstrumentCoverage.0.html @@ -0,0 +1,108 @@ + + + + +async.j - Coverage Spans + + + +
@0,3,4,5⦊fn j(x: u8) { + // non-async versions of `c()`, `d()`, and `f()` to make it similar to async `i()`. + fn c(x: u8) -> u8 { + if x == 8 { + 1 // This line appears covered, but the 1-character expression span covering the `1` + // is not executed. (`llvm-cov show` displays a `^0` below the `1` ). This is because + // `fn j()` executes the open brace for the funciton body, followed by the function's + // first executable statement, `match x`. Inner function declarations are not + // "visible" to the MIR for `j()`, so the code region counts all lines between the + // open brace and the first statement as executed, which is, in a sense, true. + // `llvm-cov show` overcomes this kind of situation by showing the actual counts + // of the enclosed coverages, (that is, the `1` expression was not executed, and + // accurately displays a `0`). + } else { + 0 + } + } + fn d() -> u8 { 1 } + fn f() -> u8 { 1 } + match x⦉@0,3,4,5 { + @6,8⦊y⦉@6,8 if @0,3,4,5⦊c(x) == y + 1⦉@0,3,4,5 => @6,8⦊{ d(); }⦉@6,8 + @12⦊y⦉@12 if @1,9,10,11⦊f() == y + 1⦉@1,9,10,11 => @12⦊()⦉@12, + _ => @2⦊()⦉@2, + } +}@14⦊⦉@14
+ + diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.k.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.k.-------.InstrumentCoverage.0.html new file mode 100644 index 0000000000000..5792521bb2c57 --- /dev/null +++ b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.k.-------.InstrumentCoverage.0.html @@ -0,0 +1,80 @@ + + + + +async.k - Coverage Spans + + + +
@0⦊fn k(x: u8) { // unused function + match x⦉@0 { + 1 => @1,4⦊()⦉@1,4, + 2 => @2,5⦊()⦉@2,5, + _ => @3⦊()⦉@3, + } +}@6⦊⦉@6
+ + diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.l.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.l.-------.InstrumentCoverage.0.html new file mode 100644 index 0000000000000..cd92b88c24cbb --- /dev/null +++ b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.l.-------.InstrumentCoverage.0.html @@ -0,0 +1,80 @@ + + + + +async.l - Coverage Spans + + + +
@0⦊fn l(x: u8) { + match x⦉@0 { + 1 => @1,4⦊()⦉@1,4, + 2 => @2,5⦊()⦉@2,5, + _ => @3⦊()⦉@3, + } +}@6⦊⦉@6
+ + diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.m-{closure#0}.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.m-{closure#0}.-------.InstrumentCoverage.0.html new file mode 100644 index 0000000000000..9cf86ce34a04d --- /dev/null +++ b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.m-{closure#0}.-------.InstrumentCoverage.0.html @@ -0,0 +1,79 @@ + + + + +async.m-{closure#0} - Coverage Spans + + + +
@0,1⦊{ x - 1 }⦉@0,1
+ + diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.m.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.m.-------.InstrumentCoverage.0.html new file mode 100644 index 0000000000000..04412c1d99427 --- /dev/null +++ b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.m.-------.InstrumentCoverage.0.html @@ -0,0 +1,74 @@ + + + + +async.m - Coverage Spans + + + +
@0,1⦊async fn m(x: u8) -> u8 ⦉@0,1{ x - 1 }
+ + diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.main.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.main.-------.InstrumentCoverage.0.html new file mode 100644 index 0000000000000..313a36ed6c2f2 --- /dev/null +++ b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.async/async.main.-------.InstrumentCoverage.0.html @@ -0,0 +1,190 @@ + + + + +async.main - Coverage Spans + + + +
@0,1,2,3,4,5,6,7,8,9,10,11,12,13⦊fn main() { + let _ = g(10); + let _ = h(9); + let mut future = Box::pin(i(8)); + j(7); + l(6); + let _ = m(5); + executor::block_on(future.as_mut()); +}⦉@0,1,2,3,4,5,6,7,8,9,10,11,12,13
+ + diff --git a/src/test/run-make-fulldeps/coverage-spanview-deadcode/expected_mir_dump.closure/closure.main-{closure#0}.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.closure/closure.main-{closure#0}.-------.InstrumentCoverage.0.html similarity index 64% rename from src/test/run-make-fulldeps/coverage-spanview-deadcode/expected_mir_dump.closure/closure.main-{closure#0}.-------.InstrumentCoverage.0.html rename to src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.closure/closure.main-{closure#0}.-------.InstrumentCoverage.0.html index 2d179aa0f1147..523e839a918dd 100644 --- a/src/test/run-make-fulldeps/coverage-spanview-deadcode/expected_mir_dump.closure/closure.main-{closure#0}.-------.InstrumentCoverage.0.html +++ b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.closure/closure.main-{closure#0}.-------.InstrumentCoverage.0.html @@ -2,7 +2,7 @@ -closure.main-{closure#2} - Coverage Spans +closure.main-{closure#10} - Coverage Spans + + +
|val| + @0⦊{ + let mut countdown = 0; + if is_false⦉@0 @1,3⦊{ + countdown = 10; + }⦉@1,3@2⦊⦉@2 + @4,5,6,7,8⦊format!("'{}'", val) + }⦉@4,5,6,7,8
+ + diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.closure/closure.main-{closure#3}.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.closure/closure.main-{closure#3}.-------.InstrumentCoverage.0.html new file mode 100644 index 0000000000000..032a6a7e435c1 --- /dev/null +++ b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.closure/closure.main-{closure#3}.-------.InstrumentCoverage.0.html @@ -0,0 +1,93 @@ + + + + +closure.main-{closure#3} - Coverage Spans + + + +
| + mut countdown + | + @0⦊{ + if is_false⦉@0 @1,3⦊{ + countdown = 10; + }⦉@1,3@2⦊⦉@2 + @4,5⦊"closure should be unused".to_owned() + }⦉@4,5
+ + diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.closure/closure.main-{closure#4}.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.closure/closure.main-{closure#4}.-------.InstrumentCoverage.0.html new file mode 100644 index 0000000000000..df0172bdf7067 --- /dev/null +++ b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.closure/closure.main-{closure#4}.-------.InstrumentCoverage.0.html @@ -0,0 +1,77 @@ + + + + +closure.main-{closure#4} - Coverage Spans + + + +
| _unused_arg: u8 | @0,1⦊countdown += 1⦉@0,1
+ + diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.closure/closure.main-{closure#5}.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.closure/closure.main-{closure#5}.-------.InstrumentCoverage.0.html new file mode 100644 index 0000000000000..e28038fd3fec6 --- /dev/null +++ b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.closure/closure.main-{closure#5}.-------.InstrumentCoverage.0.html @@ -0,0 +1,115 @@ + + + + +closure.main-{closure#5} - Coverage Spans + + + +
@0,1,2⦊{ + $crate::io::_print($crate::format_args_nl!($($arg)*)); + }⦉@0,1,2
+ + diff --git a/src/test/run-make-fulldeps/coverage-spanview-deadcode/expected_mir_dump.partial_eq/partial_eq.{impl#8}-clone.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.closure/closure.main-{closure#6}.-------.InstrumentCoverage.0.html similarity index 58% rename from src/test/run-make-fulldeps/coverage-spanview-deadcode/expected_mir_dump.partial_eq/partial_eq.{impl#8}-clone.-------.InstrumentCoverage.0.html rename to src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.closure/closure.main-{closure#6}.-------.InstrumentCoverage.0.html index a61d3cb8bdcb3..d479211aa37e5 100644 --- a/src/test/run-make-fulldeps/coverage-spanview-deadcode/expected_mir_dump.partial_eq/partial_eq.{impl#8}-clone.-------.InstrumentCoverage.0.html +++ b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.closure/closure.main-{closure#6}.-------.InstrumentCoverage.0.html @@ -2,7 +2,7 @@ -partial_eq.{impl#8}-clone - Coverage Spans +closure.main-{closure#6} - Coverage Spans -
@0,1,2,3⦊Clone⦉@0,1,2,3
+
| _unused_arg: u8 | @0,1,2⦊{ println!("not called") }⦉@0,1,2
diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.closure/closure.main-{closure#7}.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.closure/closure.main-{closure#7}.-------.InstrumentCoverage.0.html new file mode 100644 index 0000000000000..2734c0b24688c --- /dev/null +++ b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.closure/closure.main-{closure#7}.-------.InstrumentCoverage.0.html @@ -0,0 +1,115 @@ + + + + +closure.main-{closure#7} - Coverage Spans + + + +
| _unused_arg: u8 | @0,1,2⦊{ + println!("not called") + }⦉@0,1,2
+ + diff --git a/src/test/run-make-fulldeps/coverage-spanview-base/expected_mir_dump.inner_items/inner_items.main-{impl#0}-trait_func.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.closure/closure.main-{closure#8}.-------.InstrumentCoverage.0.html similarity index 57% rename from src/test/run-make-fulldeps/coverage-spanview-base/expected_mir_dump.inner_items/inner_items.main-{impl#0}-trait_func.-------.InstrumentCoverage.0.html rename to src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.closure/closure.main-{closure#8}.-------.InstrumentCoverage.0.html index 6c4ce72305e53..a032df54ea21c 100644 --- a/src/test/run-make-fulldeps/coverage-spanview-base/expected_mir_dump.inner_items/inner_items.main-{impl#0}-trait_func.-------.InstrumentCoverage.0.html +++ b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.closure/closure.main-{closure#8}.-------.InstrumentCoverage.0.html @@ -2,7 +2,7 @@ -inner_items.main-{impl#0}-trait_func - Coverage Spans +closure.main-{closure#8} - Coverage Spans -
fn trait_func(&mut self, incr: u32) { - self.in_struct_field += @0⦊incr⦉@0; - @1,2⦊in_func(self.in_struct_field); - }⦉@1,2
+
| + _unused_arg: u8 + | @0,1,2⦊{ println!("not called") }⦉@0,1,2
diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.closure/closure.main-{closure#9}.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.closure/closure.main-{closure#9}.-------.InstrumentCoverage.0.html new file mode 100644 index 0000000000000..3c174e03ebe35 --- /dev/null +++ b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.closure/closure.main-{closure#9}.-------.InstrumentCoverage.0.html @@ -0,0 +1,89 @@ + + + + +closure.main-{closure#9} - Coverage Spans + + + +
| + _unused_arg: u8 + | @0,1,2⦊{ println!("not called") }⦉@0,1,2
+ + diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.closure/closure.main.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.closure/closure.main.-------.InstrumentCoverage.0.html new file mode 100644 index 0000000000000..702c7937064b7 --- /dev/null +++ b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.closure/closure.main.-------.InstrumentCoverage.0.html @@ -0,0 +1,10921 @@ + + + + +closure.main - Coverage Spans + + + +
@0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42⦊fn main() { + // Initialize test constants in a way that cannot be determined at compile time, to ensure + // rustc and LLVM cannot optimize out statements (or coverage counters) downstream from + // dependent conditions. + let is_true = std::env::args().len() == 1; + let is_false = ! is_true; + + let mut some_string = Some(String::from("the string content")); + println!( + "The string or alt: {}" + , + some_string + . + unwrap_or_else + ( + ⦉@0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42|| + { + let mut countdown = 0; + if is_false { + countdown = 10; + } + "alt string 1".to_owned() + }@0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42⦊ + ) + ); + + some_string = Some(String::from("the string content")); + let + a + = + ⦉@0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42|| + { + let mut countdown = 0; + if is_false { + countdown = 10; + } + "alt string 2".to_owned() + }@0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42⦊; + println!( + "The string or alt: {}" + , + some_string + . + unwrap_or_else + ( + a + ) + ); + + some_string = None; + println!( + "The string or alt: {}" + , + some_string + . + unwrap_or_else + ( + ⦉@0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42|| + { + let mut countdown = 0; + if is_false { + countdown = 10; + } + "alt string 3".to_owned() + }@0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42⦊ + ) + ); + + some_string = None; + let + a + = + ⦉@0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42|| + { + let mut countdown = 0; + if is_false { + countdown = 10; + } + "alt string 4".to_owned() + }@0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42⦊; + println!( + "The string or alt: {}" + , + some_string + . + unwrap_or_else + ( + a + ) + ); + + let + quote_closure + = + ⦉@0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42|val| + { + let mut countdown = 0; + if is_false { + countdown = 10; + } + format!("'{}'", val) + }@0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42⦊; + println!( + "Repeated, quoted string: {:?}" + , + std::iter::repeat("repeat me") + .take(5) + .map + ( + quote_closure + ) + .collect::<Vec<_>>() + ); + + let + _unused_closure + = + ⦉@0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42| + mut countdown + | + { + if is_false { + countdown = 10; + } + "closure should be unused".to_owned() + }@0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42⦊; + + let mut countdown = 10; + let _short_unused_closure = ⦉@0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42| _unused_arg: u8 | countdown += 1@0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42⦊; + + // Macros can sometimes confuse the coverage results. Compare this next assignment, with an + // unused closure that invokes the `println!()` macro, with the closure assignment above, that + // does not use a macro. The closure above correctly shows `0` executions. + let _short_unused_closure = ⦉@0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42| _unused_arg: u8 | println!("not called")@0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42⦊; + // The closure assignment above is executed, with a line count of `1`, but the `println!()` + // could not have been called, and yet, there is no indication that it wasn't... + + // ...but adding block braces gives the expected result, showing the block was not executed. + let _short_unused_closure_block = ⦉@0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42| _unused_arg: u8 | { println!("not called") }@0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42⦊; + + let _shortish_unused_closure = ⦉@0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42| _unused_arg: u8 | { + println!("not called") + }@0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42⦊; + + let _as_short_unused_closure = ⦉@0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42| + _unused_arg: u8 + | { println!("not called") }@0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42⦊; + + let _almost_as_short_unused_closure = ⦉@0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42| + _unused_arg: u8 + | { println!("not called") }@0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42⦊ + ; +}⦉@0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42
+ + diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.conditions/conditions.main.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.conditions/conditions.main.-------.InstrumentCoverage.0.html new file mode 100644 index 0000000000000..e16b366e2162e --- /dev/null +++ b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.conditions/conditions.main.-------.InstrumentCoverage.0.html @@ -0,0 +1,326 @@ + + + + +conditions.main - Coverage Spans + + + +
@0⦊fn main() ⦉@0{ + let @0⦊mut countdown = 0; + if true⦉@0 @1,3⦊{ + countdown = 10; + }⦉@1,3@2⦊⦉@2 + + const B: u32 = 100; + let @25⦊x⦉@25 = if @4⦊countdown > 7⦉@4 { + @5,7,8⦊countdown -= 4; + B⦉@5,7,8 + } else if @6⦊countdown > 2⦉@6 { + if @9,11⦊countdown < 1⦉@9,11 || @18⦊countdown > 5⦉@18 || @14⦊countdown != 9⦉@14 @20,22⦊{ + countdown = 0; + }⦉@20,22@21⦊⦉@21 + @23,24⦊countdown -= 5; + countdown⦉@23,24 + } else { + @10⦊return⦉@10; + }; + + let @25⦊mut countdown = 0; + if true⦉@25 @26,28⦊{ + countdown = 10; + }⦉@26,28@27⦊⦉@27 + + if @29⦊countdown > 7⦉@29 @30,32,33⦊{ + countdown -= 4; + }⦉@30,32,33 else if @31⦊countdown > 2⦉@31 { + if @34,36⦊countdown < 1⦉@34,36 || @43⦊countdown > 5⦉@43 || @39⦊countdown != 9⦉@39 @45,47⦊{ + countdown = 0; + }⦉@45,47@46⦊⦉@46 + @48,49⦊countdown -= 5⦉@48,49; + } else { + @35⦊return⦉@35; + } + + if @50⦊true⦉@50 { + let @51,53⦊mut countdown = 0; + if true⦉@51,53 @54,56⦊{ + countdown = 10; + }⦉@54,56@55⦊⦉@55 + + if @57⦊countdown > 7⦉@57 @58,60,61⦊{ + countdown -= 4; + }⦉@58,60,61 + else if @59⦊countdown > 2⦉@59 { + if @62,64⦊countdown < 1⦉@62,64 || @71⦊countdown > 5⦉@71 || @67⦊countdown != 9⦉@67 @73,75⦊{ + countdown = 0; + }⦉@73,75@74⦊⦉@74 + @76,77⦊countdown -= 5⦉@76,77; + } else { + @63⦊return⦉@63; + } + }@52⦊⦉@52 // Note: closing brace shows uncovered (vs. `0` for implicit else) because condition literal + // `true` was const-evaluated. The compiler knows the `if` block will be executed. + + let @79⦊mut countdown = 0; + if true⦉@79 @80,82⦊{ + countdown = 1; + }⦉@80,82@81⦊⦉@81 + + let @106⦊z⦉@106 = if @83⦊countdown > 7⦉@83 @84,86,87⦊{ + countdown -= 4; + }⦉@84,86,87 else if @85⦊countdown > 2⦉@85 { + if @88,90⦊countdown < 1⦉@88,90 || @97⦊countdown > 5⦉@97 || @93⦊countdown != 9⦉@93 @99,101⦊{ + countdown = 0; + }⦉@99,101@100⦊⦉@100 + @102,103⦊countdown -= 5⦉@102,103; + } else { + let @89,104,105⦊should_be_reachable = countdown; + println!("reached"); + return⦉@89,104,105; + }; + + let @127⦊w⦉@127 = if @106⦊countdown > 7⦉@106 @107,109,110⦊{ + countdown -= 4; + }⦉@107,109,110 else if @108⦊countdown > 2⦉@108 { + if @111,113⦊countdown < 1⦉@111,113 || @120⦊countdown > 5⦉@120 || @116⦊countdown != 9⦉@116 @122,124⦊{ + countdown = 0; + }⦉@122,124@123⦊⦉@123 + @125,126⦊countdown -= 5⦉@125,126; + } else { + @112⦊return⦉@112; + }; +}@131⦊⦉@131
+ + diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.dead_code/dead_code.main.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.dead_code/dead_code.main.-------.InstrumentCoverage.0.html new file mode 100644 index 0000000000000..59d00600738f0 --- /dev/null +++ b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.dead_code/dead_code.main.-------.InstrumentCoverage.0.html @@ -0,0 +1,151 @@ + + + + +dead_code.main - Coverage Spans + + + +
@0,1,2,3⦊fn main() { + // Initialize test constants in a way that cannot be determined at compile time, to ensure + // rustc and LLVM cannot optimize out statements (or coverage counters) downstream from + // dependent conditions. + let is_true = std::env::args().len() == 1; + + let mut countdown = 0; + if is_true⦉@0,1,2,3 @4,6⦊{ + countdown = 10; + }⦉@4,6@5⦊⦉@5 +}@7⦊⦉@7
+ + diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.dead_code/dead_code.unused_fn.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.dead_code/dead_code.unused_fn.-------.InstrumentCoverage.0.html new file mode 100644 index 0000000000000..1a535b937887b --- /dev/null +++ b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.dead_code/dead_code.unused_fn.-------.InstrumentCoverage.0.html @@ -0,0 +1,151 @@ + + + + +dead_code.unused_fn - Coverage Spans + + + +
@0,1,2,3⦊fn unused_fn() { + // Initialize test constants in a way that cannot be determined at compile time, to ensure + // rustc and LLVM cannot optimize out statements (or coverage counters) downstream from + // dependent conditions. + let is_true = std::env::args().len() == 1; + + let mut countdown = 0; + if is_true⦉@0,1,2,3 @4,6⦊{ + countdown = 10; + }⦉@4,6@5⦊⦉@5 +}@7⦊⦉@7
+ + diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.dead_code/dead_code.unused_pub_fn_not_in_library.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.dead_code/dead_code.unused_pub_fn_not_in_library.-------.InstrumentCoverage.0.html new file mode 100644 index 0000000000000..6eff51ad89c73 --- /dev/null +++ b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.dead_code/dead_code.unused_pub_fn_not_in_library.-------.InstrumentCoverage.0.html @@ -0,0 +1,151 @@ + + + + +dead_code.unused_pub_fn_not_in_library - Coverage Spans + + + +
@0,1,2,3⦊pub fn unused_pub_fn_not_in_library() { + // Initialize test constants in a way that cannot be determined at compile time, to ensure + // rustc and LLVM cannot optimize out statements (or coverage counters) downstream from + // dependent conditions. + let is_true = std::env::args().len() == 1; + + let mut countdown = 0; + if is_true⦉@0,1,2,3 @4,6⦊{ + countdown = 10; + }⦉@4,6@5⦊⦉@5 +}@7⦊⦉@7
+ + diff --git a/src/test/run-make-fulldeps/coverage-spanview-deadcode/expected_mir_dump.drop_trait/drop_trait.main.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.drop_trait/drop_trait.main.-------.InstrumentCoverage.0.html similarity index 64% rename from src/test/run-make-fulldeps/coverage-spanview-deadcode/expected_mir_dump.drop_trait/drop_trait.main.-------.InstrumentCoverage.0.html rename to src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.drop_trait/drop_trait.main.-------.InstrumentCoverage.0.html index aebeb39fd5179..fa3c4b3c31257 100644 --- a/src/test/run-make-fulldeps/coverage-spanview-deadcode/expected_mir_dump.drop_trait/drop_trait.main.-------.InstrumentCoverage.0.html +++ b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.drop_trait/drop_trait.main.-------.InstrumentCoverage.0.html @@ -2,7 +2,7 @@ + + +inner_items.main-in_func - Coverage Spans + + + +
@0,1,2,3,4⦊fn in_func(a: u32) { + let b = 1; + let c = a + b; + println!("c = {}", c) + }⦉@0,1,2,3,4
+ + diff --git a/src/test/run-make-fulldeps/coverage-spanview-deadcode/expected_mir_dump.inner_items/inner_items.main-InTrait-default_trait_func.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.inner_items/inner_items.main-{impl#0}-trait_func.-------.InstrumentCoverage.0.html similarity index 51% rename from src/test/run-make-fulldeps/coverage-spanview-deadcode/expected_mir_dump.inner_items/inner_items.main-InTrait-default_trait_func.-------.InstrumentCoverage.0.html rename to src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.inner_items/inner_items.main-{impl#0}-trait_func.-------.InstrumentCoverage.0.html index 9b57c6a737817..ee1e0339049e1 100644 --- a/src/test/run-make-fulldeps/coverage-spanview-deadcode/expected_mir_dump.inner_items/inner_items.main-InTrait-default_trait_func.-------.InstrumentCoverage.0.html +++ b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.inner_items/inner_items.main-{impl#0}-trait_func.-------.InstrumentCoverage.0.html @@ -2,7 +2,7 @@ -inner_items.main-InTrait-default_trait_func - Coverage Spans +inner_items.main-{impl#0}-trait_func - Coverage Spans -
fn default_trait_func(&mut self) @0,1,2⦊{ - in_func(IN_CONST); - self.trait_func(IN_CONST); - }⦉@0,1,2
+
@0,1,2⦊fn trait_func(&mut self, incr: u32) { + self.in_struct_field += incr; + in_func(self.in_struct_field); + }⦉@0,1,2
diff --git a/src/test/run-make-fulldeps/coverage-spanview-base/expected_mir_dump.inner_items/inner_items.main.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.inner_items/inner_items.main.-------.InstrumentCoverage.0.html similarity index 81% rename from src/test/run-make-fulldeps/coverage-spanview-base/expected_mir_dump.inner_items/inner_items.main.-------.InstrumentCoverage.0.html rename to src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.inner_items/inner_items.main.-------.InstrumentCoverage.0.html index 815d5efbce69f..693b15f15b9ca 100644 --- a/src/test/run-make-fulldeps/coverage-spanview-base/expected_mir_dump.inner_items/inner_items.main.-------.InstrumentCoverage.0.html +++ b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.inner_items/inner_items.main.-------.InstrumentCoverage.0.html @@ -2,7 +2,7 @@ + + +overflow.main - Coverage Spans + + + +
@0⦊fn main() -> Result<(),u8> { + let mut countdown = 10⦉@0; + while @1,2⦊countdown > 0⦉@1,2 { + if @3,5⦊countdown == 1⦉@3,5 @6,8,9,10,11,12⦊{ + let result = might_overflow(10); + println!("Result: {}", result); + }⦉@6,8,9,10,11,12 else if @7⦊countdown < 5⦉@7 @13,15,16,17,18,19⦊{ + let result = might_overflow(1); + println!("Result: {}", result); + }⦉@13,15,16,17,18,19@14⦊⦉@14 + @21,22⦊countdown -= 1⦉@21,22; + } + @4⦊Ok(()) +}⦉@4
+ + diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.overflow/overflow.might_overflow.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.overflow/overflow.might_overflow.-------.InstrumentCoverage.0.html new file mode 100644 index 0000000000000..c72ad42635620 --- /dev/null +++ b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.overflow/overflow.might_overflow.-------.InstrumentCoverage.0.html @@ -0,0 +1,396 @@ + + + + +overflow.might_overflow - Coverage Spans + + + +
@0⦊fn might_overflow(to_add: u32) -> u32 { + if to_add > 5⦉@0 @1,3,4,5⦊{ + println!("this will probably overflow"); + }⦉@1,3,4,5@2⦊⦉@2 + let @6,7,8,9,10,11,12,13,14⦊add_to = u32::MAX - 5; + println!("does {} + {} overflow?", add_to, to_add); + let result = to_add + add_to; + println!("continuing after overflow check"); + result +}⦉@6,7,8,9,10,11,12,13,14
+ + diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.panic_unwind/panic_unwind.main.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.panic_unwind/panic_unwind.main.-------.InstrumentCoverage.0.html new file mode 100644 index 0000000000000..bd6aac4103eb6 --- /dev/null +++ b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.panic_unwind/panic_unwind.main.-------.InstrumentCoverage.0.html @@ -0,0 +1,104 @@ + + + + +panic_unwind.main - Coverage Spans + + + +
@0⦊fn main() -> Result<(), u8> { + let mut countdown = 10⦉@0; + while @1,2⦊countdown > 0⦉@1,2 { + if @3,5⦊countdown == 1⦉@3,5 @6,8,9⦊{ + might_panic(true); + }⦉@6,8,9 else if @7⦊countdown < 5⦉@7 @10,12,13⦊{ + might_panic(false); + }⦉@10,12,13@11⦊⦉@11 + @15,16⦊countdown -= 1⦉@15,16; + } + @4⦊Ok(()) +}⦉@4
+ + diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.panic_unwind/panic_unwind.might_panic.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.panic_unwind/panic_unwind.might_panic.-------.InstrumentCoverage.0.html new file mode 100644 index 0000000000000..290b7b8509908 --- /dev/null +++ b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.panic_unwind/panic_unwind.might_panic.-------.InstrumentCoverage.0.html @@ -0,0 +1,164 @@ + + + + +panic_unwind.might_panic - Coverage Spans + + + +
@0⦊fn might_panic(should_panic: bool) ⦉@0{ + if @0⦊should_panic⦉@0 { + @1,3,4,5⦊println!("panicking..."); + panic!("panics");⦉@1,3,4,5 + } else @2,6,7⦊{ + println!("Don't Panic"); + } +}⦉@2,6,7
+ + diff --git a/src/test/run-make-fulldeps/coverage-spanview-base/expected_mir_dump.partial_eq/partial_eq.main.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.partial_eq/partial_eq.main.-------.InstrumentCoverage.0.html similarity index 97% rename from src/test/run-make-fulldeps/coverage-spanview-base/expected_mir_dump.partial_eq/partial_eq.main.-------.InstrumentCoverage.0.html rename to src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.partial_eq/partial_eq.main.-------.InstrumentCoverage.0.html index a7830911376bf..6d9d63deccf17 100644 --- a/src/test/run-make-fulldeps/coverage-spanview-base/expected_mir_dump.partial_eq/partial_eq.main.-------.InstrumentCoverage.0.html +++ b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.partial_eq/partial_eq.main.-------.InstrumentCoverage.0.html @@ -2,7 +2,7 @@ + + +partial_eq.{impl#1}-cmp - Coverage Spans + + + +
@0,1⦊⦉@0,1Ord@15⦊⦉@15
+ + diff --git a/src/test/run-make-fulldeps/coverage-spanview-deadcode/expected_mir_dump.partial_eq/partial_eq.{impl#2}-ge-{closure#0}-{closure#0}.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.partial_eq/partial_eq.{impl#2}-ge-{closure#0}-{closure#0}.-------.InstrumentCoverage.0.html similarity index 89% rename from src/test/run-make-fulldeps/coverage-spanview-deadcode/expected_mir_dump.partial_eq/partial_eq.{impl#2}-ge-{closure#0}-{closure#0}.-------.InstrumentCoverage.0.html rename to src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.partial_eq/partial_eq.{impl#2}-ge-{closure#0}-{closure#0}.-------.InstrumentCoverage.0.html index 0fa59ade1398d..47f9ab2bd5e7d 100644 --- a/src/test/run-make-fulldeps/coverage-spanview-deadcode/expected_mir_dump.partial_eq/partial_eq.{impl#2}-ge-{closure#0}-{closure#0}.-------.InstrumentCoverage.0.html +++ b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.partial_eq/partial_eq.{impl#2}-ge-{closure#0}-{closure#0}.-------.InstrumentCoverage.0.html @@ -2,7 +2,7 @@ + + +partial_eq.{impl#2}-partial_cmp - Coverage Spans + + + +
@0,1⦊⦉@0,1PartialOrd@18⦊⦉@18
+ + diff --git a/src/test/run-make-fulldeps/coverage-spanview-base/expected_mir_dump.partial_eq/partial_eq.{impl#4}-assert_receiver_is_total_eq.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.partial_eq/partial_eq.{impl#4}-assert_receiver_is_total_eq.-------.InstrumentCoverage.0.html similarity index 87% rename from src/test/run-make-fulldeps/coverage-spanview-base/expected_mir_dump.partial_eq/partial_eq.{impl#4}-assert_receiver_is_total_eq.-------.InstrumentCoverage.0.html rename to src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.partial_eq/partial_eq.{impl#4}-assert_receiver_is_total_eq.-------.InstrumentCoverage.0.html index b908a35f1b799..ebb8b1c15ce08 100644 --- a/src/test/run-make-fulldeps/coverage-spanview-base/expected_mir_dump.partial_eq/partial_eq.{impl#4}-assert_receiver_is_total_eq.-------.InstrumentCoverage.0.html +++ b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.partial_eq/partial_eq.{impl#4}-assert_receiver_is_total_eq.-------.InstrumentCoverage.0.html @@ -2,7 +2,7 @@ -partial_eq.{impl#6}-eq - Coverage Spans +partial_eq.{impl#6}-ne - Coverage Spans -
@2⦊@1⦊PartialEq⦉@1⦉@2@4⦊⦉@4
+
@0⦊⦉@0PartialEq@4⦊⦉@4
diff --git a/src/test/run-make-fulldeps/coverage-spanview-base/expected_mir_dump.partial_eq/partial_eq.{impl#7}-fmt.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.partial_eq/partial_eq.{impl#7}-fmt.-------.InstrumentCoverage.0.html similarity index 96% rename from src/test/run-make-fulldeps/coverage-spanview-base/expected_mir_dump.partial_eq/partial_eq.{impl#7}-fmt.-------.InstrumentCoverage.0.html rename to src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.partial_eq/partial_eq.{impl#7}-fmt.-------.InstrumentCoverage.0.html index 65b95bae78d6e..195ef4da7b484 100644 --- a/src/test/run-make-fulldeps/coverage-spanview-base/expected_mir_dump.partial_eq/partial_eq.{impl#7}-fmt.-------.InstrumentCoverage.0.html +++ b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.partial_eq/partial_eq.{impl#7}-fmt.-------.InstrumentCoverage.0.html @@ -2,7 +2,7 @@ + + +simple_loop.main - Coverage Spans + + + +
@0,1,2,3⦊fn main() { + // Initialize test constants in a way that cannot be determined at compile time, to ensure + // rustc and LLVM cannot optimize out statements (or coverage counters) downstream from + // dependent conditions. + let is_true = std::env::args().len() == 1; + + let mut countdown = 0; + + if + is_true⦉@0,1,2,3 + @4,6⦊{ + countdown + = + 10 + ; + }⦉@4,6@5⦊⦉@5 + + loop + { + if + @8,9⦊countdown + == + 0⦉@8,9 + { + @10,12⦊break⦉@10,12 + ; + }@11,13⦊ + countdown + -= + 1⦉@11,13 + ; + } +}@10,12⦊⦉@10,12
+ + diff --git a/src/test/run-make-fulldeps/coverage-spanview-base/expected_mir_dump.simple_match/simple_match.main.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.simple_match/simple_match.main.-------.InstrumentCoverage.0.html similarity index 63% rename from src/test/run-make-fulldeps/coverage-spanview-base/expected_mir_dump.simple_match/simple_match.main.-------.InstrumentCoverage.0.html rename to src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.simple_match/simple_match.main.-------.InstrumentCoverage.0.html index 2488ac563e77e..a8bae32490b0b 100644 --- a/src/test/run-make-fulldeps/coverage-spanview-base/expected_mir_dump.simple_match/simple_match.main.-------.InstrumentCoverage.0.html +++ b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.simple_match/simple_match.main.-------.InstrumentCoverage.0.html @@ -2,7 +2,7 @@ + + +used_crate.unused_function - Coverage Spans + + + +
@0,1,2,3⦊pub fn unused_function() { + let is_true = std::env::args().len() == 1; + let mut countdown = 2; + if !is_true⦉@0,1,2,3 @4,6⦊{ + countdown = 20; + }⦉@4,6@5⦊⦉@5 +}@7⦊⦉@7
+ + diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.used_crate/used_crate.unused_generic_function.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.used_crate/used_crate.unused_generic_function.-------.InstrumentCoverage.0.html new file mode 100644 index 0000000000000..6b0ce85c4606f --- /dev/null +++ b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.used_crate/used_crate.unused_generic_function.-------.InstrumentCoverage.0.html @@ -0,0 +1,133 @@ + + + + +used_crate.unused_generic_function - Coverage Spans + + + +
@0,1,2,3,4⦊pub fn unused_generic_function<T: Debug>(arg: T) { + println!("unused_generic_function with {:?}", arg); +}⦉@0,1,2,3,4
+ + diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.used_crate/used_crate.unused_private_function.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.used_crate/used_crate.unused_private_function.-------.InstrumentCoverage.0.html new file mode 100644 index 0000000000000..361c57930229a --- /dev/null +++ b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.used_crate/used_crate.unused_private_function.-------.InstrumentCoverage.0.html @@ -0,0 +1,119 @@ + + + + +used_crate.unused_private_function - Coverage Spans + + + +
@0,1,2,3⦊fn unused_private_function() { + let is_true = std::env::args().len() == 1; + let mut countdown = 2; + if !is_true⦉@0,1,2,3 @4,6⦊{ + countdown = 20; + }⦉@4,6@5⦊⦉@5 +}@7⦊⦉@7
+ + diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.used_crate/used_crate.use_this_lib_crate.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.used_crate/used_crate.use_this_lib_crate.-------.InstrumentCoverage.0.html new file mode 100644 index 0000000000000..bed5e7bb7ce88 --- /dev/null +++ b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.used_crate/used_crate.use_this_lib_crate.-------.InstrumentCoverage.0.html @@ -0,0 +1,190 @@ + + + + +used_crate.use_this_lib_crate - Coverage Spans + + + +
@0,1,2,3,4,5,6,7,8⦊fn use_this_lib_crate() { + used_from_bin_crate_and_lib_crate_generic_function("used from library used_crate.rs"); + used_with_same_type_from_bin_crate_and_lib_crate_generic_function( + "used from library used_crate.rs", + ); + let some_vec = vec![5, 6, 7, 8]; + used_only_from_this_lib_crate_generic_function(some_vec); + used_only_from_this_lib_crate_generic_function("used ONLY from library used_crate.rs"); +}⦉@0,1,2,3,4,5,6,7,8
+ + diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.used_crate/used_crate.used_from_bin_crate_and_lib_crate_generic_function.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.used_crate/used_crate.used_from_bin_crate_and_lib_crate_generic_function.-------.InstrumentCoverage.0.html new file mode 100644 index 0000000000000..8b994a6962b83 --- /dev/null +++ b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.used_crate/used_crate.used_from_bin_crate_and_lib_crate_generic_function.-------.InstrumentCoverage.0.html @@ -0,0 +1,133 @@ + + + + +used_crate.used_from_bin_crate_and_lib_crate_generic_function - Coverage Spans + + + +
@0,1,2,3,4⦊pub fn used_from_bin_crate_and_lib_crate_generic_function<T: Debug>(arg: T) { + println!("used_from_bin_crate_and_lib_crate_generic_function with {:?}", arg); +}⦉@0,1,2,3,4
+ + diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.used_crate/used_crate.used_function.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.used_crate/used_crate.used_function.-------.InstrumentCoverage.0.html new file mode 100644 index 0000000000000..2ffd9bfb82386 --- /dev/null +++ b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.used_crate/used_crate.used_function.-------.InstrumentCoverage.0.html @@ -0,0 +1,113 @@ + + + + +used_crate.used_function - Coverage Spans + + + +
@0,1,2,3⦊pub fn used_function() ⦉@0,1,2,3{ + // Initialize test constants in a way that cannot be determined at compile time, to ensure + // rustc and LLVM cannot optimize out statements (or coverage counters) downstream from + // dependent conditions. + let @0,1,2,3⦊is_true = std::env::args().len() == 1; + let mut countdown = 0; + if is_true⦉@0,1,2,3 @4,6⦊{ + countdown = 10; + }⦉@4,6@5⦊⦉@5 + @7,8⦊use_this_lib_crate(); +}⦉@7,8
+ + diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.used_crate/used_crate.used_only_from_bin_crate_generic_function.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.used_crate/used_crate.used_only_from_bin_crate_generic_function.-------.InstrumentCoverage.0.html new file mode 100644 index 0000000000000..29fe03382c7f0 --- /dev/null +++ b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.used_crate/used_crate.used_only_from_bin_crate_generic_function.-------.InstrumentCoverage.0.html @@ -0,0 +1,133 @@ + + + + +used_crate.used_only_from_bin_crate_generic_function - Coverage Spans + + + +
@0,1,2,3,4⦊pub fn used_only_from_bin_crate_generic_function<T: Debug>(arg: T) { + println!("used_only_from_bin_crate_generic_function with {:?}", arg); +}⦉@0,1,2,3,4
+ + diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.used_crate/used_crate.used_only_from_this_lib_crate_generic_function.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.used_crate/used_crate.used_only_from_this_lib_crate_generic_function.-------.InstrumentCoverage.0.html new file mode 100644 index 0000000000000..76bc057dd00a9 --- /dev/null +++ b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.used_crate/used_crate.used_only_from_this_lib_crate_generic_function.-------.InstrumentCoverage.0.html @@ -0,0 +1,133 @@ + + + + +used_crate.used_only_from_this_lib_crate_generic_function - Coverage Spans + + + +
@0,1,2,3,4⦊pub fn used_only_from_this_lib_crate_generic_function<T: Debug>(arg: T) { + println!("used_only_from_this_lib_crate_generic_function with {:?}", arg); +}⦉@0,1,2,3,4
+ + diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.used_crate/used_crate.used_with_same_type_from_bin_crate_and_lib_crate_generic_function.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.used_crate/used_crate.used_with_same_type_from_bin_crate_and_lib_crate_generic_function.-------.InstrumentCoverage.0.html new file mode 100644 index 0000000000000..a2f4b7e19ebdd --- /dev/null +++ b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.used_crate/used_crate.used_with_same_type_from_bin_crate_and_lib_crate_generic_function.-------.InstrumentCoverage.0.html @@ -0,0 +1,133 @@ + + + + +used_crate.used_with_same_type_from_bin_crate_and_lib_crate_generic_function - Coverage Spans + + + +
@0,1,2,3,4⦊pub fn used_with_same_type_from_bin_crate_and_lib_crate_generic_function<T: Debug>(arg: T) { + println!("used_with_same_type_from_bin_crate_and_lib_crate_generic_function with {:?}", arg); +}⦉@0,1,2,3,4
+ + diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.uses_crate/uses_crate.main.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.uses_crate/uses_crate.main.-------.InstrumentCoverage.0.html new file mode 100644 index 0000000000000..acb2c7d63f51b --- /dev/null +++ b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.uses_crate/uses_crate.main.-------.InstrumentCoverage.0.html @@ -0,0 +1,193 @@ + + + + +uses_crate.main - Coverage Spans + + + +
@0,1,2,3,4,5,6,7,8,9⦊fn main() { + used_crate::used_function(); + let some_vec = vec![1, 2, 3, 4]; + used_crate::used_only_from_bin_crate_generic_function(&some_vec); + used_crate::used_only_from_bin_crate_generic_function("used from bin uses_crate.rs"); + used_crate::used_from_bin_crate_and_lib_crate_generic_function(some_vec); + used_crate::used_with_same_type_from_bin_crate_and_lib_crate_generic_function("interesting?"); +}⦉@0,1,2,3,4,5,6,7,8,9
+ + diff --git a/src/test/run-make-fulldeps/coverage-spanview-base/expected_mir_dump.while/while.main.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.while/while.main.-------.InstrumentCoverage.0.html similarity index 85% rename from src/test/run-make-fulldeps/coverage-spanview-base/expected_mir_dump.while/while.main.-------.InstrumentCoverage.0.html rename to src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.while/while.main.-------.InstrumentCoverage.0.html index 3ba5135122b93..f037a8ee5c52f 100644 --- a/src/test/run-make-fulldeps/coverage-spanview-base/expected_mir_dump.while/while.main.-------.InstrumentCoverage.0.html +++ b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.while/while.main.-------.InstrumentCoverage.0.html @@ -2,7 +2,7 @@ -partial_eq.{impl#2}-le-{closure#0} - Coverage Spans +yield.main-{closure#0} - Coverage Spans -
major: usize, - @0,1,2,3⦊⦉@0,1,2,3minor: usize
+
|| @0⦊{ + yield 1⦉@0; + return @1⦊"foo" + }⦉@1
diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.yield/yield.main-{closure#1}.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.yield/yield.main-{closure#1}.-------.InstrumentCoverage.0.html new file mode 100644 index 0000000000000..842d7823bfd12 --- /dev/null +++ b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.yield/yield.main-{closure#1}.-------.InstrumentCoverage.0.html @@ -0,0 +1,81 @@ + + + + +yield.main-{closure#1} - Coverage Spans + + + +
|| @0⦊{ + yield 1⦉@0; + @1⦊yield 2⦉@1; + @2⦊yield 3⦉@2; + return @3⦊"foo" + }⦉@3
+ + diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.yield/yield.main.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.yield/yield.main.-------.InstrumentCoverage.0.html new file mode 100644 index 0000000000000..99e56393ea599 --- /dev/null +++ b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.yield/yield.main.-------.InstrumentCoverage.0.html @@ -0,0 +1,138 @@ + + + + +yield.main - Coverage Spans + + + +
@0,1,2⦊fn main() ⦉@0,1,2{ + let @0,1,2⦊mut generator⦉@0,1,2 = || { + yield 1; + return "foo" + }; + + match @0,1,2⦊Pin::new(&mut generator).resume(()) { + GeneratorState::Yielded(1)⦉@0,1,2 => @4,6,7,8⦊{}⦉@4,6,7,8 + _ => @5⦊panic!("unexpected value from resume")⦉@5, + } + match @4,6,7,8⦊Pin::new(&mut generator).resume(())⦉@4,6,7,8 { + GeneratorState::Complete(@10,11⦊"foo"⦉@10,11) => @12,13,14,15⦊{}⦉@12,13,14,15 + _ => @9⦊panic!("unexpected value from resume")⦉@9, + } + + let @12,13,14,15⦊mut generator⦉@12,13,14,15 = || { + yield 1; + yield 2; + yield 3; + return "foo" + }; + + match @12,13,14,15⦊Pin::new(&mut generator).resume(()) { + GeneratorState::Yielded(1)⦉@12,13,14,15 => @17,19,20,21⦊{}⦉@17,19,20,21 + _ => @18⦊panic!("unexpected value from resume")⦉@18, + } + match @17,19,20,21⦊Pin::new(&mut generator).resume(()) { + GeneratorState::Yielded(2)⦉@17,19,20,21 => @23,25⦊{}⦉@23,25 + _ => @24⦊panic!("unexpected value from resume")⦉@24, + } +}@23,25⦊⦉@23,25
+ + diff --git a/src/test/run-make-fulldeps/coverage/abort.rs b/src/test/run-make-fulldeps/coverage/abort.rs new file mode 100644 index 0000000000000..52c6ff333e4ea --- /dev/null +++ b/src/test/run-make-fulldeps/coverage/abort.rs @@ -0,0 +1,67 @@ +#![feature(unwind_attributes)] +#![allow(unused_assignments)] + +#[unwind(aborts)] +fn might_abort(should_abort: bool) { + if should_abort { + println!("aborting..."); + panic!("panics and aborts"); + } else { + println!("Don't Panic"); + } +} + +fn main() -> Result<(), u8> { + let mut countdown = 10; + while countdown > 0 { + if countdown < 5 { + might_abort(false); + } + // See discussion (below the `Notes` section) on coverage results for the closing brace. + if countdown < 5 { might_abort(false); } // Counts for different regions on one line. + // For the following example, the closing brace is the last character on the line. + // This shows the character after the closing brace is highlighted, even if that next + // character is a newline. + if countdown < 5 { might_abort(false); } + countdown -= 1; + } + Ok(()) +} + +// Notes: +// 1. Compare this program and its coverage results to those of the similar tests +// `panic_unwind.rs` and `try_error_result.rs`. +// 2. This test confirms the coverage generated when a program includes `TerminatorKind::Abort`. +// 3. The test does not invoke the abort. By executing to a successful completion, the coverage +// results show where the program did and did not execute. +// 4. If the program actually aborted, the coverage counters would not be saved (which "works as +// intended"). Coverage results would show no executed coverage regions. +// 6. If `should_abort` is `true` and the program aborts, the program exits with a `132` status +// (on Linux at least). + +/* + +Expect the following coverage results: + +```text + 16| 11| while countdown > 0 { + 17| 10| if countdown < 5 { + 18| 4| might_abort(false); + 19| 6| } +``` + +This is actually correct. + +The condition `countdown < 5` executed 10 times (10 loop iterations). + +It evaluated to `true` 4 times, and executed the `might_abort()` call. + +It skipped the body of the `might_abort()` call 6 times. If an `if` does not include an explicit +`else`, the coverage implementation injects a counter, at the character immediately after the `if`s +closing brace, to count the "implicit" `else`. This is the only way to capture the coverage of the +non-true condition. + +As another example of why this is important, say the condition was `countdown < 50`, which is always +`true`. In that case, we wouldn't have a test for what happens if `might_abort()` is not called. +The closing brace would have a count of `0`, highlighting the missed coverage. +*/ diff --git a/src/test/run-make-fulldeps/coverage/assert.rs b/src/test/run-make-fulldeps/coverage/assert.rs new file mode 100644 index 0000000000000..c85f2748eb9d8 --- /dev/null +++ b/src/test/run-make-fulldeps/coverage/assert.rs @@ -0,0 +1,32 @@ +#![allow(unused_assignments)] +// expect-exit-status-101 + +fn might_fail_assert(one_plus_one: u32) { + println!("does 1 + 1 = {}?", one_plus_one); + assert_eq!(1 + 1, one_plus_one, "the argument was wrong"); +} + +fn main() -> Result<(),u8> { + let mut countdown = 10; + while countdown > 0 { + if countdown == 1 { + might_fail_assert(3); + } else if countdown < 5 { + might_fail_assert(2); + } + countdown -= 1; + } + Ok(()) +} + +// Notes: +// 1. Compare this program and its coverage results to those of the very similar test +// `panic_unwind.rs`, and similar tests `abort.rs` and `try_error_result.rs`. +// 2. This test confirms the coverage generated when a program passes or fails an `assert!()` or +// related `assert_*!()` macro. +// 3. Notably, the `assert` macros *do not* generate `TerminatorKind::Assert`. The macros produce +// conditional expressions, `TerminatorKind::SwitchInt` branches, and a possible call to +// `begin_panic_fmt()` (that begins a panic unwind, if the assertion test fails). +// 4. `TerminatoKind::Assert` is, however, also present in the MIR generated for this test +// (and in many other coverage tests). The `Assert` terminator is typically generated by the +// Rust compiler to check for runtime failures, such as numeric overflows. diff --git a/src/test/run-make-fulldeps/coverage/async.rs b/src/test/run-make-fulldeps/coverage/async.rs new file mode 100644 index 0000000000000..5553af92465ca --- /dev/null +++ b/src/test/run-make-fulldeps/coverage/async.rs @@ -0,0 +1,128 @@ +#![allow(unused_assignments, dead_code)] + +// require-rust-edition-2018 + +async fn c(x: u8) -> u8 { + if x == 8 { + 1 + } else { + 0 + } +} + +async fn d() -> u8 { 1 } + +async fn e() -> u8 { 1 } // unused function; executor does not block on `g()` + +async fn f() -> u8 { 1 } + +async fn foo() -> [bool; 10] { [false; 10] } // unused function; executor does not block on `h()` + +pub async fn g(x: u8) { + match x { + y if e().await == y => (), + y if f().await == y => (), + _ => (), + } +} + +async fn h(x: usize) { // The function signature is counted when called, but the body is not + // executed (not awaited) so the open brace has a `0` count (at least when + // displayed with `llvm-cov show` in color-mode). + match x { + y if foo().await[y] => (), + _ => (), + } +} + +async fn i(x: u8) { // line coverage is 1, but there are 2 regions: + // (a) the function signature, counted when the function is called; and + // (b) the open brace for the function body, counted once when the body is + // executed asynchronously. + match x { + y if c(x).await == y + 1 => { d().await; } + y if f().await == y + 1 => (), + _ => (), + } +} + +fn j(x: u8) { + // non-async versions of `c()`, `d()`, and `f()` to make it similar to async `i()`. + fn c(x: u8) -> u8 { + if x == 8 { + 1 // This line appears covered, but the 1-character expression span covering the `1` + // is not executed. (`llvm-cov show` displays a `^0` below the `1` ). This is because + // `fn j()` executes the open brace for the funciton body, followed by the function's + // first executable statement, `match x`. Inner function declarations are not + // "visible" to the MIR for `j()`, so the code region counts all lines between the + // open brace and the first statement as executed, which is, in a sense, true. + // `llvm-cov show` overcomes this kind of situation by showing the actual counts + // of the enclosed coverages, (that is, the `1` expression was not executed, and + // accurately displays a `0`). + } else { + 0 + } + } + fn d() -> u8 { 1 } + fn f() -> u8 { 1 } + match x { + y if c(x) == y + 1 => { d(); } + y if f() == y + 1 => (), + _ => (), + } +} + +fn k(x: u8) { // unused function + match x { + 1 => (), + 2 => (), + _ => (), + } +} + +fn l(x: u8) { + match x { + 1 => (), + 2 => (), + _ => (), + } +} + +async fn m(x: u8) -> u8 { x - 1 } + +fn main() { + let _ = g(10); + let _ = h(9); + let mut future = Box::pin(i(8)); + j(7); + l(6); + let _ = m(5); + executor::block_on(future.as_mut()); +} + +mod executor { + use core::{ + future::Future, + pin::Pin, + task::{Context, Poll, RawWaker, RawWakerVTable, Waker}, + }; + + pub fn block_on(mut future: F) -> F::Output { + let mut future = unsafe { Pin::new_unchecked(&mut future) }; + + static VTABLE: RawWakerVTable = RawWakerVTable::new( + |_| unimplemented!("clone"), + |_| unimplemented!("wake"), + |_| unimplemented!("wake_by_ref"), + |_| (), + ); + let waker = unsafe { Waker::from_raw(RawWaker::new(core::ptr::null(), &VTABLE)) }; + let mut context = Context::from_waker(&waker); + + loop { + if let Poll::Ready(val) = future.as_mut().poll(&mut context) { + break val; + } + } + } +} diff --git a/src/test/run-make-fulldeps/coverage/closure.rs b/src/test/run-make-fulldeps/coverage/closure.rs index 66bbbc55399fe..914cb0fe051c7 100644 --- a/src/test/run-make-fulldeps/coverage/closure.rs +++ b/src/test/run-make-fulldeps/coverage/closure.rs @@ -90,4 +90,66 @@ fn main() { a ) ); + + let + quote_closure + = + |val| + { + let mut countdown = 0; + if is_false { + countdown = 10; + } + format!("'{}'", val) + }; + println!( + "Repeated, quoted string: {:?}" + , + std::iter::repeat("repeat me") + .take(5) + .map + ( + quote_closure + ) + .collect::>() + ); + + let + _unused_closure + = + | + mut countdown + | + { + if is_false { + countdown = 10; + } + "closure should be unused".to_owned() + }; + + let mut countdown = 10; + let _short_unused_closure = | _unused_arg: u8 | countdown += 1; + + // Macros can sometimes confuse the coverage results. Compare this next assignment, with an + // unused closure that invokes the `println!()` macro, with the closure assignment above, that + // does not use a macro. The closure above correctly shows `0` executions. + let _short_unused_closure = | _unused_arg: u8 | println!("not called"); + // The closure assignment above is executed, with a line count of `1`, but the `println!()` + // could not have been called, and yet, there is no indication that it wasn't... + + // ...but adding block braces gives the expected result, showing the block was not executed. + let _short_unused_closure_block = | _unused_arg: u8 | { println!("not called") }; + + let _shortish_unused_closure = | _unused_arg: u8 | { + println!("not called") + }; + + let _as_short_unused_closure = | + _unused_arg: u8 + | { println!("not called") }; + + let _almost_as_short_unused_closure = | + _unused_arg: u8 + | { println!("not called") } + ; } diff --git a/src/test/run-make-fulldeps/coverage/conditions.rs b/src/test/run-make-fulldeps/coverage/conditions.rs index da206e28f31da..8a2a0b53e5862 100644 --- a/src/test/run-make-fulldeps/coverage/conditions.rs +++ b/src/test/run-make-fulldeps/coverage/conditions.rs @@ -36,6 +36,26 @@ fn main() { return; } + if true { + let mut countdown = 0; + if true { + countdown = 10; + } + + if countdown > 7 { + countdown -= 4; + } + else if countdown > 2 { + if countdown < 1 || countdown > 5 || countdown != 9 { + countdown = 0; + } + countdown -= 5; + } else { + return; + } + } // Note: closing brace shows uncovered (vs. `0` for implicit else) because condition literal + // `true` was const-evaluated. The compiler knows the `if` block will be executed. + let mut countdown = 0; if true { countdown = 1; diff --git a/src/test/run-make-fulldeps/coverage/coverage_tools.mk b/src/test/run-make-fulldeps/coverage/coverage_tools.mk index 99a2e0ba9523e..7dc485cd94d66 100644 --- a/src/test/run-make-fulldeps/coverage/coverage_tools.mk +++ b/src/test/run-make-fulldeps/coverage/coverage_tools.mk @@ -2,39 +2,16 @@ # file with the line: # # -include ../instrument-coverage/coverage_tools.mk -# -# To enable the Rust compiler option `-C link-dead-code`, also set the following variable -# *BEFORE* the `-include` line: -# -# LINK_DEAD_CODE=yes -include ../tools.mk -ifndef LINK_DEAD_CODE - LINK_DEAD_CODE=no -endif - # ISSUE(76038): When targeting MSVC, Rust binaries built with both `-Z instrument-coverage` and # `-C link-dead-code` typically crash (with a seg-fault) or at best generate an empty `*.profraw` # file, required for coverage reports. # -# Enabling `-C link-dead-code` is preferred when compiling with `-Z instrument-coverage`, so -# `-C link-dead-code` is automatically enabled for all platform targets _except_ MSVC. -# -# Making the state of `-C link-dead-code` platform-dependent creates a problem for cross-platform -# tests because the injected counters, coverage reports, and some low-level output can be different, -# depending on the `-C link-dead-code` setting. For example, coverage reports will not report any -# coverage for a dead code region when the `-C link-dead-code` option is disabled, but with the -# option enabled, those same regions will show coverage counter values (of zero, of course). -# -# To ensure cross-platform `-Z instrument-coverage` generate consistent output, the -# `-C link-dead-code` option is always explicitly enabled or disabled. -# -# Since tests that execute binaries enabled with both `-Z instrument-coverage` and -# `-C link-dead-code` are known to fail, those tests will need the `# ignore-msvc` setting. -# -# If and when the above issue is resolved, the `# ignore-msvc` option can be removed, and the -# tests can be simplified to always test with `-C link-dead-code`. +# Enabling `-C link-dead-code` is not necessary when compiling with `-Z instrument-coverage`, +# due to improvements in the coverage map generation, to add unreachable functions known to Rust. +# Therefore, `-C link-dead-code` is no longer automatically enabled. UNAME = $(shell uname) @@ -44,8 +21,3 @@ LLVM_VERSION_11_PLUS := $(shell \ LLVM_VERSION=$$("$(LLVM_BIN_DIR)"/llvm-config --version) && \ LLVM_VERSION_MAJOR=$${LLVM_VERSION/.*/} && \ [ $$LLVM_VERSION_MAJOR -ge 11 ] && echo true || echo false) - -# FIXME(richkadel): Can any of the features tested by `run-make-fulldeps/coverage-*` tests be tested -# just as completely by more focused unit tests of the code logic itself, to reduce the number of -# test result files generated and maintained, and to help identify specific test failures and root -# causes more easily? diff --git a/src/test/run-make-fulldeps/coverage/dead_code.rs b/src/test/run-make-fulldeps/coverage/dead_code.rs new file mode 100644 index 0000000000000..a1285df0ec62a --- /dev/null +++ b/src/test/run-make-fulldeps/coverage/dead_code.rs @@ -0,0 +1,37 @@ +#![allow(unused_assignments, unused_variables)] + +pub fn unused_pub_fn_not_in_library() { + // Initialize test constants in a way that cannot be determined at compile time, to ensure + // rustc and LLVM cannot optimize out statements (or coverage counters) downstream from + // dependent conditions. + let is_true = std::env::args().len() == 1; + + let mut countdown = 0; + if is_true { + countdown = 10; + } +} + +fn unused_fn() { + // Initialize test constants in a way that cannot be determined at compile time, to ensure + // rustc and LLVM cannot optimize out statements (or coverage counters) downstream from + // dependent conditions. + let is_true = std::env::args().len() == 1; + + let mut countdown = 0; + if is_true { + countdown = 10; + } +} + +fn main() { + // Initialize test constants in a way that cannot be determined at compile time, to ensure + // rustc and LLVM cannot optimize out statements (or coverage counters) downstream from + // dependent conditions. + let is_true = std::env::args().len() == 1; + + let mut countdown = 0; + if is_true { + countdown = 10; + } +} diff --git a/src/test/run-make-fulldeps/coverage/generics.rs b/src/test/run-make-fulldeps/coverage/generics.rs index f4e6402694480..cbeda35d3b8cf 100644 --- a/src/test/run-make-fulldeps/coverage/generics.rs +++ b/src/test/run-make-fulldeps/coverage/generics.rs @@ -30,7 +30,11 @@ fn main() -> Result<(),u8> { if true { println!("Exiting with error..."); return Err(1); - } + } // The remaining lines below have no coverage because `if true` (with the constant literal + // `true`) is guaranteed to execute the `then` block, which is also guaranteed to `return`. + // Thankfully, in the normal case, conditions are not guaranteed ahead of time, and as shown + // in other tests, the lines below would have coverage (which would show they had `0` + // executions, assuming the condition still evaluated to `true`). let _ = Firework { strength: 1000 }; diff --git a/src/test/run-make-fulldeps/coverage/if_else.rs b/src/test/run-make-fulldeps/coverage/if_else.rs index 3ae4b7a7316bd..3244e1e3afd2b 100644 --- a/src/test/run-make-fulldeps/coverage/if_else.rs +++ b/src/test/run-make-fulldeps/coverage/if_else.rs @@ -1,4 +1,4 @@ -#![allow(unused_assignments)] +#![allow(unused_assignments, unused_variables)] fn main() { // Initialize test constants in a way that cannot be determined at compile time, to ensure diff --git a/src/test/run-make-fulldeps/coverage/inner_items.rs b/src/test/run-make-fulldeps/coverage/inner_items.rs index 66e76513e2692..bcb62b3031cd9 100644 --- a/src/test/run-make-fulldeps/coverage/inner_items.rs +++ b/src/test/run-make-fulldeps/coverage/inner_items.rs @@ -1,4 +1,4 @@ -#![allow(unused_assignments, unused_variables)] +#![allow(unused_assignments, unused_variables, dead_code)] fn main() { // Initialize test constants in a way that cannot be determined at compile time, to ensure diff --git a/src/test/run-make-fulldeps/coverage/lib/used_crate.rs b/src/test/run-make-fulldeps/coverage/lib/used_crate.rs new file mode 100644 index 0000000000000..e5555f9193576 --- /dev/null +++ b/src/test/run-make-fulldeps/coverage/lib/used_crate.rs @@ -0,0 +1,104 @@ +#![allow(unused_assignments, unused_variables)] + +use std::fmt::Debug; + +pub fn used_function() { + // Initialize test constants in a way that cannot be determined at compile time, to ensure + // rustc and LLVM cannot optimize out statements (or coverage counters) downstream from + // dependent conditions. + let is_true = std::env::args().len() == 1; + let mut countdown = 0; + if is_true { + countdown = 10; + } + use_this_lib_crate(); +} + +pub fn used_only_from_bin_crate_generic_function(arg: T) { + println!("used_only_from_bin_crate_generic_function with {:?}", arg); +} + +pub fn used_only_from_this_lib_crate_generic_function(arg: T) { + println!("used_only_from_this_lib_crate_generic_function with {:?}", arg); +} + +pub fn used_from_bin_crate_and_lib_crate_generic_function(arg: T) { + println!("used_from_bin_crate_and_lib_crate_generic_function with {:?}", arg); +} + +pub fn used_with_same_type_from_bin_crate_and_lib_crate_generic_function(arg: T) { + println!("used_with_same_type_from_bin_crate_and_lib_crate_generic_function with {:?}", arg); +} + +pub fn unused_generic_function(arg: T) { + println!("unused_generic_function with {:?}", arg); +} + +pub fn unused_function() { + let is_true = std::env::args().len() == 1; + let mut countdown = 2; + if !is_true { + countdown = 20; + } +} + +fn unused_private_function() { + let is_true = std::env::args().len() == 1; + let mut countdown = 2; + if !is_true { + countdown = 20; + } +} + +fn use_this_lib_crate() { + used_from_bin_crate_and_lib_crate_generic_function("used from library used_crate.rs"); + used_with_same_type_from_bin_crate_and_lib_crate_generic_function( + "used from library used_crate.rs", + ); + let some_vec = vec![5, 6, 7, 8]; + used_only_from_this_lib_crate_generic_function(some_vec); + used_only_from_this_lib_crate_generic_function("used ONLY from library used_crate.rs"); +} + +// FIXME(#79651): `used_from_bin_crate_and_lib_crate_generic_function()` is covered and executed +// `2` times, but the coverage output also shows (at the bottom of the coverage report): +// ------------------ +// | Unexecuted instantiation: +// ------------------ +// +// Note, the function name shown in the error seems to change depending on the structure of the +// code, for some reason, including: +// +// * used_crate::used_from_bin_crate_and_lib_crate_generic_function::<&str> +// * used_crate::use_this_lib_crate +// +// The `Unexecuted instantiation` error may be related to more than one generic function. Since the +// reporting is not consistent, it may not be obvious if there are multiple problems here; however, +// `used_crate::used_from_bin_crate_and_lib_crate_generic_function::<&str>` (which I have seen +// with this error) is the only generic function missing instantiaion coverage counts. +// +// The `&str` variant was called from within this `lib` crate, and the `bin` crate also calls this +// function, but with `T` type `&Vec`. +// +// I believe the reason is that one or both crates are generating `Zero` counters for what it +// believes are "Unreachable" instantiations, but those instantiations are counted from the +// coverage map in the other crate. +// +// See `add_unreachable_coverage()` in `mapgen.rs` for more on how these `Zero` counters are added +// for what the funciton believes are `DefId`s that did not get codegenned. I suspect the issue +// may be related to this process, but this needs to be confirmed. It may not be possible to know +// for sure if a function is truly unused and should be reported with `Zero` coverage if it may +// still get used from an external crate. (Something to look at: If the `DefId` in MIR corresponds +// _only_ to the generic function without type parameters, is the `DefId` in the codegenned set, +// instantiated with one of the type parameters (in either or both crates) a *different* `DefId`? +// If so, `add_unreachable_coverage()` would assume the MIR `DefId` was uncovered, and would add +// unreachable coverage. +// +// I didn't think they could be different, but if they can, we would need to find the `DefId` for +// the generic function MIR and include it in the set of "codegenned" DefIds if any instantiation +// of that generic function does exist. +// +// Note, however, for `used_with_same_type_from_bin_crate_and_lib_crate_generic_function()` both +// crates use this function with the same type variant. The function does not have multiple +// instantiations, so the coverage analysis is not confused. No "Unexecuted instantiations" errors +// are reported. diff --git a/src/test/run-make-fulldeps/coverage/loop_break_value.rs b/src/test/run-make-fulldeps/coverage/loop_break_value.rs index ba66d136de1e3..dbc4fad7a2316 100644 --- a/src/test/run-make-fulldeps/coverage/loop_break_value.rs +++ b/src/test/run-make-fulldeps/coverage/loop_break_value.rs @@ -1,4 +1,4 @@ -#![allow(unused_assignments)] +#![allow(unused_assignments, unused_variables)] fn main() { let result diff --git a/src/test/run-make-fulldeps/coverage/loops_branches.rs b/src/test/run-make-fulldeps/coverage/loops_branches.rs index a9df7e0fab75f..938421d32e7a5 100644 --- a/src/test/run-make-fulldeps/coverage/loops_branches.rs +++ b/src/test/run-make-fulldeps/coverage/loops_branches.rs @@ -1,4 +1,4 @@ -#![allow(unused_assignments)] +#![allow(unused_assignments, unused_variables, while_true)] // This test confirms an earlier problem was resolved, supporting the MIR graph generated by the // structure of this `fmt` function. diff --git a/src/test/run-make-fulldeps/coverage/overflow.rs b/src/test/run-make-fulldeps/coverage/overflow.rs new file mode 100644 index 0000000000000..e537b0e95c32a --- /dev/null +++ b/src/test/run-make-fulldeps/coverage/overflow.rs @@ -0,0 +1,63 @@ +#![allow(unused_assignments)] +// expect-exit-status-101 + +fn might_overflow(to_add: u32) -> u32 { + if to_add > 5 { + println!("this will probably overflow"); + } + let add_to = u32::MAX - 5; + println!("does {} + {} overflow?", add_to, to_add); + let result = to_add + add_to; + println!("continuing after overflow check"); + result +} + +fn main() -> Result<(),u8> { + let mut countdown = 10; + while countdown > 0 { + if countdown == 1 { + let result = might_overflow(10); + println!("Result: {}", result); + } else if countdown < 5 { + let result = might_overflow(1); + println!("Result: {}", result); + } + countdown -= 1; + } + Ok(()) +} + +// Notes: +// 1. Compare this program and its coverage results to those of the very similar test `assert.rs`, +// and similar tests `panic_unwind.rs`, abort.rs` and `try_error_result.rs`. +// 2. This test confirms the coverage generated when a program passes or fails a +// compiler-generated `TerminatorKind::Assert` (based on an overflow check, in this case). +// 3. Similar to how the coverage instrumentation handles `TerminatorKind::Call`, +// compiler-generated assertion failures are assumed to be a symptom of a program bug, not +// expected behavior. To simplify the coverage graphs and keep instrumented programs as +// small and fast as possible, `Assert` terminators are assumed to always succeed, and +// therefore are considered "non-branching" terminators. So, an `Assert` terminator does not +// get its own coverage counter. +// 4. After an unhandled panic or failed Assert, coverage results may not always be intuitive. +// In this test, the final count for the statements after the `if` block in `might_overflow()` +// is 4, even though the lines after `to_add + add_to` were executed only 3 times. Depending +// on the MIR graph and the structure of the code, this count could have been 3 (which might +// have been valid for the overflowed add `+`, but should have been 4 for the lines before +// the overflow. The reason for this potential uncertainty is, a `CounterKind` is incremented +// via StatementKind::Counter at the end of the block, but (as in the case in this test), +// a CounterKind::Expression is always evaluated. In this case, the expression was based on +// a `Counter` incremented as part of the evaluation of the `if` expression, which was +// executed, and counted, 4 times, before reaching the overflow add. + +// If the program did not overflow, the coverage for `might_overflow()` would look like this: +// +// 4| |fn might_overflow(to_add: u32) -> u32 { +// 5| 4| if to_add > 5 { +// 6| 0| println!("this will probably overflow"); +// 7| 4| } +// 8| 4| let add_to = u32::MAX - 5; +// 9| 4| println!("does {} + {} overflow?", add_to, to_add); +// 10| 4| let result = to_add + add_to; +// 11| 4| println!("continuing after overflow check"); +// 12| 4| result +// 13| 4|} diff --git a/src/test/run-make-fulldeps/coverage/panic_unwind.rs b/src/test/run-make-fulldeps/coverage/panic_unwind.rs new file mode 100644 index 0000000000000..b6c0c080762b2 --- /dev/null +++ b/src/test/run-make-fulldeps/coverage/panic_unwind.rs @@ -0,0 +1,49 @@ +#![allow(unused_assignments)] +// expect-exit-status-101 + +fn might_panic(should_panic: bool) { + if should_panic { + println!("panicking..."); + panic!("panics"); + } else { + println!("Don't Panic"); + } +} + +fn main() -> Result<(), u8> { + let mut countdown = 10; + while countdown > 0 { + if countdown == 1 { + might_panic(true); + } else if countdown < 5 { + might_panic(false); + } + countdown -= 1; + } + Ok(()) +} + +// Notes: +// 1. Compare this program and its coverage results to those of the similar tests `abort.rs` and +// `try_error_result.rs`. +// 2. Since the `panic_unwind.rs` test is allowed to unwind, it is also allowed to execute the +// normal program exit cleanup, including writing out the current values of the coverage +// counters. +// 3. The coverage results show (interestingly) that the `panic!()` call did execute, but it does +// not show coverage of the `if countdown == 1` branch in `main()` that calls +// `might_panic(true)` (causing the call to `panic!()`). +// 4. The reason `main()`s `if countdown == 1` branch, calling `might_panic(true)`, appears +// "uncovered" is, InstrumentCoverage (intentionally) treats `TerminatorKind::Call` terminators +// as non-branching, because when a program executes normally, they always are. Errors handled +// via the try `?` operator produce error handling branches that *are* treated as branches in +// coverage results. By treating calls without try `?` operators as non-branching (assumed to +// return normally and continue) the coverage graph can be simplified, producing smaller, +// faster binaries, and cleaner coverage results. +// 5. The reason the coverage results actually show `panic!()` was called is most likely because +// `panic!()` is a macro, not a simple function call, and there are other `Statement`s and/or +// `Terminator`s that execute with a coverage counter before the panic and unwind occur. +// 6. Since the common practice is not to use `panic!()` for error handling, the coverage +// implementation avoids incurring an additional cost (in program size and execution time) to +// improve coverage results for an event that is generally not "supposed" to happen. +// 7. FIXME(#78544): This issue describes a feature request for a proposed option to enable +// more accurate coverage results for tests that intentionally panic. diff --git a/src/test/run-make-fulldeps/coverage/partial_eq.rs b/src/test/run-make-fulldeps/coverage/partial_eq.rs index 334fb3364ccc4..7d265ba66a445 100644 --- a/src/test/run-make-fulldeps/coverage/partial_eq.rs +++ b/src/test/run-make-fulldeps/coverage/partial_eq.rs @@ -4,8 +4,8 @@ #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)] pub struct Version { major: usize, - minor: usize, - patch: usize, + minor: usize, // Count: 1 - `PartialOrd` compared `minor` values in 3.2.1 vs. 3.3.0 + patch: usize, // Count: 0 - `PartialOrd` was determined by `minor` (2 < 3) } impl Version { @@ -45,55 +45,17 @@ one expression, which is allowed, but the `function_source_hash` was only passed */ -// FIXME(richkadel): It may be worth investigating why the coverage report for this test produces -// the following results: - -/* - -1. Why are their two counts below different characters (first and last) of `PartialOrd`, on line 17? - -2. Line 17 is counted twice, but the `::lt` instance shows a line count of 1? Is there a missing - line count with a different instance? Or was it really only called once? - -3. Line 20 shows another line count (of 1) for a line within a `struct` declaration (on only one of - its 3 fields). I doubt the specific field (`minor`) is relevant, but rather I suspect there's a - problem computing the file position here, for some reason. - - - 16| | - 17| 2|#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)] - ^1 ^1 ------------------- -|Unexecuted instantiation: ::gt ------------------- -|Unexecuted instantiation: ::le ------------------- -|Unexecuted instantiation: ::ge ------------------- -|::lt: -| 17| 1|#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)] ------------------- - 18| |pub struct Version { - 19| | major: usize, - 20| 1| minor: usize, - 21| | patch: usize, - 22| |} - 23| | - 24| |impl Version { - 25| | pub fn new(major: usize, minor: usize, patch: usize) -> Self { - 26| 2| Version { - 27| 2| major, - 28| 2| minor, - 29| 2| patch, - 30| 2| } - 31| 2| } - 32| |} - 33| | - 34| 1|fn main() { - 35| 1| let version_3_2_1 = Version::new(3, 2, 1); - 36| 1| let version_3_3_0 = Version::new(3, 3, 0); - 37| 1| - 38| 1| println!("{:?} < {:?} = {}", version_3_2_1, version_3_3_0, version_3_2_1 < version -_3_3_0); - 39| 1|} -*/ +// FIXME(#79626): The derived traits get coverage, which is great, but some of the traits appear +// to get two coverage execution counts at different positions: +// +// ```text +// 4| 2|#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)] +// ^0 ^0 ^0 ^0 ^1 ^0 ^0^0 +// ```text +// +// `PartialEq`, `PartialOrd`, and `Ord` (and possibly `Eq`, if the trait name was longer than 2 +// characters) have counts at their first and last characters. +// +// Why is this? Why does `PartialOrd` have two values (1 and 0)? This must mean we are checking +// distinct coverages, so maybe we don't want to eliminate one of them. Should we merge them? +// If merged, do we lose some information? diff --git a/src/test/run-make-fulldeps/coverage/simple_match.rs b/src/test/run-make-fulldeps/coverage/simple_match.rs index c9a24f7a9d35d..be99e59a82685 100644 --- a/src/test/run-make-fulldeps/coverage/simple_match.rs +++ b/src/test/run-make-fulldeps/coverage/simple_match.rs @@ -1,4 +1,4 @@ -#![allow(unused_assignments)] +#![allow(unused_assignments, unused_variables)] fn main() { // Initialize test constants in a way that cannot be determined at compile time, to ensure diff --git a/src/test/run-make-fulldeps/coverage/uses_crate.rs b/src/test/run-make-fulldeps/coverage/uses_crate.rs new file mode 100644 index 0000000000000..8d24b1ca3e67b --- /dev/null +++ b/src/test/run-make-fulldeps/coverage/uses_crate.rs @@ -0,0 +1,12 @@ +#![allow(unused_assignments, unused_variables)] + +extern crate used_crate; + +fn main() { + used_crate::used_function(); + let some_vec = vec![1, 2, 3, 4]; + used_crate::used_only_from_bin_crate_generic_function(&some_vec); + used_crate::used_only_from_bin_crate_generic_function("used from bin uses_crate.rs"); + used_crate::used_from_bin_crate_and_lib_crate_generic_function(some_vec); + used_crate::used_with_same_type_from_bin_crate_and_lib_crate_generic_function("interesting?"); +} diff --git a/src/test/run-make-fulldeps/coverage/while_early_ret.rs b/src/test/run-make-fulldeps/coverage/while_early_ret.rs index 14ba36238d62f..1fcea9c85c44a 100644 --- a/src/test/run-make-fulldeps/coverage/while_early_ret.rs +++ b/src/test/run-make-fulldeps/coverage/while_early_ret.rs @@ -40,8 +40,3 @@ fn main() -> Result<(),u8> { // and MacOS. But on Windows (MSVC, at least), the call to `std::process::exit()` exits the program // without saving the InstrProf coverage counters. The use of `std::process:exit()` is not critical // to the coverage test for early returns, but this is a limitation that should be fixed. -// -// FIXME(richkadel): Consider creating a new tests for coverage when calling `std::process::exit()`, -// move the `ISSUE` comment to that test, and implement a new test directive that supports skipping -// coverage tests when targeting specific platforms (at least skipping Windows, or MSVC if the -// problem exists on MSVC only). diff --git a/src/test/run-make-fulldeps/coverage/yield.rs b/src/test/run-make-fulldeps/coverage/yield.rs new file mode 100644 index 0000000000000..ff7616656ff50 --- /dev/null +++ b/src/test/run-make-fulldeps/coverage/yield.rs @@ -0,0 +1,37 @@ +#![feature(generators, generator_trait)] +#![allow(unused_assignments)] + +use std::ops::{Generator, GeneratorState}; +use std::pin::Pin; + +fn main() { + let mut generator = || { + yield 1; + return "foo" + }; + + match Pin::new(&mut generator).resume(()) { + GeneratorState::Yielded(1) => {} + _ => panic!("unexpected value from resume"), + } + match Pin::new(&mut generator).resume(()) { + GeneratorState::Complete("foo") => {} + _ => panic!("unexpected value from resume"), + } + + let mut generator = || { + yield 1; + yield 2; + yield 3; + return "foo" + }; + + match Pin::new(&mut generator).resume(()) { + GeneratorState::Yielded(1) => {} + _ => panic!("unexpected value from resume"), + } + match Pin::new(&mut generator).resume(()) { + GeneratorState::Yielded(2) => {} + _ => panic!("unexpected value from resume"), + } +} diff --git a/src/tools/compiletest/src/main.rs b/src/tools/compiletest/src/main.rs index 0541548aefd6d..5177dae8a6604 100644 --- a/src/tools/compiletest/src/main.rs +++ b/src/tools/compiletest/src/main.rs @@ -508,8 +508,6 @@ fn common_inputs_stamp(config: &Config) -> Stamp { stamp.add_path(&rustdoc_path); stamp.add_path(&rust_src_dir.join("src/etc/htmldocck.py")); } - // FIXME(richkadel): Do I need to add an `if let Some(rust_demangler_path) contribution to the - // stamp here as well? // Compiletest itself. stamp.add_dir(&rust_src_dir.join("src/tools/compiletest/"));