Auto merge of #77080 - richkadel:llvm-coverage-counters-2, r=tmandry

Working branch-level code coverage

Add a generalized implementation for computing branch-level coverage spans.

This iteration resolves some of the challenges I had identified a few weeks ago.

I've tried to implement a solution that is general enough to work for a lot of different graphs/patterns. It's encouraging to see the results on fairly large and complex crates seem to meet my expectations. This may be a "functionally complete" implementation.

Except for bug fixes or edge cases I haven't run into yet, the next and essentially final step, I think, is to replace some Counters with CounterExpressions (where their counter values can be computed by adding or subtracting other counters/expressions).

Examples of branch-level coverage support enabled in this PR:

* https://github.com/richkadel/rust/blob/llvm-coverage-counters-2/src/test/run-make-fulldeps/instrument-coverage-cov-reports-base/expected_show_coverage.coverage_of_drop_trait.txt
* https://github.com/richkadel/rust/blob/llvm-coverage-counters-2/src/test/run-make-fulldeps/instrument-coverage-cov-reports-base/expected_show_coverage.coverage_of_if.txt
* https://github.com/richkadel/rust/blob/llvm-coverage-counters-2/src/test/run-make-fulldeps/instrument-coverage-cov-reports-base/expected_show_coverage.coverage_of_if_else.txt
* https://github.com/richkadel/rust/blob/llvm-coverage-counters-2/src/test/run-make-fulldeps/instrument-coverage-cov-reports-base/expected_show_coverage.coverage_of_simple_loop.txt
* https://github.com/richkadel/rust/blob/llvm-coverage-counters-2/src/test/run-make-fulldeps/instrument-coverage-cov-reports-base/expected_show_coverage.coverage_of_simple_match.txt
* ... _and others in the same directory_

Examples of coverage analysis results (MIR spanview files) used to inject counters in the right `BasicBlocks`:

* https://htmlpreview.github.io/?https://github.com/richkadel/rust/blob/llvm-coverage-counters-2/src/test/run-make-fulldeps/instrument-coverage-mir-cov-html-base/expected_mir_dump.coverage_of_drop_trait/coverage_of_drop_trait.main.-------.InstrumentCoverage.0.html
* https://htmlpreview.github.io/?https://github.com/richkadel/rust/blob/llvm-coverage-counters-2/src/test/run-make-fulldeps/instrument-coverage-mir-cov-html-base/expected_mir_dump.coverage_of_if/coverage_of_if.main.-------.InstrumentCoverage.0.html
* https://htmlpreview.github.io/?https://github.com/richkadel/rust/blob/llvm-coverage-counters-2/src/test/run-make-fulldeps/instrument-coverage-mir-cov-html-base/expected_mir_dump.coverage_of_if_else/coverage_of_if_else.main.-------.InstrumentCoverage.0.html
* https://htmlpreview.github.io/?https://github.com/richkadel/rust/blob/llvm-coverage-counters-2/src/test/run-make-fulldeps/instrument-coverage-mir-cov-html-base/expected_mir_dump.coverage_of_simple_loop/coverage_of_simple_loop.main.-------.InstrumentCoverage.0.html
* https://htmlpreview.github.io/?https://github.com/richkadel/rust/blob/llvm-coverage-counters-2/src/test/run-make-fulldeps/instrument-coverage-mir-cov-html-base/expected_mir_dump.coverage_of_simple_match/coverage_of_simple_match.main.-------.InstrumentCoverage.0.html
* ... _and others in the same directory_

Here is some sample coverage output after compiling a few real-world crates with the new branch-level coverage features:

<img width="801" alt="Screen Shot 2020-09-25 at 1 03 11 PM" src="https://user-images.githubusercontent.com/3827298/94316848-fd882c00-ff39-11ea-9cff-0402d3abd1e7.png">
<img width="721" alt="Screen Shot 2020-09-25 at 1 00 36 PM" src="https://user-images.githubusercontent.com/3827298/94316886-11cc2900-ff3a-11ea-9d03-80b26c8a5173.png">
<img width="889" alt="Screen Shot 2020-09-25 at 12 54 57 PM" src="https://user-images.githubusercontent.com/3827298/94316900-18f33700-ff3a-11ea-8a80-58f67d84b8de.png">

r? `@tmandry`
FYI: `@wesleywiser`
This commit is contained in:
bors 2020-10-05 19:34:44 +00:00
commit a1dfd2490a
151 changed files with 19004 additions and 1881 deletions

View file

@ -2938,8 +2938,9 @@ dependencies = [
[[package]]
name = "rust-demangler"
version = "0.0.0"
version = "0.0.1"
dependencies = [
"regex",
"rustc-demangle",
]

View file

@ -126,6 +126,7 @@ fn write_coverage_mappings(
let (filenames_index, _) = self.filenames.insert_full(c_filename);
virtual_file_mapping.push(filenames_index as u32);
}
debug!("Adding counter {:?} to map for {:?}", counter, region,);
mapping_regions.push(CounterMappingRegion::code_region(
counter,
current_file_id,

View file

@ -143,7 +143,9 @@ fn expressions_with_regions(
let id_to_counter =
|new_indexes: &IndexVec<InjectedExpressionIndex, MappedExpressionIndex>,
id: ExpressionOperandId| {
if id.index() < self.counters.len() {
if id == ExpressionOperandId::ZERO {
Some(Counter::zero())
} else if id.index() < self.counters.len() {
let index = CounterValueReference::from(id.index());
self.counters
.get(index)
@ -179,14 +181,19 @@ fn expressions_with_regions(
// been assigned a `new_index`.
let mapped_expression_index =
MappedExpressionIndex::from(counter_expressions.len());
counter_expressions.push(CounterExpression::new(
let expression = CounterExpression::new(
lhs_counter,
match op {
Op::Add => ExprKind::Add,
Op::Subtract => ExprKind::Subtract,
},
rhs_counter,
));
);
debug!(
"Adding expression {:?} = {:?} at {:?}",
mapped_expression_index, expression, region
);
counter_expressions.push(expression);
new_indexes[original_index] = mapped_expression_index;
expression_regions.push((Counter::expression(mapped_expression_index), region));
}

View file

@ -9,6 +9,7 @@
use super::ControlFlowGraph;
use rustc_index::vec::{Idx, IndexVec};
use std::borrow::BorrowMut;
use std::cmp::Ordering;
#[cfg(test)]
mod tests;
@ -108,6 +109,14 @@ pub fn is_dominated_by(&self, node: Node, dom: Node) -> bool {
// FIXME -- could be optimized by using post-order-rank
self.dominators(node).any(|n| n == dom)
}
/// Provide deterministic ordering of nodes such that, if any two nodes have a dominator
/// relationship, the dominator will always precede the dominated. (The relative ordering
/// of two unrelated nodes will also be consistent, but otherwise the order has no
/// meaning.) This method cannot be used to determine if either Node dominates the other.
pub fn rank_partial_cmp(&self, lhs: Node, rhs: Node) -> Option<Ordering> {
self.post_order_rank[lhs].partial_cmp(&self.post_order_rank[rhs])
}
}
pub struct Iter<'dom, Node: Idx> {

View file

@ -14,6 +14,20 @@ pub struct ExpressionOperandId {
}
}
impl ExpressionOperandId {
/// An expression operand for a "zero counter", as described in the following references:
///
/// * https://github.com/rust-lang/llvm-project/blob/llvmorg-8.0.0/llvm/docs/CoverageMappingFormat.rst#counter
/// * https://github.com/rust-lang/llvm-project/blob/llvmorg-8.0.0/llvm/docs/CoverageMappingFormat.rst#tag
/// * https://github.com/rust-lang/llvm-project/blob/llvmorg-8.0.0/llvm/docs/CoverageMappingFormat.rst#counter-expressions
///
/// This operand can be used to count two or more separate code regions with a single counter,
/// if they run sequentially with no branches, by injecting the `Counter` in a `BasicBlock` for
/// one of the code regions, and inserting `CounterExpression`s ("add ZERO to the counter") in
/// the coverage map for the other code regions.
pub const ZERO: Self = Self::from_u32(0);
}
rustc_index::newtype_index! {
pub struct CounterValueReference {
derive [HashStable]
@ -22,6 +36,11 @@ pub struct CounterValueReference {
}
}
impl CounterValueReference {
// Counters start at 1 to reserve 0 for ExpressionOperandId::ZERO.
pub const START: Self = Self::from_u32(1);
}
rustc_index::newtype_index! {
pub struct InjectedExpressionIndex {
derive [HashStable]

View file

@ -752,7 +752,7 @@ fn super_ascribe_user_ty(&mut self,
}
fn super_coverage(&mut self,
_kind: & $($mutability)? Coverage,
_coverage: & $($mutability)? Coverage,
_location: Location) {
}

File diff suppressed because it is too large Load diff

View file

@ -150,26 +150,25 @@ fn dump_matched_mir_node<'tcx, F>(
if let Some(spanview) = tcx.sess.opts.debugging_opts.dump_mir_spanview {
let _: io::Result<()> = try {
let mut file =
create_dump_file(tcx, "html", pass_num, pass_name, disambiguator, body.source)?;
let file_basename =
dump_file_basename(tcx, pass_num, pass_name, disambiguator, body.source);
let mut file = create_dump_file_with_basename(tcx, &file_basename, "html")?;
if body.source.def_id().is_local() {
write_mir_fn_spanview(tcx, body, spanview, &mut file)?;
write_mir_fn_spanview(tcx, body, spanview, &file_basename, &mut file)?;
}
};
}
}
/// Returns the path to the filename where we should dump a given MIR.
/// Also used by other bits of code (e.g., NLL inference) that dump
/// graphviz data or other things.
fn dump_path(
/// Returns the file basename portion (without extension) of a filename path
/// where we should dump a MIR representation output files.
fn dump_file_basename(
tcx: TyCtxt<'_>,
extension: &str,
pass_num: Option<&dyn Display>,
pass_name: &str,
disambiguator: &dyn Display,
source: MirSource<'tcx>,
) -> PathBuf {
) -> String {
let promotion_id = match source.promoted {
Some(id) => format!("-{:?}", id),
None => String::new(),
@ -184,9 +183,6 @@ fn dump_path(
}
};
let mut file_path = PathBuf::new();
file_path.push(Path::new(&tcx.sess.opts.debugging_opts.dump_mir_dir));
let crate_name = tcx.crate_name(source.def_id().krate);
let item_name = tcx.def_path(source.def_id()).to_filename_friendly_no_crate();
// All drop shims have the same DefId, so we have to add the type
@ -206,23 +202,46 @@ fn dump_path(
_ => String::new(),
};
let file_name = format!(
"{}.{}{}{}{}.{}.{}.{}",
crate_name,
item_name,
shim_disambiguator,
promotion_id,
pass_num,
pass_name,
disambiguator,
extension,
);
format!(
"{}.{}{}{}{}.{}.{}",
crate_name, item_name, shim_disambiguator, promotion_id, pass_num, pass_name, disambiguator,
)
}
/// Returns the path to the filename where we should dump a given MIR.
/// Also used by other bits of code (e.g., NLL inference) that dump
/// graphviz data or other things.
fn dump_path(tcx: TyCtxt<'_>, basename: &str, extension: &str) -> PathBuf {
let mut file_path = PathBuf::new();
file_path.push(Path::new(&tcx.sess.opts.debugging_opts.dump_mir_dir));
let file_name = format!("{}.{}", basename, extension,);
file_path.push(&file_name);
file_path
}
/// Attempts to open the MIR dump file with the given name and extension.
fn create_dump_file_with_basename(
tcx: TyCtxt<'_>,
file_basename: &str,
extension: &str,
) -> io::Result<io::BufWriter<fs::File>> {
let file_path = dump_path(tcx, file_basename, extension);
if let Some(parent) = file_path.parent() {
fs::create_dir_all(parent).map_err(|e| {
io::Error::new(
e.kind(),
format!("IO error creating MIR dump directory: {:?}; {}", parent, e),
)
})?;
}
Ok(io::BufWriter::new(fs::File::create(&file_path).map_err(|e| {
io::Error::new(e.kind(), format!("IO error creating MIR dump file: {:?}; {}", file_path, e))
})?))
}
/// Attempts to open a file where we should dump a given MIR or other
/// bit of MIR-related data. Used by `mir-dump`, but also by other
/// bits of code (e.g., NLL inference) that dump graphviz data or
@ -235,11 +254,11 @@ pub(crate) fn create_dump_file(
disambiguator: &dyn Display,
source: MirSource<'tcx>,
) -> io::Result<io::BufWriter<fs::File>> {
let file_path = dump_path(tcx, extension, pass_num, pass_name, disambiguator, source);
if let Some(parent) = file_path.parent() {
fs::create_dir_all(parent)?;
}
Ok(io::BufWriter::new(fs::File::create(&file_path)?))
create_dump_file_with_basename(
tcx,
&dump_file_basename(tcx, pass_num, pass_name, disambiguator, source),
extension,
)
}
/// Write out a human-readable textual representation for the given MIR.

View file

@ -16,9 +16,13 @@
const NEW_LINE_SPAN: &str = "</span>\n<span class=\"line\">";
const HEADER: &str = r#"<!DOCTYPE html>
<html>
<head>
<title>coverage_of_if_else - Code Regions</title>
<style>
<head>"#;
const START_BODY: &str = r#"</head>
<body>"#;
const FOOTER: &str = r#"</body>
</html>"#;
const STYLE_SECTION: &str = r#"<style>
.line {
counter-increment: line;
}
@ -72,16 +76,12 @@
/* requires hover over a span ONLY on its first line */
display: inline-block;
}
</style>
</head>
<body>"#;
const FOOTER: &str = r#"
</body>
</html>"#;
</style>"#;
/// Metadata to highlight the span of a MIR BasicBlock, Statement, or Terminator.
#[derive(Clone, Debug)]
pub struct SpanViewable {
pub bb: BasicBlock,
pub span: Span,
pub id: String,
pub tooltip: String,
@ -92,6 +92,7 @@ pub fn write_mir_fn_spanview<'tcx, W>(
tcx: TyCtxt<'tcx>,
body: &Body<'tcx>,
spanview: MirSpanview,
title: &str,
w: &mut W,
) -> io::Result<()>
where
@ -126,16 +127,17 @@ pub fn write_mir_fn_spanview<'tcx, W>(
}
}
}
write_spanview_document(tcx, def_id, span_viewables, w)?;
write_document(tcx, def_id, span_viewables, title, w)?;
Ok(())
}
/// Generate a spanview HTML+CSS document for the given local function `def_id`, and a pre-generated
/// list `SpanViewable`s.
pub fn write_spanview_document<'tcx, W>(
pub fn write_document<'tcx, W>(
tcx: TyCtxt<'tcx>,
def_id: DefId,
mut span_viewables: Vec<SpanViewable>,
title: &str,
w: &mut W,
) -> io::Result<()>
where
@ -153,6 +155,9 @@ pub fn write_spanview_document<'tcx, W>(
source_map.span_to_snippet(fn_span).expect("function should have printable source")
);
writeln!(w, "{}", HEADER)?;
writeln!(w, "<title>{}</title>", title)?;
writeln!(w, "{}", STYLE_SECTION)?;
writeln!(w, "{}", START_BODY)?;
write!(
w,
r#"<div class="code" style="counter-reset: line {}"><span class="line">{}"#,
@ -182,6 +187,7 @@ pub fn write_spanview_document<'tcx, W>(
end_pos.to_usize(),
ordered_viewables.len()
);
let curr_id = &ordered_viewables[0].id;
let (next_from_pos, next_ordered_viewables) = write_next_viewable_with_overlaps(
tcx,
from_pos,
@ -204,13 +210,17 @@ pub fn write_spanview_document<'tcx, W>(
from_pos = next_from_pos;
if next_ordered_viewables.len() != ordered_viewables.len() {
ordered_viewables = next_ordered_viewables;
alt = !alt;
if let Some(next_ordered_viewable) = ordered_viewables.first() {
if &next_ordered_viewable.id != curr_id {
alt = !alt;
}
}
}
}
if from_pos < end_pos {
write_coverage_gap(tcx, from_pos, end_pos, w)?;
}
write!(w, r#"</span></div>"#)?;
writeln!(w, r#"</span></div>"#)?;
writeln!(w, "{}", FOOTER)?;
Ok(())
}
@ -273,7 +283,7 @@ fn statement_span_viewable<'tcx>(
}
let id = format!("{}[{}]", bb.index(), i);
let tooltip = tooltip(tcx, &id, span, vec![statement.clone()], &None);
Some(SpanViewable { span, id, tooltip })
Some(SpanViewable { bb, span, id, tooltip })
}
fn terminator_span_viewable<'tcx>(
@ -289,7 +299,7 @@ fn terminator_span_viewable<'tcx>(
}
let id = format!("{}:{}", bb.index(), terminator_kind_name(term));
let tooltip = tooltip(tcx, &id, span, vec![], &data.terminator);
Some(SpanViewable { span, id, tooltip })
Some(SpanViewable { bb, span, id, tooltip })
}
fn block_span_viewable<'tcx>(
@ -304,7 +314,7 @@ fn block_span_viewable<'tcx>(
}
let id = format!("{}", bb.index());
let tooltip = tooltip(tcx, &id, span, data.statements.clone(), &data.terminator);
Some(SpanViewable { span, id, tooltip })
Some(SpanViewable { bb, span, id, tooltip })
}
fn compute_block_span<'tcx>(data: &BasicBlockData<'tcx>, body_span: Span) -> Span {
@ -456,6 +466,7 @@ fn write_next_viewable_with_overlaps<'tcx, 'b, W>(
remaining_viewables.len()
);
// Write the overlaps (and the overlaps' overlaps, if any) up to `to_pos`.
let curr_id = &remaining_viewables[0].id;
let (next_from_pos, next_remaining_viewables) = write_next_viewable_with_overlaps(
tcx,
from_pos,
@ -480,7 +491,11 @@ fn write_next_viewable_with_overlaps<'tcx, 'b, W>(
from_pos = next_from_pos;
if next_remaining_viewables.len() != remaining_viewables.len() {
remaining_viewables = next_remaining_viewables;
subalt = !subalt;
if let Some(next_ordered_viewable) = remaining_viewables.first() {
if &next_ordered_viewable.id != curr_id {
subalt = !subalt;
}
}
}
}
if from_pos <= viewable.span.hi() {
@ -649,8 +664,12 @@ fn fn_span<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> Span {
tcx.hir().local_def_id_to_hir_id(def_id.as_local().expect("expected DefId is local"));
let fn_decl_span = tcx.hir().span(hir_id);
let body_span = hir_body(tcx, def_id).value.span;
debug_assert_eq!(fn_decl_span.ctxt(), body_span.ctxt());
fn_decl_span.to(body_span)
if fn_decl_span.ctxt() == body_span.ctxt() {
fn_decl_span.to(body_span)
} else {
// This probably occurs for functions defined via macros
body_span
}
}
fn hir_body<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> &'tcx rustc_hir::Body<'tcx> {

View file

@ -1756,10 +1756,6 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options {
);
}
if debugging_opts.experimental_coverage {
debugging_opts.instrument_coverage = true;
}
if debugging_opts.instrument_coverage {
if cg.profile_generate.enabled() || cg.profile_use.is_some() {
early_error(

View file

@ -895,11 +895,6 @@ fn parse_target_feature(slot: &mut String, v: Option<&str>) -> bool {
all statements)."),
emit_stack_sizes: bool = (false, parse_bool, [UNTRACKED],
"emit a section containing stack size metadata (default: no)"),
experimental_coverage: bool = (false, parse_bool, [TRACKED],
"enable and extend the `-Z instrument-coverage` function-level coverage \
feature, adding additional experimental (likely inaccurate) counters and \
code regions (used by `rustc` compiler developers to test new coverage \
counter placements) (default: no)"),
fewer_names: bool = (false, parse_bool, [TRACKED],
"reduce memory use by retaining fewer names within compilation artifacts (LLVM-IR) \
(default: no)"),

View file

@ -60,6 +60,8 @@
use sha1::Digest;
use sha1::Sha1;
use tracing::debug;
#[cfg(test)]
mod tests;
@ -1462,6 +1464,88 @@ pub fn original_relative_byte_pos(&self, pos: BytePos) -> BytePos {
BytePos::from_u32(pos.0 - self.start_pos.0 + diff)
}
/// Converts an absolute `BytePos` to a `CharPos` relative to the `SourceFile`.
pub fn bytepos_to_file_charpos(&self, bpos: BytePos) -> CharPos {
// The number of extra bytes due to multibyte chars in the `SourceFile`.
let mut total_extra_bytes = 0;
for mbc in self.multibyte_chars.iter() {
debug!("{}-byte char at {:?}", mbc.bytes, mbc.pos);
if mbc.pos < bpos {
// Every character is at least one byte, so we only
// count the actual extra bytes.
total_extra_bytes += mbc.bytes as u32 - 1;
// We should never see a byte position in the middle of a
// character.
assert!(bpos.to_u32() >= mbc.pos.to_u32() + mbc.bytes as u32);
} else {
break;
}
}
assert!(self.start_pos.to_u32() + total_extra_bytes <= bpos.to_u32());
CharPos(bpos.to_usize() - self.start_pos.to_usize() - total_extra_bytes as usize)
}
/// Looks up the file's (1-based) line number and (0-based `CharPos`) column offset, for a
/// given `BytePos`.
pub fn lookup_file_pos(&self, pos: BytePos) -> (usize, CharPos) {
let chpos = self.bytepos_to_file_charpos(pos);
match self.lookup_line(pos) {
Some(a) => {
let line = a + 1; // Line numbers start at 1
let linebpos = self.lines[a];
let linechpos = self.bytepos_to_file_charpos(linebpos);
let col = chpos - linechpos;
debug!("byte pos {:?} is on the line at byte pos {:?}", pos, linebpos);
debug!("char pos {:?} is on the line at char pos {:?}", chpos, linechpos);
debug!("byte is on line: {}", line);
assert!(chpos >= linechpos);
(line, col)
}
None => (0, chpos),
}
}
/// Looks up the file's (1-based) line number, (0-based `CharPos`) column offset, and (0-based)
/// column offset when displayed, for a given `BytePos`.
pub fn lookup_file_pos_with_col_display(&self, pos: BytePos) -> (usize, CharPos, usize) {
let (line, col_or_chpos) = self.lookup_file_pos(pos);
if line > 0 {
let col = col_or_chpos;
let linebpos = self.lines[line - 1];
let col_display = {
let start_width_idx = self
.non_narrow_chars
.binary_search_by_key(&linebpos, |x| x.pos())
.unwrap_or_else(|x| x);
let end_width_idx = self
.non_narrow_chars
.binary_search_by_key(&pos, |x| x.pos())
.unwrap_or_else(|x| x);
let special_chars = end_width_idx - start_width_idx;
let non_narrow: usize = self.non_narrow_chars[start_width_idx..end_width_idx]
.iter()
.map(|x| x.width())
.sum();
col.0 - special_chars + non_narrow
};
(line, col, col_display)
} else {
let chpos = col_or_chpos;
let col_display = {
let end_width_idx = self
.non_narrow_chars
.binary_search_by_key(&pos, |x| x.pos())
.unwrap_or_else(|x| x);
let non_narrow: usize =
self.non_narrow_chars[0..end_width_idx].iter().map(|x| x.width()).sum();
chpos.0 - end_width_idx + non_narrow
};
(0, chpos, col_display)
}
}
}
/// Normalizes the source code and records the normalizations.

View file

@ -428,58 +428,22 @@ pub fn doctest_offset_line(&self, file: &FileName, orig: usize) -> usize {
}
}
/// Return the SourceFile that contains the given `BytePos`
pub fn lookup_source_file(&self, pos: BytePos) -> Lrc<SourceFile> {
let idx = self.lookup_source_file_idx(pos);
(*self.files.borrow().source_files)[idx].clone()
}
/// Looks up source information about a `BytePos`.
pub fn lookup_char_pos(&self, pos: BytePos) -> Loc {
let chpos = self.bytepos_to_file_charpos(pos);
match self.lookup_line(pos) {
Ok(SourceFileAndLine { sf: f, line: a }) => {
let line = a + 1; // Line numbers start at 1
let linebpos = f.lines[a];
let linechpos = self.bytepos_to_file_charpos(linebpos);
let col = chpos - linechpos;
let col_display = {
let start_width_idx = f
.non_narrow_chars
.binary_search_by_key(&linebpos, |x| x.pos())
.unwrap_or_else(|x| x);
let end_width_idx = f
.non_narrow_chars
.binary_search_by_key(&pos, |x| x.pos())
.unwrap_or_else(|x| x);
let special_chars = end_width_idx - start_width_idx;
let non_narrow: usize = f.non_narrow_chars[start_width_idx..end_width_idx]
.iter()
.map(|x| x.width())
.sum();
col.0 - special_chars + non_narrow
};
debug!("byte pos {:?} is on the line at byte pos {:?}", pos, linebpos);
debug!("char pos {:?} is on the line at char pos {:?}", chpos, linechpos);
debug!("byte is on line: {}", line);
assert!(chpos >= linechpos);
Loc { file: f, line, col, col_display }
}
Err(f) => {
let col_display = {
let end_width_idx = f
.non_narrow_chars
.binary_search_by_key(&pos, |x| x.pos())
.unwrap_or_else(|x| x);
let non_narrow: usize =
f.non_narrow_chars[0..end_width_idx].iter().map(|x| x.width()).sum();
chpos.0 - end_width_idx + non_narrow
};
Loc { file: f, line: 0, col: chpos, col_display }
}
}
let sf = self.lookup_source_file(pos);
let (line, col, col_display) = sf.lookup_file_pos_with_col_display(pos);
Loc { file: sf, line, col, col_display }
}
// If the corresponding `SourceFile` is empty, does not return a line number.
pub fn lookup_line(&self, pos: BytePos) -> Result<SourceFileAndLine, Lrc<SourceFile>> {
let idx = self.lookup_source_file_idx(pos);
let f = (*self.files.borrow().source_files)[idx].clone();
let f = self.lookup_source_file(pos);
match f.lookup_line(pos) {
Some(line) => Ok(SourceFileAndLine { sf: f, line }),
@ -934,27 +898,8 @@ pub fn lookup_byte_offset(&self, bpos: BytePos) -> SourceFileAndBytePos {
/// Converts an absolute `BytePos` to a `CharPos` relative to the `SourceFile`.
pub fn bytepos_to_file_charpos(&self, bpos: BytePos) -> CharPos {
let idx = self.lookup_source_file_idx(bpos);
let map = &(*self.files.borrow().source_files)[idx];
// The number of extra bytes due to multibyte chars in the `SourceFile`.
let mut total_extra_bytes = 0;
for mbc in map.multibyte_chars.iter() {
debug!("{}-byte char at {:?}", mbc.bytes, mbc.pos);
if mbc.pos < bpos {
// Every character is at least one byte, so we only
// count the actual extra bytes.
total_extra_bytes += mbc.bytes as u32 - 1;
// We should never see a byte position in the middle of a
// character.
assert!(bpos.to_u32() >= mbc.pos.to_u32() + mbc.bytes as u32);
} else {
break;
}
}
assert!(map.start_pos.to_u32() + total_extra_bytes <= bpos.to_u32());
CharPos(bpos.to_usize() - map.start_pos.to_usize() - total_extra_bytes as usize)
let sf = &(*self.files.borrow().source_files)[idx];
sf.bytepos_to_file_charpos(bpos)
}
// Returns the index of the `SourceFile` (in `self.files`) that contains `pos`.

View file

@ -3,8 +3,5 @@ digraph Mir_0_3 {
node [fontname="Courier, monospace"];
edge [fontname="Courier, monospace"];
label=<fn main() -&gt; ()<br align="left"/>>;
bb0__0_3 [shape="none", label=<<table border="0" cellborder="1" cellspacing="0"><tr><td bgcolor="gray" align="center" colspan="1">0</td></tr><tr><td align="left" balign="left">_0 = const ()<br/></td></tr><tr><td align="left">goto</td></tr></table>>];
bb1__0_3 [shape="none", label=<<table border="0" cellborder="1" cellspacing="0"><tr><td bgcolor="gray" align="center" colspan="1">1</td></tr><tr><td align="left">resume</td></tr></table>>];
bb2__0_3 [shape="none", label=<<table border="0" cellborder="1" cellspacing="0"><tr><td bgcolor="gray" align="center" colspan="1">2</td></tr><tr><td align="left">return</td></tr></table>>];
bb0__0_3 -> bb2__0_3 [label=""];
bb0__0_3 [shape="none", label=<<table border="0" cellborder="1" cellspacing="0"><tr><td bgcolor="gray" align="center" colspan="1">0</td></tr><tr><td align="left" balign="left">_0 = const ()<br/></td></tr><tr><td align="left">return</td></tr></table>>];
}

View file

@ -1,7 +0,0 @@
digraph Mir_0_3 {
graph [fontname="Courier, monospace"];
node [fontname="Courier, monospace"];
edge [fontname="Courier, monospace"];
label=<fn main() -&gt; ()<br align="left"/>>;
bb0__0_3 [shape="none", label=<<table border="0" cellborder="1" cellspacing="0"><tr><td bgcolor="gray" align="center" colspan="1">0</td></tr><tr><td align="left" balign="left">_0 = const ()<br/></td></tr><tr><td align="left">return</td></tr></table>>];
}

View file

@ -6,7 +6,7 @@
bb0: {
_0 = const true; // scope 0 at /the/src/instrument_coverage.rs:20:5: 20:9
+ Coverage::Counter(0) for /the/src/instrument_coverage.rs:19:18 - 21:2; // scope 0 at /the/src/instrument_coverage.rs:21:2: 21:2
+ 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
return; // scope 0 at /the/src/instrument_coverage.rs:21:2: 21:2
}
}

View file

@ -8,7 +8,7 @@
let mut _3: !; // in scope 0 at /the/src/instrument_coverage.rs:12:18: 14:10
bb0: {
+ Coverage::Counter(0) for /the/src/instrument_coverage.rs:10:11 - 16:2; // scope 0 at /the/src/instrument_coverage.rs:11:5: 15:6
+ Coverage::Counter(1) for /the/src/instrument_coverage.rs:12:12 - 12:17; // scope 0 at /the/src/instrument_coverage.rs:11:5: 15:6
falseUnwind -> [real: bb1, cleanup: bb6]; // scope 0 at /the/src/instrument_coverage.rs:11:5: 15:6
}
@ -26,6 +26,7 @@
}
bb3: {
+ Coverage::Counter(2) for /the/src/instrument_coverage.rs:13:13 - 16:2; // scope 0 at /the/src/instrument_coverage.rs:12:9: 14:10
falseEdge -> [real: bb5, imaginary: bb4]; // scope 0 at /the/src/instrument_coverage.rs:12:9: 14:10
}

View file

@ -1,8 +1,8 @@
<!DOCTYPE html>
<html>
<head>
<title>coverage_of_if_else - Code Regions</title>
<style>
<title>spanview_block.main.mir_map.0</title>
<style>
.line {
counter-increment: line;
}
@ -56,12 +56,11 @@
/* requires hover over a span ONLY on its first line */
display: inline-block;
}
</style>
</style>
</head>
<body>
<div class="code" style="counter-reset: line 4"><span class="line"><span class="code" style="--layer: 0">fn main() </span><span><span class="code even" style="--layer: 1" title="0: $DIR/spanview-block.rs:5:11: 5:13:
5:11-5:13: Assign: _0 = const ()
5:13-5:13: Goto: goto -&gt; bb2"><span class="annotation">0⦊</span>{}<span class="annotation">⦉0</span></span></span><span><span class="code odd" style="--layer: 1" title="2: $DIR/spanview-block.rs:5:13: 5:13:
5:13-5:13: Return: return"><span class="annotation">2⦊</span><span class="annotation">⦉2</span></span></span></span></div>
5:13-5:13: Return: return"><span class="annotation">0⦊</span>{}<span class="annotation">⦉0</span></span></span></span></div>
</body>
</html>

View file

@ -1,8 +1,8 @@
<!DOCTYPE html>
<html>
<head>
<title>coverage_of_if_else - Code Regions</title>
<style>
<title>spanview_statement.main.mir_map.0</title>
<style>
.line {
counter-increment: line;
}
@ -56,12 +56,11 @@
/* requires hover over a span ONLY on its first line */
display: inline-block;
}
</style>
</style>
</head>
<body>
<div class="code" style="counter-reset: line 4"><span class="line"><span class="code" style="--layer: 0">fn main() </span><span><span class="code even" style="--layer: 1" title="0[0]: $DIR/spanview-statement.rs:5:11: 5:13:
5:11-5:13: Assign: _0 = const ()"><span class="annotation">0[0]⦊</span>{}<span class="annotation">⦉0[0]</span></span></span><span><span class="code odd" style="--layer: 1" title="0:Goto: $DIR/spanview-statement.rs:5:13: 5:13:
5:13-5:13: Goto: goto -&gt; bb2"><span class="annotation">0:Goto⦊</span><span class="annotation">⦉0:Goto</span></span></span><span><span class="code even" style="--layer: 1" title="2:Return: $DIR/spanview-statement.rs:5:13: 5:13:
5:13-5:13: Return: return"><span class="annotation">2:Return⦊</span><span class="annotation">⦉2:Return</span></span></span></span></div>
5:11-5:13: Assign: _0 = const ()"><span class="annotation">0[0]⦊</span>{}<span class="annotation">⦉0[0]</span></span></span><span><span class="code odd" style="--layer: 1" title="0:Return: $DIR/spanview-statement.rs:5:13: 5:13:
5:13-5:13: Return: return"><span class="annotation">0:Return⦊</span><span class="annotation">⦉0:Return</span></span></span></span></div>
</body>
</html>

View file

@ -1,8 +1,8 @@
<!DOCTYPE html>
<html>
<head>
<title>coverage_of_if_else - Code Regions</title>
<style>
<title>spanview_terminator.main.mir_map.0</title>
<style>
.line {
counter-increment: line;
}
@ -56,11 +56,10 @@
/* requires hover over a span ONLY on its first line */
display: inline-block;
}
</style>
</style>
</head>
<body>
<div class="code" style="counter-reset: line 4"><span class="line"><span class="code" style="--layer: 0">fn main() {}</span><span><span class="code even" style="--layer: 1" title="0:Goto: $DIR/spanview-terminator.rs:5:13: 5:13:
5:13-5:13: Goto: goto -&gt; bb2"><span class="annotation">0:Goto⦊</span><span class="annotation">⦉0:Goto</span></span></span><span><span class="code odd" style="--layer: 1" title="2:Return: $DIR/spanview-terminator.rs:5:13: 5:13:
5:13-5:13: Return: return"><span class="annotation">2:Return⦊</span><span class="annotation">⦉2:Return</span></span></span></span></div>
<div class="code" style="counter-reset: line 4"><span class="line"><span class="code" style="--layer: 0">fn main() {}</span><span><span class="code even" style="--layer: 1" title="0:Return: $DIR/spanview-terminator.rs:5:13: 5:13:
5:13-5:13: Return: return"><span class="annotation">0:Return⦊</span><span class="annotation">⦉0:Return</span></span></span></span></div>
</body>
</html>

View file

@ -2,11 +2,11 @@
# 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 ../instrument-coverage/coverage_tools.mk for more information.
# See ../coverage/coverage_tools.mk for more information.
-include ../instrument-coverage/coverage_tools.mk
-include ../coverage/coverage_tools.mk
BASEDIR=../instrument-coverage-llvm-ir-base
BASEDIR=../coverage-llvmir-base
ifeq ($(UNAME),Darwin)
INSTR_PROF_DATA_SUFFIX=,regular,live_support

View file

@ -4,8 +4,8 @@
# LINK_DEAD_CODE requires ignore-msvc due to Issue #76038
LINK_DEAD_CODE=yes
-include ../instrument-coverage-llvm-ir-base/Makefile
-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 ../instrument-coverage/coverage_tools.mk for more information.
# See ../coverage/coverage_tools.mk for more information.

View file

@ -6,12 +6,12 @@
# 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 ../instrument-coverage/coverage_tools.mk for more information.
# See ../coverage/coverage_tools.mk for more information.
-include ../instrument-coverage/coverage_tools.mk
-include ../coverage/coverage_tools.mk
BASEDIR=../instrument-coverage-cov-reports-base
SOURCEDIR=../instrument-coverage
BASEDIR=../coverage-reports-base
SOURCEDIR=../coverage
all: $(patsubst $(SOURCEDIR)/%.rs,%,$(wildcard $(SOURCEDIR)/*.rs))
@ -20,25 +20,29 @@ all: $(patsubst $(SOURCEDIR)/%.rs,%,$(wildcard $(SOURCEDIR)/*.rs))
clear_expected_if_blessed:
ifdef RUSTC_BLESS_TEST
rm -f expected_export_coverage.*.json
rm -f typical_show_coverage.*.txt
rm -f expected_show_coverage.*.txt
endif
-include clear_expected_if_blessed
%: $(SOURCEDIR)/%.rs
# Compile the test program with "experimental" coverage instrumentation and generate relevant MIR.
#
# FIXME(richkadel): `-Zexperimental-coverage` to `-Zinstrument-coverage` once we are
# satisfied with the branch-level instrumentation.
# Compile the test program with coverage instrumentation and generate relevant MIR.
$(RUSTC) $(SOURCEDIR)/$@.rs \
-Zexperimental-coverage \
-Zinstrument-coverage \
-Clink-dead-code=$(LINK_DEAD_CODE)
# Run it in order to generate some profiling data,
# with `LLVM_PROFILE_FILE=<profdata_file>` environment variable set to
# output the coverage stats for this run.
LLVM_PROFILE_FILE="$(TMPDIR)"/$@.profraw \
$(call RUN,$@)
$(call RUN,$@) || \
( \
status=$$?; \
grep -q "^\/\/ expect-exit-status-$$status" $(SOURCEDIR)/$@.rs || \
( >&2 echo "program exited with an unexpected exit status: $$status"; \
false \
) \
)
# Postprocess the profiling data so it can be used by the llvm-cov tool
"$(LLVM_BIN_DIR)"/llvm-profdata merge --sparse \
@ -57,11 +61,20 @@ endif
> "$(TMPDIR)"/actual_show_coverage.$@.txt
ifdef RUSTC_BLESS_TEST
cp "$(TMPDIR)"/actual_show_coverage.$@.txt typical_show_coverage.$@.txt
cp "$(TMPDIR)"/actual_show_coverage.$@.txt expected_show_coverage.$@.txt
else
# Compare the show coverage output (`--bless` refreshes `typical` files)
$(DIFF) typical_show_coverage.$@.txt "$(TMPDIR)"/actual_show_coverage.$@.txt || \
>&2 echo 'diff failed for `llvm-cov show` on $@ (might not be an error)'
# 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 || \
( grep -q '^\/\/ ignore-llvm-cov-show-diffs' $(SOURCEDIR)/$@.rs && \
>&2 echo 'diff failed, but suppressed with `// ignore-llvm-cov-show-diffs` in $(SOURCEDIR)/$@.rs' \
) || \
( >&2 echo 'diff failed, and not suppressed without `// ignore-llvm-cov-show-diffs` in $(SOURCEDIR)/$@.rs'; \
false \
)
endif
# Generate a coverage report in JSON, using `llvm-cov export`, and fail if

View file

@ -0,0 +1,59 @@
{
"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": 75,
"percent": 82.41758241758241
},
"regions": {
"count": 21,
"covered": 11,
"notcovered": 10,
"percent": 52.38095238095239
}
}
}
],
"totals": {
"functions": {
"count": 5,
"covered": 3,
"percent": 60
},
"instantiations": {
"count": 5,
"covered": 3,
"percent": 60
},
"lines": {
"count": 91,
"covered": 75,
"percent": 82.41758241758241
},
"regions": {
"count": 21,
"covered": 11,
"notcovered": 10,
"percent": 52.38095238095239
}
}
}
],
"type": "llvm.coverage.json.export",
"version": "2.0.1"
}

View file

@ -0,0 +1,59 @@
{
"data": [
{
"files": [
{
"filename": "../coverage/drop_trait.rs",
"summary": {
"functions": {
"count": 2,
"covered": 2,
"percent": 100
},
"instantiations": {
"count": 2,
"covered": 2,
"percent": 100
},
"lines": {
"count": 10,
"covered": 10,
"percent": 100
},
"regions": {
"count": 5,
"covered": 5,
"notcovered": 0,
"percent": 100
}
}
}
],
"totals": {
"functions": {
"count": 2,
"covered": 2,
"percent": 100
},
"instantiations": {
"count": 2,
"covered": 2,
"percent": 100
},
"lines": {
"count": 10,
"covered": 10,
"percent": 100
},
"regions": {
"count": 5,
"covered": 5,
"notcovered": 0,
"percent": 100
}
}
}
],
"type": "llvm.coverage.json.export",
"version": "2.0.1"
}

View file

@ -0,0 +1,59 @@
{
"data": [
{
"files": [
{
"filename": "../coverage/generics.rs",
"summary": {
"functions": {
"count": 3,
"covered": 3,
"percent": 100
},
"instantiations": {
"count": 5,
"covered": 5,
"percent": 100
},
"lines": {
"count": 16,
"covered": 16,
"percent": 100
},
"regions": {
"count": 6,
"covered": 6,
"notcovered": 0,
"percent": 100
}
}
}
],
"totals": {
"functions": {
"count": 3,
"covered": 3,
"percent": 100
},
"instantiations": {
"count": 5,
"covered": 5,
"percent": 100
},
"lines": {
"count": 16,
"covered": 16,
"percent": 100
},
"regions": {
"count": 6,
"covered": 6,
"notcovered": 0,
"percent": 100
}
}
}
],
"type": "llvm.coverage.json.export",
"version": "2.0.1"
}

View file

@ -0,0 +1,59 @@
{
"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": 4,
"covered": 4,
"notcovered": 0,
"percent": 100
}
}
}
],
"totals": {
"functions": {
"count": 1,
"covered": 1,
"percent": 100
},
"instantiations": {
"count": 1,
"covered": 1,
"percent": 100
},
"lines": {
"count": 19,
"covered": 19,
"percent": 100
},
"regions": {
"count": 4,
"covered": 4,
"notcovered": 0,
"percent": 100
}
}
}
],
"type": "llvm.coverage.json.export",
"version": "2.0.1"
}

View file

@ -0,0 +1,59 @@
{
"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"
}

View file

@ -0,0 +1,59 @@
{
"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": 13,
"covered": 13,
"notcovered": 0,
"percent": 100
}
}
}
],
"totals": {
"functions": {
"count": 4,
"covered": 4,
"percent": 100
},
"instantiations": {
"count": 4,
"covered": 4,
"percent": 100
},
"lines": {
"count": 26,
"covered": 26,
"percent": 100
},
"regions": {
"count": 13,
"covered": 13,
"notcovered": 0,
"percent": 100
}
}
}
],
"type": "llvm.coverage.json.export",
"version": "2.0.1"
}

View file

@ -0,0 +1,59 @@
{
"data": [
{
"files": [
{
"filename": "../coverage/lazy_boolean.rs",
"summary": {
"functions": {
"count": 1,
"covered": 1,
"percent": 100
},
"instantiations": {
"count": 1,
"covered": 1,
"percent": 100
},
"lines": {
"count": 21,
"covered": 19,
"percent": 90.47619047619048
},
"regions": {
"count": 16,
"covered": 14,
"notcovered": 2,
"percent": 87.5
}
}
}
],
"totals": {
"functions": {
"count": 1,
"covered": 1,
"percent": 100
},
"instantiations": {
"count": 1,
"covered": 1,
"percent": 100
},
"lines": {
"count": 21,
"covered": 19,
"percent": 90.47619047619048
},
"regions": {
"count": 16,
"covered": 14,
"notcovered": 2,
"percent": 87.5
}
}
}
],
"type": "llvm.coverage.json.export",
"version": "2.0.1"
}

View file

@ -0,0 +1,59 @@
{
"data": [
{
"files": [
{
"filename": "../coverage/loop_break_value.rs",
"summary": {
"functions": {
"count": 1,
"covered": 1,
"percent": 100
},
"instantiations": {
"count": 1,
"covered": 1,
"percent": 100
},
"lines": {
"count": 11,
"covered": 11,
"percent": 100
},
"regions": {
"count": 1,
"covered": 1,
"notcovered": 0,
"percent": 100
}
}
}
],
"totals": {
"functions": {
"count": 1,
"covered": 1,
"percent": 100
},
"instantiations": {
"count": 1,
"covered": 1,
"percent": 100
},
"lines": {
"count": 11,
"covered": 11,
"percent": 100
},
"regions": {
"count": 1,
"covered": 1,
"notcovered": 0,
"percent": 100
}
}
}
],
"type": "llvm.coverage.json.export",
"version": "2.0.1"
}

View file

@ -0,0 +1,59 @@
{
"data": [
{
"files": [
{
"filename": "../coverage/simple_loop.rs",
"summary": {
"functions": {
"count": 1,
"covered": 1,
"percent": 100
},
"instantiations": {
"count": 1,
"covered": 1,
"percent": 100
},
"lines": {
"count": 18,
"covered": 18,
"percent": 100
},
"regions": {
"count": 7,
"covered": 7,
"notcovered": 0,
"percent": 100
}
}
}
],
"totals": {
"functions": {
"count": 1,
"covered": 1,
"percent": 100
},
"instantiations": {
"count": 1,
"covered": 1,
"percent": 100
},
"lines": {
"count": 18,
"covered": 18,
"percent": 100
},
"regions": {
"count": 7,
"covered": 7,
"notcovered": 0,
"percent": 100
}
}
}
],
"type": "llvm.coverage.json.export",
"version": "2.0.1"
}

View file

@ -0,0 +1,59 @@
{
"data": [
{
"files": [
{
"filename": "../coverage/simple_match.rs",
"summary": {
"functions": {
"count": 1,
"covered": 1,
"percent": 100
},
"instantiations": {
"count": 1,
"covered": 1,
"percent": 100
},
"lines": {
"count": 26,
"covered": 26,
"percent": 100
},
"regions": {
"count": 9,
"covered": 9,
"notcovered": 0,
"percent": 100
}
}
}
],
"totals": {
"functions": {
"count": 1,
"covered": 1,
"percent": 100
},
"instantiations": {
"count": 1,
"covered": 1,
"percent": 100
},
"lines": {
"count": 26,
"covered": 26,
"percent": 100
},
"regions": {
"count": 9,
"covered": 9,
"notcovered": 0,
"percent": 100
}
}
}
],
"type": "llvm.coverage.json.export",
"version": "2.0.1"
}

View file

@ -0,0 +1,59 @@
{
"data": [
{
"files": [
{
"filename": "../coverage/try_error_result.rs",
"summary": {
"functions": {
"count": 2,
"covered": 2,
"percent": 100
},
"instantiations": {
"count": 2,
"covered": 2,
"percent": 100
},
"lines": {
"count": 16,
"covered": 15,
"percent": 93.75
},
"regions": {
"count": 13,
"covered": 12,
"notcovered": 1,
"percent": 92.3076923076923
}
}
}
],
"totals": {
"functions": {
"count": 2,
"covered": 2,
"percent": 100
},
"instantiations": {
"count": 2,
"covered": 2,
"percent": 100
},
"lines": {
"count": 16,
"covered": 15,
"percent": 93.75
},
"regions": {
"count": 13,
"covered": 12,
"notcovered": 1,
"percent": 92.3076923076923
}
}
}
],
"type": "llvm.coverage.json.export",
"version": "2.0.1"
}

View file

@ -3,7 +3,7 @@
{
"files": [
{
"filename": "../instrument-coverage/coverage_of_if_else.rs",
"filename": "../coverage/various_conditions.rs",
"summary": {
"functions": {
"count": 1,
@ -16,15 +16,15 @@
"percent": 100
},
"lines": {
"count": 40,
"covered": 19,
"percent": 47.5
"count": 49,
"covered": 23,
"percent": 46.93877551020408
},
"regions": {
"count": 71,
"covered": 23,
"notcovered": 48,
"percent": 32.3943661971831
"count": 51,
"covered": 19,
"notcovered": 32,
"percent": 37.254901960784316
}
}
}
@ -41,15 +41,15 @@
"percent": 100
},
"lines": {
"count": 40,
"covered": 19,
"percent": 47.5
"count": 49,
"covered": 23,
"percent": 46.93877551020408
},
"regions": {
"count": 71,
"covered": 23,
"notcovered": 48,
"percent": 32.3943661971831
"count": 51,
"covered": 19,
"notcovered": 32,
"percent": 37.254901960784316
}
}
}

View file

@ -0,0 +1,59 @@
{
"data": [
{
"files": [
{
"filename": "../coverage/while_early_return.rs",
"summary": {
"functions": {
"count": 1,
"covered": 1,
"percent": 100
},
"instantiations": {
"count": 1,
"covered": 1,
"percent": 100
},
"lines": {
"count": 18,
"covered": 16,
"percent": 88.88888888888889
},
"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": 18,
"covered": 16,
"percent": 88.88888888888889
},
"regions": {
"count": 9,
"covered": 7,
"notcovered": 2,
"percent": 77.77777777777779
}
}
}
],
"type": "llvm.coverage.json.export",
"version": "2.0.1"
}

View file

@ -0,0 +1,94 @@
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| 0| }
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| 0| }
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|}

View file

@ -0,0 +1,34 @@
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

View file

@ -0,0 +1,67 @@
1| |#![allow(unused_assignments)]
2| |// expect-exit-status-1
3| |
4| |struct Firework<T> where T: Copy + std::fmt::Display {
5| | strength: T,
6| |}
7| |
8| |impl<T> Firework<T> 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| }
------------------
| <generics::Firework<f64>>::set_strength:
| 10| 2| fn set_strength(&mut self, new_strength: T) {
| 11| 2| self.strength = new_strength;
| 12| 2| }
------------------
| <generics::Firework<i32>>::set_strength:
| 10| 1| fn set_strength(&mut self, new_strength: T) {
| 11| 1| self.strength = new_strength;
| 12| 1| }
------------------
13| |}
14| |
15| |impl<T> Drop for Firework<T> where T: Copy + std::fmt::Display {
16| | #[inline(always)]
17| 2| fn drop(&mut self) {
18| 2| println!("BOOM times {}!!!", self.strength);
19| 2| }
------------------
| <generics::Firework<i32> as core::ops::drop::Drop>::drop:
| 17| 1| fn drop(&mut self) {
| 18| 1| println!("BOOM times {}!!!", self.strength);
| 19| 1| }
------------------
| <generics::Firework<f64> 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

View file

@ -0,0 +1,29 @@
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| }
28| 1|}

View file

@ -0,0 +1,41 @@
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|}

View file

@ -0,0 +1,58 @@
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| }
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| }
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|}

View file

@ -0,0 +1,44 @@
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| }
15| | let
16| 1| somebool
17| | =
18| 1| a < b
19| | ||
20| 0| b < c
21| | ;
22| | let
23| 1| somebool
24| | =
25| 1| b < a
26| | ||
27| 1| b < c
28| | ;
29| | let
30| 1| somebool
31| | =
32| 1| a < b
33| | &&
34| 1| b < c
35| | ;
36| | let
37| 1| somebool
38| | =
39| 1| b < a
40| | &&
41| 0| b < c
42| | ;
43| 1|}

View file

@ -0,0 +1,14 @@
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|}

View file

@ -0,0 +1,36 @@
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| }
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| | }
35| 1|}

View file

@ -0,0 +1,44 @@
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| }
13| |
14| 3| for
15| 3| _
16| | in
17| 1| 0..2
18| | {
19| | let z
20| | ;
21| | match
22| 2| countdown
23| 2| {
24| 2| x
25| 2| if
26| 2| x
27| 2| <
28| 2| 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| | }
43| 1|}

View file

@ -0,0 +1,36 @@
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| 6| for
17| 6| _
18| | in
19| 1| 0..10
20| | {
21| 6| countdown
22| 6| -= 1
23| | ;
24| | if
25| 6| countdown < 5
26| | {
27| 1| call(/*return_error=*/ true)?;
28| | }
29| | else
30| | {
31| 5| call(/*return_error=*/ false)?;
32| | }
33| | }
34| 0| Ok(())
35| 1|}

View file

@ -0,0 +1,69 @@
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|}

View file

@ -0,0 +1,48 @@
1| |#![allow(unused_assignments)]
2| |// expect-exit-status-1
3| |
4| |fn main() -> Result<(),u8> {
5| 1| let mut countdown = 10;
6| 7| 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).

View file

@ -8,8 +8,8 @@
# LINK_DEAD_CODE requires ignore-msvc due to Issue #76038
LINK_DEAD_CODE=yes
-include ../instrument-coverage-cov-reports-base/Makefile
-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 ../instrument-coverage/coverage_tools.mk for more information.
# See ../coverage/coverage_tools.mk for more information.

View file

@ -0,0 +1,59 @@
{
"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": 75,
"percent": 82.41758241758241
},
"regions": {
"count": 21,
"covered": 11,
"notcovered": 10,
"percent": 52.38095238095239
}
}
}
],
"totals": {
"functions": {
"count": 5,
"covered": 3,
"percent": 60
},
"instantiations": {
"count": 5,
"covered": 3,
"percent": 60
},
"lines": {
"count": 91,
"covered": 75,
"percent": 82.41758241758241
},
"regions": {
"count": 21,
"covered": 11,
"notcovered": 10,
"percent": 52.38095238095239
}
}
}
],
"type": "llvm.coverage.json.export",
"version": "2.0.1"
}

View file

@ -0,0 +1,59 @@
{
"data": [
{
"files": [
{
"filename": "../coverage/drop_trait.rs",
"summary": {
"functions": {
"count": 2,
"covered": 2,
"percent": 100
},
"instantiations": {
"count": 2,
"covered": 2,
"percent": 100
},
"lines": {
"count": 10,
"covered": 10,
"percent": 100
},
"regions": {
"count": 5,
"covered": 5,
"notcovered": 0,
"percent": 100
}
}
}
],
"totals": {
"functions": {
"count": 2,
"covered": 2,
"percent": 100
},
"instantiations": {
"count": 2,
"covered": 2,
"percent": 100
},
"lines": {
"count": 10,
"covered": 10,
"percent": 100
},
"regions": {
"count": 5,
"covered": 5,
"notcovered": 0,
"percent": 100
}
}
}
],
"type": "llvm.coverage.json.export",
"version": "2.0.1"
}

View file

@ -0,0 +1,59 @@
{
"data": [
{
"files": [
{
"filename": "../coverage/generics.rs",
"summary": {
"functions": {
"count": 3,
"covered": 3,
"percent": 100
},
"instantiations": {
"count": 5,
"covered": 5,
"percent": 100
},
"lines": {
"count": 16,
"covered": 16,
"percent": 100
},
"regions": {
"count": 6,
"covered": 6,
"notcovered": 0,
"percent": 100
}
}
}
],
"totals": {
"functions": {
"count": 3,
"covered": 3,
"percent": 100
},
"instantiations": {
"count": 5,
"covered": 5,
"percent": 100
},
"lines": {
"count": 16,
"covered": 16,
"percent": 100
},
"regions": {
"count": 6,
"covered": 6,
"notcovered": 0,
"percent": 100
}
}
}
],
"type": "llvm.coverage.json.export",
"version": "2.0.1"
}

View file

@ -0,0 +1,59 @@
{
"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": 4,
"covered": 4,
"notcovered": 0,
"percent": 100
}
}
}
],
"totals": {
"functions": {
"count": 1,
"covered": 1,
"percent": 100
},
"instantiations": {
"count": 1,
"covered": 1,
"percent": 100
},
"lines": {
"count": 19,
"covered": 19,
"percent": 100
},
"regions": {
"count": 4,
"covered": 4,
"notcovered": 0,
"percent": 100
}
}
}
],
"type": "llvm.coverage.json.export",
"version": "2.0.1"
}

View file

@ -0,0 +1,59 @@
{
"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"
}

View file

@ -0,0 +1,59 @@
{
"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": 13,
"covered": 13,
"notcovered": 0,
"percent": 100
}
}
}
],
"totals": {
"functions": {
"count": 4,
"covered": 4,
"percent": 100
},
"instantiations": {
"count": 4,
"covered": 4,
"percent": 100
},
"lines": {
"count": 26,
"covered": 26,
"percent": 100
},
"regions": {
"count": 13,
"covered": 13,
"notcovered": 0,
"percent": 100
}
}
}
],
"type": "llvm.coverage.json.export",
"version": "2.0.1"
}

View file

@ -0,0 +1,59 @@
{
"data": [
{
"files": [
{
"filename": "../coverage/lazy_boolean.rs",
"summary": {
"functions": {
"count": 1,
"covered": 1,
"percent": 100
},
"instantiations": {
"count": 1,
"covered": 1,
"percent": 100
},
"lines": {
"count": 21,
"covered": 19,
"percent": 90.47619047619048
},
"regions": {
"count": 16,
"covered": 14,
"notcovered": 2,
"percent": 87.5
}
}
}
],
"totals": {
"functions": {
"count": 1,
"covered": 1,
"percent": 100
},
"instantiations": {
"count": 1,
"covered": 1,
"percent": 100
},
"lines": {
"count": 21,
"covered": 19,
"percent": 90.47619047619048
},
"regions": {
"count": 16,
"covered": 14,
"notcovered": 2,
"percent": 87.5
}
}
}
],
"type": "llvm.coverage.json.export",
"version": "2.0.1"
}

View file

@ -0,0 +1,59 @@
{
"data": [
{
"files": [
{
"filename": "../coverage/loop_break_value.rs",
"summary": {
"functions": {
"count": 1,
"covered": 1,
"percent": 100
},
"instantiations": {
"count": 1,
"covered": 1,
"percent": 100
},
"lines": {
"count": 11,
"covered": 11,
"percent": 100
},
"regions": {
"count": 1,
"covered": 1,
"notcovered": 0,
"percent": 100
}
}
}
],
"totals": {
"functions": {
"count": 1,
"covered": 1,
"percent": 100
},
"instantiations": {
"count": 1,
"covered": 1,
"percent": 100
},
"lines": {
"count": 11,
"covered": 11,
"percent": 100
},
"regions": {
"count": 1,
"covered": 1,
"notcovered": 0,
"percent": 100
}
}
}
],
"type": "llvm.coverage.json.export",
"version": "2.0.1"
}

View file

@ -0,0 +1,59 @@
{
"data": [
{
"files": [
{
"filename": "../coverage/simple_loop.rs",
"summary": {
"functions": {
"count": 1,
"covered": 1,
"percent": 100
},
"instantiations": {
"count": 1,
"covered": 1,
"percent": 100
},
"lines": {
"count": 18,
"covered": 18,
"percent": 100
},
"regions": {
"count": 7,
"covered": 7,
"notcovered": 0,
"percent": 100
}
}
}
],
"totals": {
"functions": {
"count": 1,
"covered": 1,
"percent": 100
},
"instantiations": {
"count": 1,
"covered": 1,
"percent": 100
},
"lines": {
"count": 18,
"covered": 18,
"percent": 100
},
"regions": {
"count": 7,
"covered": 7,
"notcovered": 0,
"percent": 100
}
}
}
],
"type": "llvm.coverage.json.export",
"version": "2.0.1"
}

View file

@ -0,0 +1,59 @@
{
"data": [
{
"files": [
{
"filename": "../coverage/simple_match.rs",
"summary": {
"functions": {
"count": 1,
"covered": 1,
"percent": 100
},
"instantiations": {
"count": 1,
"covered": 1,
"percent": 100
},
"lines": {
"count": 26,
"covered": 26,
"percent": 100
},
"regions": {
"count": 9,
"covered": 9,
"notcovered": 0,
"percent": 100
}
}
}
],
"totals": {
"functions": {
"count": 1,
"covered": 1,
"percent": 100
},
"instantiations": {
"count": 1,
"covered": 1,
"percent": 100
},
"lines": {
"count": 26,
"covered": 26,
"percent": 100
},
"regions": {
"count": 9,
"covered": 9,
"notcovered": 0,
"percent": 100
}
}
}
],
"type": "llvm.coverage.json.export",
"version": "2.0.1"
}

View file

@ -0,0 +1,59 @@
{
"data": [
{
"files": [
{
"filename": "../coverage/try_error_result.rs",
"summary": {
"functions": {
"count": 2,
"covered": 2,
"percent": 100
},
"instantiations": {
"count": 2,
"covered": 2,
"percent": 100
},
"lines": {
"count": 16,
"covered": 15,
"percent": 93.75
},
"regions": {
"count": 13,
"covered": 12,
"notcovered": 1,
"percent": 92.3076923076923
}
}
}
],
"totals": {
"functions": {
"count": 2,
"covered": 2,
"percent": 100
},
"instantiations": {
"count": 2,
"covered": 2,
"percent": 100
},
"lines": {
"count": 16,
"covered": 15,
"percent": 93.75
},
"regions": {
"count": 13,
"covered": 12,
"notcovered": 1,
"percent": 92.3076923076923
}
}
}
],
"type": "llvm.coverage.json.export",
"version": "2.0.1"
}

View file

@ -3,7 +3,7 @@
{
"files": [
{
"filename": "../instrument-coverage/coverage_of_if_else.rs",
"filename": "../coverage/various_conditions.rs",
"summary": {
"functions": {
"count": 1,
@ -16,15 +16,15 @@
"percent": 100
},
"lines": {
"count": 40,
"covered": 19,
"percent": 47.5
"count": 49,
"covered": 23,
"percent": 46.93877551020408
},
"regions": {
"count": 71,
"covered": 23,
"notcovered": 48,
"percent": 32.3943661971831
"count": 51,
"covered": 19,
"notcovered": 32,
"percent": 37.254901960784316
}
}
}
@ -41,15 +41,15 @@
"percent": 100
},
"lines": {
"count": 40,
"covered": 19,
"percent": 47.5
"count": 49,
"covered": 23,
"percent": 46.93877551020408
},
"regions": {
"count": 71,
"covered": 23,
"notcovered": 48,
"percent": 32.3943661971831
"count": 51,
"covered": 19,
"notcovered": 32,
"percent": 37.254901960784316
}
}
}

View file

@ -0,0 +1,59 @@
{
"data": [
{
"files": [
{
"filename": "../coverage/while_early_return.rs",
"summary": {
"functions": {
"count": 1,
"covered": 1,
"percent": 100
},
"instantiations": {
"count": 1,
"covered": 1,
"percent": 100
},
"lines": {
"count": 18,
"covered": 16,
"percent": 88.88888888888889
},
"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": 18,
"covered": 16,
"percent": 88.88888888888889
},
"regions": {
"count": 9,
"covered": 7,
"notcovered": 2,
"percent": 77.77777777777779
}
}
}
],
"type": "llvm.coverage.json.export",
"version": "2.0.1"
}

View file

@ -0,0 +1,94 @@
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| 0| }
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| 0| }
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|}

View file

@ -0,0 +1,34 @@
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

View file

@ -0,0 +1,67 @@
1| |#![allow(unused_assignments)]
2| |// expect-exit-status-1
3| |
4| |struct Firework<T> where T: Copy + std::fmt::Display {
5| | strength: T,
6| |}
7| |
8| |impl<T> Firework<T> 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| }
------------------
| <generics::Firework<f64>>::set_strength:
| 10| 2| fn set_strength(&mut self, new_strength: T) {
| 11| 2| self.strength = new_strength;
| 12| 2| }
------------------
| <generics::Firework<i32>>::set_strength:
| 10| 1| fn set_strength(&mut self, new_strength: T) {
| 11| 1| self.strength = new_strength;
| 12| 1| }
------------------
13| |}
14| |
15| |impl<T> Drop for Firework<T> where T: Copy + std::fmt::Display {
16| | #[inline(always)]
17| 2| fn drop(&mut self) {
18| 2| println!("BOOM times {}!!!", self.strength);
19| 2| }
------------------
| <generics::Firework<i32> as core::ops::drop::Drop>::drop:
| 17| 1| fn drop(&mut self) {
| 18| 1| println!("BOOM times {}!!!", self.strength);
| 19| 1| }
------------------
| <generics::Firework<f64> 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

View file

@ -0,0 +1,29 @@
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| }
28| 1|}

View file

@ -0,0 +1,41 @@
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|}

View file

@ -0,0 +1,58 @@
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| }
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| }
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|}

View file

@ -0,0 +1,44 @@
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| }
15| | let
16| 1| somebool
17| | =
18| 1| a < b
19| | ||
20| 0| b < c
21| | ;
22| | let
23| 1| somebool
24| | =
25| 1| b < a
26| | ||
27| 1| b < c
28| | ;
29| | let
30| 1| somebool
31| | =
32| 1| a < b
33| | &&
34| 1| b < c
35| | ;
36| | let
37| 1| somebool
38| | =
39| 1| b < a
40| | &&
41| 0| b < c
42| | ;
43| 1|}

View file

@ -0,0 +1,14 @@
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|}

View file

@ -0,0 +1,36 @@
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| }
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| | }
35| 1|}

View file

@ -0,0 +1,44 @@
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| }
13| |
14| 3| for
15| 3| _
16| | in
17| 1| 0..2
18| | {
19| | let z
20| | ;
21| | match
22| 2| countdown
23| 2| {
24| 2| x
25| 2| if
26| 2| x
27| 2| <
28| 2| 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| | }
43| 1|}

View file

@ -0,0 +1,36 @@
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| 6| for
17| 6| _
18| | in
19| 1| 0..10
20| | {
21| 6| countdown
22| 6| -= 1
23| | ;
24| | if
25| 6| countdown < 5
26| | {
27| 1| call(/*return_error=*/ true)?;
28| | }
29| | else
30| | {
31| 5| call(/*return_error=*/ false)?;
32| | }
33| | }
34| 0| Ok(())
35| 1|}

View file

@ -0,0 +1,69 @@
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|}

View file

@ -0,0 +1,48 @@
1| |#![allow(unused_assignments)]
2| |// expect-exit-status-1
3| |
4| |fn main() -> Result<(),u8> {
5| 1| let mut countdown = 10;
6| 7| 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).

View file

@ -2,11 +2,11 @@
# 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 ../instrument-coverage/coverage_tools.mk for more information.
# See ../coverage/coverage_tools.mk for more information.
-include ../instrument-coverage/coverage_tools.mk
-include ../coverage/coverage_tools.mk
SOURCEDIR=../instrument-coverage
SOURCEDIR=../coverage
all: $(patsubst $(SOURCEDIR)/%.rs,%,$(wildcard $(SOURCEDIR)/*.rs))
@ -20,12 +20,9 @@ endif
-include clear_expected_if_blessed
%: $(SOURCEDIR)/%.rs
# Compile the test program with "experimental" coverage instrumentation and generate relevant MIR.
#
# FIXME(richkadel): `-Zexperimental-coverage` to `-Zinstrument-coverage` once we are
# satisfied with the branch-level instrumentation.
# Compile the test program with coverage instrumentation and generate relevant MIR.
$(RUSTC) $(SOURCEDIR)/$@.rs \
-Zexperimental-coverage \
-Zinstrument-coverage \
-Clink-dead-code=$(LINK_DEAD_CODE) \
-Zdump-mir=InstrumentCoverage \
-Zdump-mir-dir="$(TMPDIR)"/mir_dump.$@

View file

@ -0,0 +1,82 @@
<!DOCTYPE html>
<html>
<head>
<title>closure.main-{closure#0} - Coverage Spans</title>
<style>
.line {
counter-increment: line;
}
.line:before {
content: counter(line) ": ";
font-family: Menlo, Monaco, monospace;
font-style: italic;
width: 3.8em;
display: inline-block;
text-align: right;
filter: opacity(50%);
-webkit-user-select: none;
}
.code {
color: #dddddd;
background-color: #222222;
font-family: Menlo, Monaco, monospace;
line-height: 1.4em;
border-bottom: 2px solid #222222;
white-space: pre;
display: inline-block;
}
.odd {
background-color: #55bbff;
color: #223311;
}
.even {
background-color: #ee7756;
color: #551133;
}
.code {
--index: calc(var(--layer) - 1);
padding-top: calc(var(--index) * 0.15em);
filter:
hue-rotate(calc(var(--index) * 25deg))
saturate(calc(100% - (var(--index) * 2%)))
brightness(calc(100% - (var(--index) * 1.5%)));
}
.annotation {
color: #4444ff;
font-family: monospace;
font-style: italic;
display: none;
-webkit-user-select: none;
}
body:active .annotation {
/* requires holding mouse down anywhere on the page */
display: inline-block;
}
span:hover .annotation {
/* requires hover over a span ONLY on its first line */
display: inline-block;
}
</style>
</head>
<body>
<div class="code" style="counter-reset: line 32"><span class="line"> <span class="code" style="--layer: 0">||</span></span>
<span class="line"><span class="code" style="--layer: 0"> {</span></span>
<span class="line"><span class="code" style="--layer: 0"> let </span><span><span class="code even" style="--layer: 1" title="35:29-35:30: @0[1]: _2 = const 0_i32
35:13-35:26: @0[2]: FakeRead(ForLet, _2)"><span class="annotation">@0⦊</span>mut countdown = 0<span class="annotation">⦉@0</span></span></span><span class="code" style="--layer: 0">;</span></span>
<span class="line"><span class="code" style="--layer: 0"> if </span><span><span class="code even" style="--layer: 1" title="36:12-36:20: @0[5]: _4 = (*((*_1).0: &amp;bool))
36:12-36:20: @0[6]: FakeRead(ForMatchedPlace, _4)"><span class="annotation">@0⦊</span>is_false<span class="annotation">⦉@0</span></span></span><span class="code" style="--layer: 0"> </span><span><span class="code odd" style="--layer: 1" title="37:13-37:27: @3[0]: _2 = const 10_i32
36:21-38:10: @3[1]: _3 = const ()"><span class="annotation">@1,3⦊</span>{</span></span>
<span class="line"><span class="code odd" style="--layer: 1" title="37:13-37:27: @3[0]: _2 = const 10_i32
36:21-38:10: @3[1]: _3 = const ()"> countdown = 10;</span></span>
<span class="line"><span class="code odd" style="--layer: 1" title="37:13-37:27: @3[0]: _2 = const 10_i32
36:21-38:10: @3[1]: _3 = const ()"> }<span class="annotation">⦉@1,3</span></span></span><span class="code" style="--layer: 0"></span></span>
<span class="line"><span class="code" style="--layer: 0"> </span><span><span class="code even" style="--layer: 1" title="39:9-39:23: @4[4]: _6 = const &quot;alt string 2&quot;
39:9-39:23: @4[5]: _5 = &amp;(*_6)
39:9-39:34: @4.Call: _0 = &lt;str as ToOwned&gt;::to_owned(move _5) -&gt; [return: bb5, unwind: bb6]
40:6-40:6: @5.Return: return"><span class="annotation">@4,5⦊</span>"alt string 2".to_owned()</span></span>
<span class="line"><span class="code even" style="--layer: 1" title="39:9-39:23: @4[4]: _6 = const &quot;alt string 2&quot;
39:9-39:23: @4[5]: _5 = &amp;(*_6)
39:9-39:34: @4.Call: _0 = &lt;str as ToOwned&gt;::to_owned(move _5) -&gt; [return: bb5, unwind: bb6]
40:6-40:6: @5.Return: return"> }<span class="annotation">⦉@4,5</span></span></span></span></div>
</body>
</html>

View file

@ -0,0 +1,82 @@
<!DOCTYPE html>
<html>
<head>
<title>closure.main-{closure#1} - Coverage Spans</title>
<style>
.line {
counter-increment: line;
}
.line:before {
content: counter(line) ": ";
font-family: Menlo, Monaco, monospace;
font-style: italic;
width: 3.8em;
display: inline-block;
text-align: right;
filter: opacity(50%);
-webkit-user-select: none;
}
.code {
color: #dddddd;
background-color: #222222;
font-family: Menlo, Monaco, monospace;
line-height: 1.4em;
border-bottom: 2px solid #222222;
white-space: pre;
display: inline-block;
}
.odd {
background-color: #55bbff;
color: #223311;
}
.even {
background-color: #ee7756;
color: #551133;
}
.code {
--index: calc(var(--layer) - 1);
padding-top: calc(var(--index) * 0.15em);
filter:
hue-rotate(calc(var(--index) * 25deg))
saturate(calc(100% - (var(--index) * 2%)))
brightness(calc(100% - (var(--index) * 1.5%)));
}
.annotation {
color: #4444ff;
font-family: monospace;
font-style: italic;
display: none;
-webkit-user-select: none;
}
body:active .annotation {
/* requires holding mouse down anywhere on the page */
display: inline-block;
}
span:hover .annotation {
/* requires hover over a span ONLY on its first line */
display: inline-block;
}
</style>
</head>
<body>
<div class="code" style="counter-reset: line 74"><span class="line"> <span class="code" style="--layer: 0">||</span></span>
<span class="line"><span class="code" style="--layer: 0"> {</span></span>
<span class="line"><span class="code" style="--layer: 0"> let </span><span><span class="code even" style="--layer: 1" title="77:29-77:30: @0[1]: _2 = const 0_i32
77:13-77:26: @0[2]: FakeRead(ForLet, _2)"><span class="annotation">@0⦊</span>mut countdown = 0<span class="annotation">⦉@0</span></span></span><span class="code" style="--layer: 0">;</span></span>
<span class="line"><span class="code" style="--layer: 0"> if </span><span><span class="code even" style="--layer: 1" title="78:12-78:20: @0[5]: _4 = (*((*_1).0: &amp;bool))
78:12-78:20: @0[6]: FakeRead(ForMatchedPlace, _4)"><span class="annotation">@0⦊</span>is_false<span class="annotation">⦉@0</span></span></span><span class="code" style="--layer: 0"> </span><span><span class="code odd" style="--layer: 1" title="79:13-79:27: @3[0]: _2 = const 10_i32
78:21-80:10: @3[1]: _3 = const ()"><span class="annotation">@1,3⦊</span>{</span></span>
<span class="line"><span class="code odd" style="--layer: 1" title="79:13-79:27: @3[0]: _2 = const 10_i32
78:21-80:10: @3[1]: _3 = const ()"> countdown = 10;</span></span>
<span class="line"><span class="code odd" style="--layer: 1" title="79:13-79:27: @3[0]: _2 = const 10_i32
78:21-80:10: @3[1]: _3 = const ()"> }<span class="annotation">⦉@1,3</span></span></span><span class="code" style="--layer: 0"></span></span>
<span class="line"><span class="code" style="--layer: 0"> </span><span><span class="code even" style="--layer: 1" title="81:9-81:23: @4[4]: _6 = const &quot;alt string 4&quot;
81:9-81:23: @4[5]: _5 = &amp;(*_6)
81:9-81:34: @4.Call: _0 = &lt;str as ToOwned&gt;::to_owned(move _5) -&gt; [return: bb5, unwind: bb6]
82:6-82:6: @5.Return: return"><span class="annotation">@4,5⦊</span>"alt string 4".to_owned()</span></span>
<span class="line"><span class="code even" style="--layer: 1" title="81:9-81:23: @4[4]: _6 = const &quot;alt string 4&quot;
81:9-81:23: @4[5]: _5 = &amp;(*_6)
81:9-81:34: @4.Call: _0 = &lt;str as ToOwned&gt;::to_owned(move _5) -&gt; [return: bb5, unwind: bb6]
82:6-82:6: @5.Return: return"> }<span class="annotation">⦉@4,5</span></span></span></span></div>
</body>
</html>

View file

@ -0,0 +1,82 @@
<!DOCTYPE html>
<html>
<head>
<title>closure.main-{closure#2} - Coverage Spans</title>
<style>
.line {
counter-increment: line;
}
.line:before {
content: counter(line) ": ";
font-family: Menlo, Monaco, monospace;
font-style: italic;
width: 3.8em;
display: inline-block;
text-align: right;
filter: opacity(50%);
-webkit-user-select: none;
}
.code {
color: #dddddd;
background-color: #222222;
font-family: Menlo, Monaco, monospace;
line-height: 1.4em;
border-bottom: 2px solid #222222;
white-space: pre;
display: inline-block;
}
.odd {
background-color: #55bbff;
color: #223311;
}
.even {
background-color: #ee7756;
color: #551133;
}
.code {
--index: calc(var(--layer) - 1);
padding-top: calc(var(--index) * 0.15em);
filter:
hue-rotate(calc(var(--index) * 25deg))
saturate(calc(100% - (var(--index) * 2%)))
brightness(calc(100% - (var(--index) * 1.5%)));
}
.annotation {
color: #4444ff;
font-family: monospace;
font-style: italic;
display: none;
-webkit-user-select: none;
}
body:active .annotation {
/* requires holding mouse down anywhere on the page */
display: inline-block;
}
span:hover .annotation {
/* requires hover over a span ONLY on its first line */
display: inline-block;
}
</style>
</head>
<body>
<div class="code" style="counter-reset: line 17"><span class="line"> <span class="code" style="--layer: 0">||</span></span>
<span class="line"><span class="code" style="--layer: 0"> {</span></span>
<span class="line"><span class="code" style="--layer: 0"> let </span><span><span class="code even" style="--layer: 1" title="20:37-20:38: @0[1]: _2 = const 0_i32
20:21-20:34: @0[2]: FakeRead(ForLet, _2)"><span class="annotation">@0⦊</span>mut countdown = 0<span class="annotation">⦉@0</span></span></span><span class="code" style="--layer: 0">;</span></span>
<span class="line"><span class="code" style="--layer: 0"> if </span><span><span class="code even" style="--layer: 1" title="21:20-21:28: @0[5]: _4 = (*(_1.0: &amp;bool))
21:20-21:28: @0[6]: FakeRead(ForMatchedPlace, _4)"><span class="annotation">@0⦊</span>is_false<span class="annotation">⦉@0</span></span></span><span class="code" style="--layer: 0"> </span><span><span class="code odd" style="--layer: 1" title="22:21-22:35: @3[0]: _2 = const 10_i32
21:29-23:18: @3[1]: _3 = const ()"><span class="annotation">@1,3⦊</span>{</span></span>
<span class="line"><span class="code odd" style="--layer: 1" title="22:21-22:35: @3[0]: _2 = const 10_i32
21:29-23:18: @3[1]: _3 = const ()"> countdown = 10;</span></span>
<span class="line"><span class="code odd" style="--layer: 1" title="22:21-22:35: @3[0]: _2 = const 10_i32
21:29-23:18: @3[1]: _3 = const ()"> }<span class="annotation">⦉@1,3</span></span></span><span class="code" style="--layer: 0"></span></span>
<span class="line"><span class="code" style="--layer: 0"> </span><span><span class="code even" style="--layer: 1" title="24:17-24:31: @4[4]: _6 = const &quot;alt string 1&quot;
24:17-24:31: @4[5]: _5 = &amp;(*_6)
24:17-24:42: @4.Call: _0 = &lt;str as ToOwned&gt;::to_owned(move _5) -&gt; [return: bb5, unwind: bb6]
25:14-25:14: @5.Return: return"><span class="annotation">@4,5⦊</span>"alt string 1".to_owned()</span></span>
<span class="line"><span class="code even" style="--layer: 1" title="24:17-24:31: @4[4]: _6 = const &quot;alt string 1&quot;
24:17-24:31: @4[5]: _5 = &amp;(*_6)
24:17-24:42: @4.Call: _0 = &lt;str as ToOwned&gt;::to_owned(move _5) -&gt; [return: bb5, unwind: bb6]
25:14-25:14: @5.Return: return"> }<span class="annotation">⦉@4,5</span></span></span></span></div>
</body>
</html>

View file

@ -0,0 +1,82 @@
<!DOCTYPE html>
<html>
<head>
<title>closure.main-{closure#3} - Coverage Spans</title>
<style>
.line {
counter-increment: line;
}
.line:before {
content: counter(line) ": ";
font-family: Menlo, Monaco, monospace;
font-style: italic;
width: 3.8em;
display: inline-block;
text-align: right;
filter: opacity(50%);
-webkit-user-select: none;
}
.code {
color: #dddddd;
background-color: #222222;
font-family: Menlo, Monaco, monospace;
line-height: 1.4em;
border-bottom: 2px solid #222222;
white-space: pre;
display: inline-block;
}
.odd {
background-color: #55bbff;
color: #223311;
}
.even {
background-color: #ee7756;
color: #551133;
}
.code {
--index: calc(var(--layer) - 1);
padding-top: calc(var(--index) * 0.15em);
filter:
hue-rotate(calc(var(--index) * 25deg))
saturate(calc(100% - (var(--index) * 2%)))
brightness(calc(100% - (var(--index) * 1.5%)));
}
.annotation {
color: #4444ff;
font-family: monospace;
font-style: italic;
display: none;
-webkit-user-select: none;
}
body:active .annotation {
/* requires holding mouse down anywhere on the page */
display: inline-block;
}
span:hover .annotation {
/* requires hover over a span ONLY on its first line */
display: inline-block;
}
</style>
</head>
<body>
<div class="code" style="counter-reset: line 59"><span class="line"> <span class="code" style="--layer: 0">||</span></span>
<span class="line"><span class="code" style="--layer: 0"> {</span></span>
<span class="line"><span class="code" style="--layer: 0"> let </span><span><span class="code even" style="--layer: 1" title="62:37-62:38: @0[1]: _2 = const 0_i32
62:21-62:34: @0[2]: FakeRead(ForLet, _2)"><span class="annotation">@0⦊</span>mut countdown = 0<span class="annotation">⦉@0</span></span></span><span class="code" style="--layer: 0">;</span></span>
<span class="line"><span class="code" style="--layer: 0"> if </span><span><span class="code even" style="--layer: 1" title="63:20-63:28: @0[5]: _4 = (*(_1.0: &amp;bool))
63:20-63:28: @0[6]: FakeRead(ForMatchedPlace, _4)"><span class="annotation">@0⦊</span>is_false<span class="annotation">⦉@0</span></span></span><span class="code" style="--layer: 0"> </span><span><span class="code odd" style="--layer: 1" title="64:21-64:35: @3[0]: _2 = const 10_i32
63:29-65:18: @3[1]: _3 = const ()"><span class="annotation">@1,3⦊</span>{</span></span>
<span class="line"><span class="code odd" style="--layer: 1" title="64:21-64:35: @3[0]: _2 = const 10_i32
63:29-65:18: @3[1]: _3 = const ()"> countdown = 10;</span></span>
<span class="line"><span class="code odd" style="--layer: 1" title="64:21-64:35: @3[0]: _2 = const 10_i32
63:29-65:18: @3[1]: _3 = const ()"> }<span class="annotation">⦉@1,3</span></span></span><span class="code" style="--layer: 0"></span></span>
<span class="line"><span class="code" style="--layer: 0"> </span><span><span class="code even" style="--layer: 1" title="66:17-66:31: @4[4]: _6 = const &quot;alt string 3&quot;
66:17-66:31: @4[5]: _5 = &amp;(*_6)
66:17-66:42: @4.Call: _0 = &lt;str as ToOwned&gt;::to_owned(move _5) -&gt; [return: bb5, unwind: bb6]
67:14-67:14: @5.Return: return"><span class="annotation">@4,5⦊</span>"alt string 3".to_owned()</span></span>
<span class="line"><span class="code even" style="--layer: 1" title="66:17-66:31: @4[4]: _6 = const &quot;alt string 3&quot;
66:17-66:31: @4[5]: _5 = &amp;(*_6)
66:17-66:42: @4.Call: _0 = &lt;str as ToOwned&gt;::to_owned(move _5) -&gt; [return: bb5, unwind: bb6]
67:14-67:14: @5.Return: return"> }<span class="annotation">⦉@4,5</span></span></span></span></div>
</body>
</html>

View file

@ -0,0 +1,119 @@
<!DOCTYPE html>
<html>
<head>
<title>drop_trait.main - Coverage Spans</title>
<style>
.line {
counter-increment: line;
}
.line:before {
content: counter(line) ": ";
font-family: Menlo, Monaco, monospace;
font-style: italic;
width: 3.8em;
display: inline-block;
text-align: right;
filter: opacity(50%);
-webkit-user-select: none;
}
.code {
color: #dddddd;
background-color: #222222;
font-family: Menlo, Monaco, monospace;
line-height: 1.4em;
border-bottom: 2px solid #222222;
white-space: pre;
display: inline-block;
}
.odd {
background-color: #55bbff;
color: #223311;
}
.even {
background-color: #ee7756;
color: #551133;
}
.code {
--index: calc(var(--layer) - 1);
padding-top: calc(var(--index) * 0.15em);
filter:
hue-rotate(calc(var(--index) * 25deg))
saturate(calc(100% - (var(--index) * 2%)))
brightness(calc(100% - (var(--index) * 1.5%)));
}
.annotation {
color: #4444ff;
font-family: monospace;
font-style: italic;
display: none;
-webkit-user-select: none;
}
body:active .annotation {
/* requires holding mouse down anywhere on the page */
display: inline-block;
}
span:hover .annotation {
/* requires hover over a span ONLY on its first line */
display: inline-block;
}
</style>
</head>
<body>
<div class="code" style="counter-reset: line 13"><span class="line"><span class="code" style="--layer: 0">fn main() -&gt; Result&lt;(),u8&gt; {</span></span>
<span class="line"><span class="code" style="--layer: 0"> let </span><span><span class="code even" style="--layer: 1" title="15:24-15:48: @0[1]: _1 = Firework { strength: const 1_i32 }
15:9-15:21: @0[2]: FakeRead(ForLet, _1)
17:16-17:42: @0[4]: _2 = Firework { strength: const 100_i32 }
17:9-17:13: @0[5]: FakeRead(ForLet, _2)"><span class="annotation">@0⦊</span>_firecracker = Firework { strength: 1 };</span></span>
<span class="line"><span class="code even" style="--layer: 1" title="15:24-15:48: @0[1]: _1 = Firework { strength: const 1_i32 }
15:9-15:21: @0[2]: FakeRead(ForLet, _1)
17:16-17:42: @0[4]: _2 = Firework { strength: const 100_i32 }
17:9-17:13: @0[5]: FakeRead(ForLet, _2)"></span></span>
<span class="line"><span class="code even" style="--layer: 1" title="15:24-15:48: @0[1]: _1 = Firework { strength: const 1_i32 }
15:9-15:21: @0[2]: FakeRead(ForLet, _1)
17:16-17:42: @0[4]: _2 = Firework { strength: const 100_i32 }
17:9-17:13: @0[5]: FakeRead(ForLet, _2)"> let _tnt = Firework { strength: 100 }<span class="annotation">⦉@0</span></span></span><span class="code" style="--layer: 0">;</span></span>
<span class="line"><span class="code" style="--layer: 0"></span></span>
<span class="line"><span class="code" style="--layer: 0"> if </span><span><span class="code even" style="--layer: 1" title="19:8-19:12: @0[8]: _4 = const true
19:8-19:12: @0[9]: FakeRead(ForMatchedPlace, _4)"><span class="annotation">@0⦊</span>true<span class="annotation">⦉@0</span></span></span><span class="code" style="--layer: 0"> {</span></span>
<span class="line"><span class="code" style="--layer: 0"> </span><span><span class="code odd" style="--layer: 1" title="20:18-20:41: @3[6]: _21 = const main::promoted[1]
20:18-20:41: @3[7]: _11 = &amp;(*_21)
20:18-20:41: @3[8]: _10 = &amp;(*_11)
20:18-20:41: @3[9]: _9 = move _10 as &amp;[&amp;str] (Pointer(Unsize))
20:9-20:43: @3[15]: _17 = ()
20:9-20:43: @3[16]: FakeRead(ForMatchedPlace, _17)
20:9-20:43: @3[17]: _20 = const main::promoted[0]
20:9-20:43: @3[18]: _15 = &amp;(*_20)
20:9-20:43: @3[19]: _14 = &amp;(*_15)
20:9-20:43: @3[20]: _13 = move _14 as &amp;[std::fmt::ArgumentV1] (Pointer(Unsize))
20:9-20:43: @3.Call: _8 = Arguments::new_v1(move _9, move _13) -&gt; [return: bb4, unwind: bb12]
20:9-20:43: @4.Call: _7 = _print(move _8) -&gt; [return: bb5, unwind: bb12]
20:9-20:43: @5[5]: _6 = const ()
21:16-21:22: @5[7]: _0 = std::result::Result::&lt;(), u8&gt;::Err(const 1_u8)"><span class="annotation">@1,3,4,5,9,10⦊</span>println!("Exiting with error...");</span></span>
<span class="line"><span class="code odd" style="--layer: 1" title="20:18-20:41: @3[6]: _21 = const main::promoted[1]
20:18-20:41: @3[7]: _11 = &amp;(*_21)
20:18-20:41: @3[8]: _10 = &amp;(*_11)
20:18-20:41: @3[9]: _9 = move _10 as &amp;[&amp;str] (Pointer(Unsize))
20:9-20:43: @3[15]: _17 = ()
20:9-20:43: @3[16]: FakeRead(ForMatchedPlace, _17)
20:9-20:43: @3[17]: _20 = const main::promoted[0]
20:9-20:43: @3[18]: _15 = &amp;(*_20)
20:9-20:43: @3[19]: _14 = &amp;(*_15)
20:9-20:43: @3[20]: _13 = move _14 as &amp;[std::fmt::ArgumentV1] (Pointer(Unsize))
20:9-20:43: @3.Call: _8 = Arguments::new_v1(move _9, move _13) -&gt; [return: bb4, unwind: bb12]
20:9-20:43: @4.Call: _7 = _print(move _8) -&gt; [return: bb5, unwind: bb12]
20:9-20:43: @5[5]: _6 = const ()
21:16-21:22: @5[7]: _0 = std::result::Result::&lt;(), u8&gt;::Err(const 1_u8)"> return Err(1)<span class="annotation">⦉@1,3,4,5,9,10</span></span></span><span class="code" style="--layer: 0">;</span></span>
<span class="line"><span class="code" style="--layer: 0"> }</span></span>
<span class="line"><span class="code" style="--layer: 0"></span></span>
<span class="line"><span class="code" style="--layer: 0"> let _ = </span><span><span class="code even" style="--layer: 1" title="24:13-24:40: @2[4]: _18 = Firework { strength: const 1000_i32 }
26:8-26:10: @6[2]: _19 = ()
26:5-26:11: @6[3]: _0 = std::result::Result::&lt;(), u8&gt;::Ok(move _19)"><span class="annotation">@2,6,7,8⦊</span>Firework { strength: 1000 };</span></span>
<span class="line"><span class="code even" style="--layer: 1" title="24:13-24:40: @2[4]: _18 = Firework { strength: const 1000_i32 }
26:8-26:10: @6[2]: _19 = ()
26:5-26:11: @6[3]: _0 = std::result::Result::&lt;(), u8&gt;::Ok(move _19)"></span></span>
<span class="line"><span class="code even" style="--layer: 1" title="24:13-24:40: @2[4]: _18 = Firework { strength: const 1000_i32 }
26:8-26:10: @6[2]: _19 = ()
26:5-26:11: @6[3]: _0 = std::result::Result::&lt;(), u8&gt;::Ok(move _19)"> Ok(())<span class="annotation">⦉@2,6,7,8</span></span></span><span class="code" style="--layer: 0"></span></span>
<span class="line"><span class="code" style="--layer: 0">}</span><span><span class="code odd" style="--layer: 1" title="27:2-27:2: @11.Return: return"><span class="annotation">@11⦊</span><span class="annotation">⦉@11</span></span></span></span></div>
</body>
</html>

View file

@ -0,0 +1,123 @@
<!DOCTYPE html>
<html>
<head>
<title>drop_trait.{impl#0}-drop - Coverage Spans</title>
<style>
.line {
counter-increment: line;
}
.line:before {
content: counter(line) ": ";
font-family: Menlo, Monaco, monospace;
font-style: italic;
width: 3.8em;
display: inline-block;
text-align: right;
filter: opacity(50%);
-webkit-user-select: none;
}
.code {
color: #dddddd;
background-color: #222222;
font-family: Menlo, Monaco, monospace;
line-height: 1.4em;
border-bottom: 2px solid #222222;
white-space: pre;
display: inline-block;
}
.odd {
background-color: #55bbff;
color: #223311;
}
.even {
background-color: #ee7756;
color: #551133;
}
.code {
--index: calc(var(--layer) - 1);
padding-top: calc(var(--index) * 0.15em);
filter:
hue-rotate(calc(var(--index) * 25deg))
saturate(calc(100% - (var(--index) * 2%)))
brightness(calc(100% - (var(--index) * 1.5%)));
}
.annotation {
color: #4444ff;
font-family: monospace;
font-style: italic;
display: none;
-webkit-user-select: none;
}
body:active .annotation {
/* requires holding mouse down anywhere on the page */
display: inline-block;
}
span:hover .annotation {
/* requires hover over a span ONLY on its first line */
display: inline-block;
}
</style>
</head>
<body>
<div class="code" style="counter-reset: line 8"><span class="line"> <span class="code" style="--layer: 0">fn drop(&amp;mut self) </span><span><span class="code even" style="--layer: 1" title="10:18-10:36: @0[6]: _19 = const &lt;Firework as Drop&gt;::drop::promoted[0]
10:18-10:36: @0[7]: _7 = &amp;(*_19)
10:18-10:36: @0[8]: _6 = &amp;(*_7)
10:18-10:36: @0[9]: _5 = move _6 as &amp;[&amp;str] (Pointer(Unsize))
10:38-10:51: @0[17]: _14 = &amp;((*_1).0: i32)
10:9-10:53: @0[18]: _13 = (move _14,)
10:9-10:53: @0[20]: FakeRead(ForMatchedPlace, _13)
10:9-10:53: @0[22]: _15 = (_13.0: &amp;i32)
10:9-10:53: @0[25]: _17 = &amp;(*_15)
10:9-10:53: @0[27]: _18 = &lt;i32 as std::fmt::Display&gt;::fmt as for&lt;&#39;r, &#39;s, &#39;t0&gt; fn(&amp;&#39;r i32, &amp;&#39;s mut std::fmt::Formatter&lt;&#39;t0&gt;) -&gt; std::result::Result&lt;(), std::fmt::Error&gt; (Pointer(ReifyFnPointer))
10:9-10:53: @0.Call: _16 = ArgumentV1::new::&lt;i32&gt;(move _17, move _18) -&gt; [return: bb1, unwind: bb4]
10:9-10:53: @1[2]: _12 = [move _16]
10:9-10:53: @1[5]: _11 = &amp;_12
10:9-10:53: @1[6]: _10 = &amp;(*_11)
10:9-10:53: @1[7]: _9 = move _10 as &amp;[std::fmt::ArgumentV1] (Pointer(Unsize))
10:9-10:53: @1.Call: _4 = Arguments::new_v1(move _5, move _9) -&gt; [return: bb2, unwind: bb4]
10:9-10:53: @2.Call: _3 = _print(move _4) -&gt; [return: bb3, unwind: bb4]
10:9-10:53: @3[6]: _2 = const ()
9:24-11:6: @3[8]: _0 = const ()
11:6-11:6: @3.Return: return"><span class="annotation">@0,1,2,3⦊</span>{</span></span>
<span class="line"><span class="code even" style="--layer: 1" title="10:18-10:36: @0[6]: _19 = const &lt;Firework as Drop&gt;::drop::promoted[0]
10:18-10:36: @0[7]: _7 = &amp;(*_19)
10:18-10:36: @0[8]: _6 = &amp;(*_7)
10:18-10:36: @0[9]: _5 = move _6 as &amp;[&amp;str] (Pointer(Unsize))
10:38-10:51: @0[17]: _14 = &amp;((*_1).0: i32)
10:9-10:53: @0[18]: _13 = (move _14,)
10:9-10:53: @0[20]: FakeRead(ForMatchedPlace, _13)
10:9-10:53: @0[22]: _15 = (_13.0: &amp;i32)
10:9-10:53: @0[25]: _17 = &amp;(*_15)
10:9-10:53: @0[27]: _18 = &lt;i32 as std::fmt::Display&gt;::fmt as for&lt;&#39;r, &#39;s, &#39;t0&gt; fn(&amp;&#39;r i32, &amp;&#39;s mut std::fmt::Formatter&lt;&#39;t0&gt;) -&gt; std::result::Result&lt;(), std::fmt::Error&gt; (Pointer(ReifyFnPointer))
10:9-10:53: @0.Call: _16 = ArgumentV1::new::&lt;i32&gt;(move _17, move _18) -&gt; [return: bb1, unwind: bb4]
10:9-10:53: @1[2]: _12 = [move _16]
10:9-10:53: @1[5]: _11 = &amp;_12
10:9-10:53: @1[6]: _10 = &amp;(*_11)
10:9-10:53: @1[7]: _9 = move _10 as &amp;[std::fmt::ArgumentV1] (Pointer(Unsize))
10:9-10:53: @1.Call: _4 = Arguments::new_v1(move _5, move _9) -&gt; [return: bb2, unwind: bb4]
10:9-10:53: @2.Call: _3 = _print(move _4) -&gt; [return: bb3, unwind: bb4]
10:9-10:53: @3[6]: _2 = const ()
9:24-11:6: @3[8]: _0 = const ()
11:6-11:6: @3.Return: return"> println!("BOOM times {}!!!", self.strength);</span></span>
<span class="line"><span class="code even" style="--layer: 1" title="10:18-10:36: @0[6]: _19 = const &lt;Firework as Drop&gt;::drop::promoted[0]
10:18-10:36: @0[7]: _7 = &amp;(*_19)
10:18-10:36: @0[8]: _6 = &amp;(*_7)
10:18-10:36: @0[9]: _5 = move _6 as &amp;[&amp;str] (Pointer(Unsize))
10:38-10:51: @0[17]: _14 = &amp;((*_1).0: i32)
10:9-10:53: @0[18]: _13 = (move _14,)
10:9-10:53: @0[20]: FakeRead(ForMatchedPlace, _13)
10:9-10:53: @0[22]: _15 = (_13.0: &amp;i32)
10:9-10:53: @0[25]: _17 = &amp;(*_15)
10:9-10:53: @0[27]: _18 = &lt;i32 as std::fmt::Display&gt;::fmt as for&lt;&#39;r, &#39;s, &#39;t0&gt; fn(&amp;&#39;r i32, &amp;&#39;s mut std::fmt::Formatter&lt;&#39;t0&gt;) -&gt; std::result::Result&lt;(), std::fmt::Error&gt; (Pointer(ReifyFnPointer))
10:9-10:53: @0.Call: _16 = ArgumentV1::new::&lt;i32&gt;(move _17, move _18) -&gt; [return: bb1, unwind: bb4]
10:9-10:53: @1[2]: _12 = [move _16]
10:9-10:53: @1[5]: _11 = &amp;_12
10:9-10:53: @1[6]: _10 = &amp;(*_11)
10:9-10:53: @1[7]: _9 = move _10 as &amp;[std::fmt::ArgumentV1] (Pointer(Unsize))
10:9-10:53: @1.Call: _4 = Arguments::new_v1(move _5, move _9) -&gt; [return: bb2, unwind: bb4]
10:9-10:53: @2.Call: _3 = _print(move _4) -&gt; [return: bb3, unwind: bb4]
10:9-10:53: @3[6]: _2 = const ()
9:24-11:6: @3[8]: _0 = const ()
11:6-11:6: @3.Return: return"> }<span class="annotation">⦉@0,1,2,3</span></span></span></span></div>
</body>
</html>

View file

@ -0,0 +1,167 @@
<!DOCTYPE html>
<html>
<head>
<title>generics.main - Coverage Spans</title>
<style>
.line {
counter-increment: line;
}
.line:before {
content: counter(line) ": ";
font-family: Menlo, Monaco, monospace;
font-style: italic;
width: 3.8em;
display: inline-block;
text-align: right;
filter: opacity(50%);
-webkit-user-select: none;
}
.code {
color: #dddddd;
background-color: #222222;
font-family: Menlo, Monaco, monospace;
line-height: 1.4em;
border-bottom: 2px solid #222222;
white-space: pre;
display: inline-block;
}
.odd {
background-color: #55bbff;
color: #223311;
}
.even {
background-color: #ee7756;
color: #551133;
}
.code {
--index: calc(var(--layer) - 1);
padding-top: calc(var(--index) * 0.15em);
filter:
hue-rotate(calc(var(--index) * 25deg))
saturate(calc(100% - (var(--index) * 2%)))
brightness(calc(100% - (var(--index) * 1.5%)));
}
.annotation {
color: #4444ff;
font-family: monospace;
font-style: italic;
display: none;
-webkit-user-select: none;
}
body:active .annotation {
/* requires holding mouse down anywhere on the page */
display: inline-block;
}
span:hover .annotation {
/* requires hover over a span ONLY on its first line */
display: inline-block;
}
</style>
</head>
<body>
<div class="code" style="counter-reset: line 21"><span class="line"><span class="code" style="--layer: 0">fn main() -&gt; Result&lt;(),u8&gt; {</span></span>
<span class="line"><span class="code" style="--layer: 0"> let </span><span><span class="code even" style="--layer: 1" title="23:27-23:51: @0[1]: _1 = Firework::&lt;i32&gt; { strength: const 1_i32 }
23:9-23:24: @0[2]: FakeRead(ForLet, _1)
24:5-24:16: @0[5]: _3 = &amp;mut _1
24:5-24:32: @0.Call: _2 = Firework::&lt;i32&gt;::set_strength(move _3, const 2_i32) -&gt; [return: bb1, unwind: bb16]
26:19-26:47: @1[3]: _4 = Firework::&lt;f64&gt; { strength: const 100.09999999999999f64 }
26:9-26:16: @1[4]: FakeRead(ForLet, _4)
27:5-27:8: @1[7]: _6 = &amp;mut _4
27:5-27:28: @1.Call: _5 = Firework::&lt;f64&gt;::set_strength(move _6, const 200.09999999999999f64) -&gt; [return: bb2, unwind: bb15]
28:5-28:8: @2[4]: _8 = &amp;mut _4
28:5-28:28: @2.Call: _7 = Firework::&lt;f64&gt;::set_strength(move _8, const 300.30000000000001f64) -&gt; [return: bb3, unwind: bb15]"><span class="annotation">@0,1,2,3⦊</span>mut firecracker = Firework { strength: 1 };</span></span>
<span class="line"><span class="code even" style="--layer: 1" title="23:27-23:51: @0[1]: _1 = Firework::&lt;i32&gt; { strength: const 1_i32 }
23:9-23:24: @0[2]: FakeRead(ForLet, _1)
24:5-24:16: @0[5]: _3 = &amp;mut _1
24:5-24:32: @0.Call: _2 = Firework::&lt;i32&gt;::set_strength(move _3, const 2_i32) -&gt; [return: bb1, unwind: bb16]
26:19-26:47: @1[3]: _4 = Firework::&lt;f64&gt; { strength: const 100.09999999999999f64 }
26:9-26:16: @1[4]: FakeRead(ForLet, _4)
27:5-27:8: @1[7]: _6 = &amp;mut _4
27:5-27:28: @1.Call: _5 = Firework::&lt;f64&gt;::set_strength(move _6, const 200.09999999999999f64) -&gt; [return: bb2, unwind: bb15]
28:5-28:8: @2[4]: _8 = &amp;mut _4
28:5-28:28: @2.Call: _7 = Firework::&lt;f64&gt;::set_strength(move _8, const 300.30000000000001f64) -&gt; [return: bb3, unwind: bb15]"> firecracker.set_strength(2);</span></span>
<span class="line"><span class="code even" style="--layer: 1" title="23:27-23:51: @0[1]: _1 = Firework::&lt;i32&gt; { strength: const 1_i32 }
23:9-23:24: @0[2]: FakeRead(ForLet, _1)
24:5-24:16: @0[5]: _3 = &amp;mut _1
24:5-24:32: @0.Call: _2 = Firework::&lt;i32&gt;::set_strength(move _3, const 2_i32) -&gt; [return: bb1, unwind: bb16]
26:19-26:47: @1[3]: _4 = Firework::&lt;f64&gt; { strength: const 100.09999999999999f64 }
26:9-26:16: @1[4]: FakeRead(ForLet, _4)
27:5-27:8: @1[7]: _6 = &amp;mut _4
27:5-27:28: @1.Call: _5 = Firework::&lt;f64&gt;::set_strength(move _6, const 200.09999999999999f64) -&gt; [return: bb2, unwind: bb15]
28:5-28:8: @2[4]: _8 = &amp;mut _4
28:5-28:28: @2.Call: _7 = Firework::&lt;f64&gt;::set_strength(move _8, const 300.30000000000001f64) -&gt; [return: bb3, unwind: bb15]"></span></span>
<span class="line"><span class="code even" style="--layer: 1" title="23:27-23:51: @0[1]: _1 = Firework::&lt;i32&gt; { strength: const 1_i32 }
23:9-23:24: @0[2]: FakeRead(ForLet, _1)
24:5-24:16: @0[5]: _3 = &amp;mut _1
24:5-24:32: @0.Call: _2 = Firework::&lt;i32&gt;::set_strength(move _3, const 2_i32) -&gt; [return: bb1, unwind: bb16]
26:19-26:47: @1[3]: _4 = Firework::&lt;f64&gt; { strength: const 100.09999999999999f64 }
26:9-26:16: @1[4]: FakeRead(ForLet, _4)
27:5-27:8: @1[7]: _6 = &amp;mut _4
27:5-27:28: @1.Call: _5 = Firework::&lt;f64&gt;::set_strength(move _6, const 200.09999999999999f64) -&gt; [return: bb2, unwind: bb15]
28:5-28:8: @2[4]: _8 = &amp;mut _4
28:5-28:28: @2.Call: _7 = Firework::&lt;f64&gt;::set_strength(move _8, const 300.30000000000001f64) -&gt; [return: bb3, unwind: bb15]"> let mut tnt = Firework { strength: 100.1 };</span></span>
<span class="line"><span class="code even" style="--layer: 1" title="23:27-23:51: @0[1]: _1 = Firework::&lt;i32&gt; { strength: const 1_i32 }
23:9-23:24: @0[2]: FakeRead(ForLet, _1)
24:5-24:16: @0[5]: _3 = &amp;mut _1
24:5-24:32: @0.Call: _2 = Firework::&lt;i32&gt;::set_strength(move _3, const 2_i32) -&gt; [return: bb1, unwind: bb16]
26:19-26:47: @1[3]: _4 = Firework::&lt;f64&gt; { strength: const 100.09999999999999f64 }
26:9-26:16: @1[4]: FakeRead(ForLet, _4)
27:5-27:8: @1[7]: _6 = &amp;mut _4
27:5-27:28: @1.Call: _5 = Firework::&lt;f64&gt;::set_strength(move _6, const 200.09999999999999f64) -&gt; [return: bb2, unwind: bb15]
28:5-28:8: @2[4]: _8 = &amp;mut _4
28:5-28:28: @2.Call: _7 = Firework::&lt;f64&gt;::set_strength(move _8, const 300.30000000000001f64) -&gt; [return: bb3, unwind: bb15]"> tnt.set_strength(200.1);</span></span>
<span class="line"><span class="code even" style="--layer: 1" title="23:27-23:51: @0[1]: _1 = Firework::&lt;i32&gt; { strength: const 1_i32 }
23:9-23:24: @0[2]: FakeRead(ForLet, _1)
24:5-24:16: @0[5]: _3 = &amp;mut _1
24:5-24:32: @0.Call: _2 = Firework::&lt;i32&gt;::set_strength(move _3, const 2_i32) -&gt; [return: bb1, unwind: bb16]
26:19-26:47: @1[3]: _4 = Firework::&lt;f64&gt; { strength: const 100.09999999999999f64 }
26:9-26:16: @1[4]: FakeRead(ForLet, _4)
27:5-27:8: @1[7]: _6 = &amp;mut _4
27:5-27:28: @1.Call: _5 = Firework::&lt;f64&gt;::set_strength(move _6, const 200.09999999999999f64) -&gt; [return: bb2, unwind: bb15]
28:5-28:8: @2[4]: _8 = &amp;mut _4
28:5-28:28: @2.Call: _7 = Firework::&lt;f64&gt;::set_strength(move _8, const 300.30000000000001f64) -&gt; [return: bb3, unwind: bb15]"> tnt.set_strength(300.3)<span class="annotation">⦉@0,1,2,3</span></span></span><span class="code" style="--layer: 0">;</span></span>
<span class="line"><span class="code" style="--layer: 0"></span></span>
<span class="line"><span class="code" style="--layer: 0"> if </span><span><span class="code even" style="--layer: 1" title="30:8-30:12: @3[4]: _10 = const true
30:8-30:12: @3[5]: FakeRead(ForMatchedPlace, _10)"><span class="annotation">@0,1,2,3⦊</span>true<span class="annotation">⦉@0,1,2,3</span></span></span><span class="code" style="--layer: 0"> {</span></span>
<span class="line"><span class="code" style="--layer: 0"> </span><span><span class="code odd" style="--layer: 1" title="31:18-31:41: @6[6]: _27 = const main::promoted[1]
31:18-31:41: @6[7]: _17 = &amp;(*_27)
31:18-31:41: @6[8]: _16 = &amp;(*_17)
31:18-31:41: @6[9]: _15 = move _16 as &amp;[&amp;str] (Pointer(Unsize))
31:9-31:43: @6[15]: _23 = ()
31:9-31:43: @6[16]: FakeRead(ForMatchedPlace, _23)
31:9-31:43: @6[17]: _26 = const main::promoted[0]
31:9-31:43: @6[18]: _21 = &amp;(*_26)
31:9-31:43: @6[19]: _20 = &amp;(*_21)
31:9-31:43: @6[20]: _19 = move _20 as &amp;[std::fmt::ArgumentV1] (Pointer(Unsize))
31:9-31:43: @6.Call: _14 = Arguments::new_v1(move _15, move _19) -&gt; [return: bb7, unwind: bb15]
31:9-31:43: @7.Call: _13 = _print(move _14) -&gt; [return: bb8, unwind: bb15]
31:9-31:43: @8[5]: _12 = const ()
32:16-32:22: @8[7]: _0 = std::result::Result::&lt;(), u8&gt;::Err(const 1_u8)"><span class="annotation">@4,6,7,8,12,13⦊</span>println!("Exiting with error...");</span></span>
<span class="line"><span class="code odd" style="--layer: 1" title="31:18-31:41: @6[6]: _27 = const main::promoted[1]
31:18-31:41: @6[7]: _17 = &amp;(*_27)
31:18-31:41: @6[8]: _16 = &amp;(*_17)
31:18-31:41: @6[9]: _15 = move _16 as &amp;[&amp;str] (Pointer(Unsize))
31:9-31:43: @6[15]: _23 = ()
31:9-31:43: @6[16]: FakeRead(ForMatchedPlace, _23)
31:9-31:43: @6[17]: _26 = const main::promoted[0]
31:9-31:43: @6[18]: _21 = &amp;(*_26)
31:9-31:43: @6[19]: _20 = &amp;(*_21)
31:9-31:43: @6[20]: _19 = move _20 as &amp;[std::fmt::ArgumentV1] (Pointer(Unsize))
31:9-31:43: @6.Call: _14 = Arguments::new_v1(move _15, move _19) -&gt; [return: bb7, unwind: bb15]
31:9-31:43: @7.Call: _13 = _print(move _14) -&gt; [return: bb8, unwind: bb15]
31:9-31:43: @8[5]: _12 = const ()
32:16-32:22: @8[7]: _0 = std::result::Result::&lt;(), u8&gt;::Err(const 1_u8)"> return Err(1)<span class="annotation">⦉@4,6,7,8,12,13</span></span></span><span class="code" style="--layer: 0">;</span></span>
<span class="line"><span class="code" style="--layer: 0"> }</span></span>
<span class="line"><span class="code" style="--layer: 0"></span></span>
<span class="line"><span class="code" style="--layer: 0"> let _ = </span><span><span class="code even" style="--layer: 1" title="35:13-35:40: @5[4]: _24 = Firework::&lt;i32&gt; { strength: const 1000_i32 }
37:8-37:10: @9[2]: _25 = ()
37:5-37:11: @9[3]: _0 = std::result::Result::&lt;(), u8&gt;::Ok(move _25)"><span class="annotation">@5,9,10,11⦊</span>Firework { strength: 1000 };</span></span>
<span class="line"><span class="code even" style="--layer: 1" title="35:13-35:40: @5[4]: _24 = Firework::&lt;i32&gt; { strength: const 1000_i32 }
37:8-37:10: @9[2]: _25 = ()
37:5-37:11: @9[3]: _0 = std::result::Result::&lt;(), u8&gt;::Ok(move _25)"></span></span>
<span class="line"><span class="code even" style="--layer: 1" title="35:13-35:40: @5[4]: _24 = Firework::&lt;i32&gt; { strength: const 1000_i32 }
37:8-37:10: @9[2]: _25 = ()
37:5-37:11: @9[3]: _0 = std::result::Result::&lt;(), u8&gt;::Ok(move _25)"> Ok(())<span class="annotation">⦉@5,9,10,11</span></span></span><span class="code" style="--layer: 0"></span></span>
<span class="line"><span class="code" style="--layer: 0">}</span><span><span class="code odd" style="--layer: 1" title="38:2-38:2: @14.Return: return"><span class="annotation">@14⦊</span><span class="annotation">⦉@14</span></span></span></span></div>
</body>
</html>

View file

@ -1,8 +1,8 @@
<!DOCTYPE html>
<html>
<head>
<title>coverage_of_if_else - Code Regions</title>
<style>
<title>generics.{impl#0}-set_strength - Coverage Spans</title>
<style>
.line {
counter-increment: line;
}
@ -56,11 +56,20 @@
/* requires hover over a span ONLY on its first line */
display: inline-block;
}
</style>
</style>
</head>
<body>
<div class="code" style="counter-reset: line 4"><span class="line"><span class="code" style="--layer: 0">fn main() </span><span><span class="code even" style="--layer: 1" title="0: $DIR/spanview-block.rs:5:11: 5:13:
5:11-5:13: Assign: _0 = const ()
5:13-5:13: Return: return"><span class="annotation">0⦊</span>{}<span class="annotation">⦉0</span></span></span></span></div>
<div class="code" style="counter-reset: line 9"><span class="line"> <span class="code" style="--layer: 0">fn set_strength(&amp;mut self, new_strength: T) </span><span><span class="code even" style="--layer: 1" title="11:25-11:37: @0[1]: _3 = _2
11:9-11:37: @0[2]: ((*_1).0: T) = move _3
10:49-12:6: @0[4]: _0 = const ()
12:6-12:6: @0.Return: return"><span class="annotation">@0⦊</span>{</span></span>
<span class="line"><span class="code even" style="--layer: 1" title="11:25-11:37: @0[1]: _3 = _2
11:9-11:37: @0[2]: ((*_1).0: T) = move _3
10:49-12:6: @0[4]: _0 = const ()
12:6-12:6: @0.Return: return"> self.strength = new_strength;</span></span>
<span class="line"><span class="code even" style="--layer: 1" title="11:25-11:37: @0[1]: _3 = _2
11:9-11:37: @0[2]: ((*_1).0: T) = move _3
10:49-12:6: @0[4]: _0 = const ()
12:6-12:6: @0.Return: return"> }<span class="annotation">⦉@0</span></span></span></span></div>
</body>
</html>

View file

@ -0,0 +1,123 @@
<!DOCTYPE html>
<html>
<head>
<title>generics.{impl#1}-drop - Coverage Spans</title>
<style>
.line {
counter-increment: line;
}
.line:before {
content: counter(line) ": ";
font-family: Menlo, Monaco, monospace;
font-style: italic;
width: 3.8em;
display: inline-block;
text-align: right;
filter: opacity(50%);
-webkit-user-select: none;
}
.code {
color: #dddddd;
background-color: #222222;
font-family: Menlo, Monaco, monospace;
line-height: 1.4em;
border-bottom: 2px solid #222222;
white-space: pre;
display: inline-block;
}
.odd {
background-color: #55bbff;
color: #223311;
}
.even {
background-color: #ee7756;
color: #551133;
}
.code {
--index: calc(var(--layer) - 1);
padding-top: calc(var(--index) * 0.15em);
filter:
hue-rotate(calc(var(--index) * 25deg))
saturate(calc(100% - (var(--index) * 2%)))
brightness(calc(100% - (var(--index) * 1.5%)));
}
.annotation {
color: #4444ff;
font-family: monospace;
font-style: italic;
display: none;
-webkit-user-select: none;
}
body:active .annotation {
/* requires holding mouse down anywhere on the page */
display: inline-block;
}
span:hover .annotation {
/* requires hover over a span ONLY on its first line */
display: inline-block;
}
</style>
</head>
<body>
<div class="code" style="counter-reset: line 16"><span class="line"> <span class="code" style="--layer: 0">fn drop(&amp;mut self) </span><span><span class="code even" style="--layer: 1" title="18:18-18:36: @0[6]: _19 = const &lt;Firework&lt;T&gt; as Drop&gt;::drop::promoted[0]
18:18-18:36: @0[7]: _7 = &amp;(*_19)
18:18-18:36: @0[8]: _6 = &amp;(*_7)
18:18-18:36: @0[9]: _5 = move _6 as &amp;[&amp;str] (Pointer(Unsize))
18:38-18:51: @0[17]: _14 = &amp;((*_1).0: T)
18:9-18:53: @0[18]: _13 = (move _14,)
18:9-18:53: @0[20]: FakeRead(ForMatchedPlace, _13)
18:9-18:53: @0[22]: _15 = (_13.0: &amp;T)
18:9-18:53: @0[25]: _17 = &amp;(*_15)
18:9-18:53: @0[27]: _18 = &lt;T as std::fmt::Display&gt;::fmt as for&lt;&#39;r, &#39;s, &#39;t0&gt; fn(&amp;&#39;r T, &amp;&#39;s mut std::fmt::Formatter&lt;&#39;t0&gt;) -&gt; std::result::Result&lt;(), std::fmt::Error&gt; (Pointer(ReifyFnPointer))
18:9-18:53: @0.Call: _16 = ArgumentV1::new::&lt;T&gt;(move _17, move _18) -&gt; [return: bb1, unwind: bb4]
18:9-18:53: @1[2]: _12 = [move _16]
18:9-18:53: @1[5]: _11 = &amp;_12
18:9-18:53: @1[6]: _10 = &amp;(*_11)
18:9-18:53: @1[7]: _9 = move _10 as &amp;[std::fmt::ArgumentV1] (Pointer(Unsize))
18:9-18:53: @1.Call: _4 = Arguments::new_v1(move _5, move _9) -&gt; [return: bb2, unwind: bb4]
18:9-18:53: @2.Call: _3 = _print(move _4) -&gt; [return: bb3, unwind: bb4]
18:9-18:53: @3[6]: _2 = const ()
17:24-19:6: @3[8]: _0 = const ()
19:6-19:6: @3.Return: return"><span class="annotation">@0,1,2,3⦊</span>{</span></span>
<span class="line"><span class="code even" style="--layer: 1" title="18:18-18:36: @0[6]: _19 = const &lt;Firework&lt;T&gt; as Drop&gt;::drop::promoted[0]
18:18-18:36: @0[7]: _7 = &amp;(*_19)
18:18-18:36: @0[8]: _6 = &amp;(*_7)
18:18-18:36: @0[9]: _5 = move _6 as &amp;[&amp;str] (Pointer(Unsize))
18:38-18:51: @0[17]: _14 = &amp;((*_1).0: T)
18:9-18:53: @0[18]: _13 = (move _14,)
18:9-18:53: @0[20]: FakeRead(ForMatchedPlace, _13)
18:9-18:53: @0[22]: _15 = (_13.0: &amp;T)
18:9-18:53: @0[25]: _17 = &amp;(*_15)
18:9-18:53: @0[27]: _18 = &lt;T as std::fmt::Display&gt;::fmt as for&lt;&#39;r, &#39;s, &#39;t0&gt; fn(&amp;&#39;r T, &amp;&#39;s mut std::fmt::Formatter&lt;&#39;t0&gt;) -&gt; std::result::Result&lt;(), std::fmt::Error&gt; (Pointer(ReifyFnPointer))
18:9-18:53: @0.Call: _16 = ArgumentV1::new::&lt;T&gt;(move _17, move _18) -&gt; [return: bb1, unwind: bb4]
18:9-18:53: @1[2]: _12 = [move _16]
18:9-18:53: @1[5]: _11 = &amp;_12
18:9-18:53: @1[6]: _10 = &amp;(*_11)
18:9-18:53: @1[7]: _9 = move _10 as &amp;[std::fmt::ArgumentV1] (Pointer(Unsize))
18:9-18:53: @1.Call: _4 = Arguments::new_v1(move _5, move _9) -&gt; [return: bb2, unwind: bb4]
18:9-18:53: @2.Call: _3 = _print(move _4) -&gt; [return: bb3, unwind: bb4]
18:9-18:53: @3[6]: _2 = const ()
17:24-19:6: @3[8]: _0 = const ()
19:6-19:6: @3.Return: return"> println!("BOOM times {}!!!", self.strength);</span></span>
<span class="line"><span class="code even" style="--layer: 1" title="18:18-18:36: @0[6]: _19 = const &lt;Firework&lt;T&gt; as Drop&gt;::drop::promoted[0]
18:18-18:36: @0[7]: _7 = &amp;(*_19)
18:18-18:36: @0[8]: _6 = &amp;(*_7)
18:18-18:36: @0[9]: _5 = move _6 as &amp;[&amp;str] (Pointer(Unsize))
18:38-18:51: @0[17]: _14 = &amp;((*_1).0: T)
18:9-18:53: @0[18]: _13 = (move _14,)
18:9-18:53: @0[20]: FakeRead(ForMatchedPlace, _13)
18:9-18:53: @0[22]: _15 = (_13.0: &amp;T)
18:9-18:53: @0[25]: _17 = &amp;(*_15)
18:9-18:53: @0[27]: _18 = &lt;T as std::fmt::Display&gt;::fmt as for&lt;&#39;r, &#39;s, &#39;t0&gt; fn(&amp;&#39;r T, &amp;&#39;s mut std::fmt::Formatter&lt;&#39;t0&gt;) -&gt; std::result::Result&lt;(), std::fmt::Error&gt; (Pointer(ReifyFnPointer))
18:9-18:53: @0.Call: _16 = ArgumentV1::new::&lt;T&gt;(move _17, move _18) -&gt; [return: bb1, unwind: bb4]
18:9-18:53: @1[2]: _12 = [move _16]
18:9-18:53: @1[5]: _11 = &amp;_12
18:9-18:53: @1[6]: _10 = &amp;(*_11)
18:9-18:53: @1[7]: _9 = move _10 as &amp;[std::fmt::ArgumentV1] (Pointer(Unsize))
18:9-18:53: @1.Call: _4 = Arguments::new_v1(move _5, move _9) -&gt; [return: bb2, unwind: bb4]
18:9-18:53: @2.Call: _3 = _print(move _4) -&gt; [return: bb3, unwind: bb4]
18:9-18:53: @3[6]: _2 = const ()
17:24-19:6: @3[8]: _0 = const ()
19:6-19:6: @3.Return: return"> }<span class="annotation">⦉@0,1,2,3</span></span></span></span></div>
</body>
</html>

View file

@ -0,0 +1,162 @@
<!DOCTYPE html>
<html>
<head>
<title>if.main - Coverage Spans</title>
<style>
.line {
counter-increment: line;
}
.line:before {
content: counter(line) ": ";
font-family: Menlo, Monaco, monospace;
font-style: italic;
width: 3.8em;
display: inline-block;
text-align: right;
filter: opacity(50%);
-webkit-user-select: none;
}
.code {
color: #dddddd;
background-color: #222222;
font-family: Menlo, Monaco, monospace;
line-height: 1.4em;
border-bottom: 2px solid #222222;
white-space: pre;
display: inline-block;
}
.odd {
background-color: #55bbff;
color: #223311;
}
.even {
background-color: #ee7756;
color: #551133;
}
.code {
--index: calc(var(--layer) - 1);
padding-top: calc(var(--index) * 0.15em);
filter:
hue-rotate(calc(var(--index) * 25deg))
saturate(calc(100% - (var(--index) * 2%)))
brightness(calc(100% - (var(--index) * 1.5%)));
}
.annotation {
color: #4444ff;
font-family: monospace;
font-style: italic;
display: none;
-webkit-user-select: none;
}
body:active .annotation {
/* requires holding mouse down anywhere on the page */
display: inline-block;
}
span:hover .annotation {
/* requires hover over a span ONLY on its first line */
display: inline-block;
}
</style>
</head>
<body>
<div class="code" style="counter-reset: line 2"><span class="line"><span class="code" style="--layer: 0">fn main() {</span></span>
<span class="line"><span class="code" style="--layer: 0"> // Initialize test constants in a way that cannot be determined at compile time, to ensure</span></span>
<span class="line"><span class="code" style="--layer: 0"> // rustc and LLVM cannot optimize out statements (or coverage counters) downstream from</span></span>
<span class="line"><span class="code" style="--layer: 0"> // dependent conditions.</span></span>
<span class="line"><span class="code" style="--layer: 0"> let</span></span>
<span class="line"><span class="code" style="--layer: 0"> </span><span><span class="code even" style="--layer: 1" title="10:9-10:25: @0.Call: _4 = args() -&gt; [return: bb1, unwind: bb9]
10:9-10:25: @1[0]: _3 = &amp;_4
10:9-10:31: @1.Call: _2 = &lt;Args as ExactSizeIterator&gt;::len(move _3) -&gt; [return: bb2, unwind: bb8]
10:9-12:10: @2[1]: _1 = Eq(move _2, const 1_usize)
8:5-8:12: @2[3]: FakeRead(ForLet, _1)
18:9-18:10: @3[2]: _5 = const 0_i32
15:9-16:14: @3[3]: FakeRead(ForLet, _5)"><span class="annotation">@0,1,2,3⦊</span>is_true</span></span>
<span class="line"><span class="code even" style="--layer: 1" title="10:9-10:25: @0.Call: _4 = args() -&gt; [return: bb1, unwind: bb9]
10:9-10:25: @1[0]: _3 = &amp;_4
10:9-10:31: @1.Call: _2 = &lt;Args as ExactSizeIterator&gt;::len(move _3) -&gt; [return: bb2, unwind: bb8]
10:9-12:10: @2[1]: _1 = Eq(move _2, const 1_usize)
8:5-8:12: @2[3]: FakeRead(ForLet, _1)
18:9-18:10: @3[2]: _5 = const 0_i32
15:9-16:14: @3[3]: FakeRead(ForLet, _5)"> =</span></span>
<span class="line"><span class="code even" style="--layer: 1" title="10:9-10:25: @0.Call: _4 = args() -&gt; [return: bb1, unwind: bb9]
10:9-10:25: @1[0]: _3 = &amp;_4
10:9-10:31: @1.Call: _2 = &lt;Args as ExactSizeIterator&gt;::len(move _3) -&gt; [return: bb2, unwind: bb8]
10:9-12:10: @2[1]: _1 = Eq(move _2, const 1_usize)
8:5-8:12: @2[3]: FakeRead(ForLet, _1)
18:9-18:10: @3[2]: _5 = const 0_i32
15:9-16:14: @3[3]: FakeRead(ForLet, _5)"> std::env::args().len()</span></span>
<span class="line"><span class="code even" style="--layer: 1" title="10:9-10:25: @0.Call: _4 = args() -&gt; [return: bb1, unwind: bb9]
10:9-10:25: @1[0]: _3 = &amp;_4
10:9-10:31: @1.Call: _2 = &lt;Args as ExactSizeIterator&gt;::len(move _3) -&gt; [return: bb2, unwind: bb8]
10:9-12:10: @2[1]: _1 = Eq(move _2, const 1_usize)
8:5-8:12: @2[3]: FakeRead(ForLet, _1)
18:9-18:10: @3[2]: _5 = const 0_i32
15:9-16:14: @3[3]: FakeRead(ForLet, _5)"> ==</span></span>
<span class="line"><span class="code even" style="--layer: 1" title="10:9-10:25: @0.Call: _4 = args() -&gt; [return: bb1, unwind: bb9]
10:9-10:25: @1[0]: _3 = &amp;_4
10:9-10:31: @1.Call: _2 = &lt;Args as ExactSizeIterator&gt;::len(move _3) -&gt; [return: bb2, unwind: bb8]
10:9-12:10: @2[1]: _1 = Eq(move _2, const 1_usize)
8:5-8:12: @2[3]: FakeRead(ForLet, _1)
18:9-18:10: @3[2]: _5 = const 0_i32
15:9-16:14: @3[3]: FakeRead(ForLet, _5)"> 1</span></span>
<span class="line"><span class="code even" style="--layer: 1" title="10:9-10:25: @0.Call: _4 = args() -&gt; [return: bb1, unwind: bb9]
10:9-10:25: @1[0]: _3 = &amp;_4
10:9-10:31: @1.Call: _2 = &lt;Args as ExactSizeIterator&gt;::len(move _3) -&gt; [return: bb2, unwind: bb8]
10:9-12:10: @2[1]: _1 = Eq(move _2, const 1_usize)
8:5-8:12: @2[3]: FakeRead(ForLet, _1)
18:9-18:10: @3[2]: _5 = const 0_i32
15:9-16:14: @3[3]: FakeRead(ForLet, _5)"> ;</span></span>
<span class="line"><span class="code even" style="--layer: 1" title="10:9-10:25: @0.Call: _4 = args() -&gt; [return: bb1, unwind: bb9]
10:9-10:25: @1[0]: _3 = &amp;_4
10:9-10:31: @1.Call: _2 = &lt;Args as ExactSizeIterator&gt;::len(move _3) -&gt; [return: bb2, unwind: bb8]
10:9-12:10: @2[1]: _1 = Eq(move _2, const 1_usize)
8:5-8:12: @2[3]: FakeRead(ForLet, _1)
18:9-18:10: @3[2]: _5 = const 0_i32
15:9-16:14: @3[3]: FakeRead(ForLet, _5)"> let</span></span>
<span class="line"><span class="code even" style="--layer: 1" title="10:9-10:25: @0.Call: _4 = args() -&gt; [return: bb1, unwind: bb9]
10:9-10:25: @1[0]: _3 = &amp;_4
10:9-10:31: @1.Call: _2 = &lt;Args as ExactSizeIterator&gt;::len(move _3) -&gt; [return: bb2, unwind: bb8]
10:9-12:10: @2[1]: _1 = Eq(move _2, const 1_usize)
8:5-8:12: @2[3]: FakeRead(ForLet, _1)
18:9-18:10: @3[2]: _5 = const 0_i32
15:9-16:14: @3[3]: FakeRead(ForLet, _5)"> mut</span></span>
<span class="line"><span class="code even" style="--layer: 1" title="10:9-10:25: @0.Call: _4 = args() -&gt; [return: bb1, unwind: bb9]
10:9-10:25: @1[0]: _3 = &amp;_4
10:9-10:31: @1.Call: _2 = &lt;Args as ExactSizeIterator&gt;::len(move _3) -&gt; [return: bb2, unwind: bb8]
10:9-12:10: @2[1]: _1 = Eq(move _2, const 1_usize)
8:5-8:12: @2[3]: FakeRead(ForLet, _1)
18:9-18:10: @3[2]: _5 = const 0_i32
15:9-16:14: @3[3]: FakeRead(ForLet, _5)"> countdown</span></span>
<span class="line"><span class="code even" style="--layer: 1" title="10:9-10:25: @0.Call: _4 = args() -&gt; [return: bb1, unwind: bb9]
10:9-10:25: @1[0]: _3 = &amp;_4
10:9-10:31: @1.Call: _2 = &lt;Args as ExactSizeIterator&gt;::len(move _3) -&gt; [return: bb2, unwind: bb8]
10:9-12:10: @2[1]: _1 = Eq(move _2, const 1_usize)
8:5-8:12: @2[3]: FakeRead(ForLet, _1)
18:9-18:10: @3[2]: _5 = const 0_i32
15:9-16:14: @3[3]: FakeRead(ForLet, _5)"> =</span></span>
<span class="line"><span class="code even" style="--layer: 1" title="10:9-10:25: @0.Call: _4 = args() -&gt; [return: bb1, unwind: bb9]
10:9-10:25: @1[0]: _3 = &amp;_4
10:9-10:31: @1.Call: _2 = &lt;Args as ExactSizeIterator&gt;::len(move _3) -&gt; [return: bb2, unwind: bb8]
10:9-12:10: @2[1]: _1 = Eq(move _2, const 1_usize)
8:5-8:12: @2[3]: FakeRead(ForLet, _1)
18:9-18:10: @3[2]: _5 = const 0_i32
15:9-16:14: @3[3]: FakeRead(ForLet, _5)"> 0<span class="annotation">⦉@0,1,2,3</span></span></span><span class="code" style="--layer: 0"></span></span>
<span class="line"><span class="code" style="--layer: 0"> ;</span></span>
<span class="line"><span class="code" style="--layer: 0"> if</span></span>
<span class="line"><span class="code" style="--layer: 0"> </span><span><span class="code even" style="--layer: 1" title="21:9-21:16: @3[5]: _6 = _1
21:9-21:16: @3[6]: FakeRead(ForMatchedPlace, _6)"><span class="annotation">@0,1,2,3⦊</span>is_true<span class="annotation">⦉@0,1,2,3</span></span></span><span class="code" style="--layer: 0"></span></span>
<span class="line"><span class="code" style="--layer: 0"> </span><span><span class="code odd" style="--layer: 1" title="23:9-25:15: @6[0]: _5 = const 10_i32
22:5-27:6: @6[1]: _0 = const ()"><span class="annotation">@4,6⦊</span>{</span></span>
<span class="line"><span class="code odd" style="--layer: 1" title="23:9-25:15: @6[0]: _5 = const 10_i32
22:5-27:6: @6[1]: _0 = const ()"> countdown</span></span>
<span class="line"><span class="code odd" style="--layer: 1" title="23:9-25:15: @6[0]: _5 = const 10_i32
22:5-27:6: @6[1]: _0 = const ()"> =</span></span>
<span class="line"><span class="code odd" style="--layer: 1" title="23:9-25:15: @6[0]: _5 = const 10_i32
22:5-27:6: @6[1]: _0 = const ()"> 10</span></span>
<span class="line"><span class="code odd" style="--layer: 1" title="23:9-25:15: @6[0]: _5 = const 10_i32
22:5-27:6: @6[1]: _0 = const ()"> ;</span></span>
<span class="line"><span class="code odd" style="--layer: 1" title="23:9-25:15: @6[0]: _5 = const 10_i32
22:5-27:6: @6[1]: _0 = const ()"> }<span class="annotation">⦉@4,6</span></span></span><span class="code" style="--layer: 0"></span></span>
<span class="line"><span class="code" style="--layer: 0">}</span><span><span class="code even" style="--layer: 1" title="28:2-28:2: @7.Return: return"><span class="annotation">@7⦊</span><span class="annotation">⦉@7</span></span></span></span></div>
</body>
</html>

View file

@ -0,0 +1,163 @@
<!DOCTYPE html>
<html>
<head>
<title>if_else.main - Coverage Spans</title>
<style>
.line {
counter-increment: line;
}
.line:before {
content: counter(line) ": ";
font-family: Menlo, Monaco, monospace;
font-style: italic;
width: 3.8em;
display: inline-block;
text-align: right;
filter: opacity(50%);
-webkit-user-select: none;
}
.code {
color: #dddddd;
background-color: #222222;
font-family: Menlo, Monaco, monospace;
line-height: 1.4em;
border-bottom: 2px solid #222222;
white-space: pre;
display: inline-block;
}
.odd {
background-color: #55bbff;
color: #223311;
}
.even {
background-color: #ee7756;
color: #551133;
}
.code {
--index: calc(var(--layer) - 1);
padding-top: calc(var(--index) * 0.15em);
filter:
hue-rotate(calc(var(--index) * 25deg))
saturate(calc(100% - (var(--index) * 2%)))
brightness(calc(100% - (var(--index) * 1.5%)));
}
.annotation {
color: #4444ff;
font-family: monospace;
font-style: italic;
display: none;
-webkit-user-select: none;
}
body:active .annotation {
/* requires holding mouse down anywhere on the page */
display: inline-block;
}
span:hover .annotation {
/* requires hover over a span ONLY on its first line */
display: inline-block;
}
</style>
</head>
<body>
<div class="code" style="counter-reset: line 2"><span class="line"><span class="code" style="--layer: 0">fn main() {</span></span>
<span class="line"><span class="code" style="--layer: 0"> // Initialize test constants in a way that cannot be determined at compile time, to ensure</span></span>
<span class="line"><span class="code" style="--layer: 0"> // rustc and LLVM cannot optimize out statements (or coverage counters) downstream from</span></span>
<span class="line"><span class="code" style="--layer: 0"> // dependent conditions.</span></span>
<span class="line"><span class="code" style="--layer: 0"> let </span><span><span class="code even" style="--layer: 1" title="7:19-7:35: @0.Call: _4 = args() -&gt; [return: bb1, unwind: bb13]
7:19-7:35: @1[0]: _3 = &amp;_4
7:19-7:41: @1.Call: _2 = &lt;Args as ExactSizeIterator&gt;::len(move _3) -&gt; [return: bb2, unwind: bb12]
7:19-7:46: @2[1]: _1 = Eq(move _2, const 1_usize)
7:9-7:16: @2[3]: FakeRead(ForLet, _1)
9:25-9:26: @3[2]: _5 = const 0_i32
9:9-9:22: @3[3]: FakeRead(ForLet, _5)
11:9-11:16: @3[6]: _7 = _1
11:9-11:16: @3[7]: FakeRead(ForMatchedPlace, _7)"><span class="annotation">@0,1,2,3⦊</span>is_true = std::env::args().len() == 1;</span></span>
<span class="line"><span class="code even" style="--layer: 1" title="7:19-7:35: @0.Call: _4 = args() -&gt; [return: bb1, unwind: bb13]
7:19-7:35: @1[0]: _3 = &amp;_4
7:19-7:41: @1.Call: _2 = &lt;Args as ExactSizeIterator&gt;::len(move _3) -&gt; [return: bb2, unwind: bb12]
7:19-7:46: @2[1]: _1 = Eq(move _2, const 1_usize)
7:9-7:16: @2[3]: FakeRead(ForLet, _1)
9:25-9:26: @3[2]: _5 = const 0_i32
9:9-9:22: @3[3]: FakeRead(ForLet, _5)
11:9-11:16: @3[6]: _7 = _1
11:9-11:16: @3[7]: FakeRead(ForMatchedPlace, _7)"></span></span>
<span class="line"><span class="code even" style="--layer: 1" title="7:19-7:35: @0.Call: _4 = args() -&gt; [return: bb1, unwind: bb13]
7:19-7:35: @1[0]: _3 = &amp;_4
7:19-7:41: @1.Call: _2 = &lt;Args as ExactSizeIterator&gt;::len(move _3) -&gt; [return: bb2, unwind: bb12]
7:19-7:46: @2[1]: _1 = Eq(move _2, const 1_usize)
7:9-7:16: @2[3]: FakeRead(ForLet, _1)
9:25-9:26: @3[2]: _5 = const 0_i32
9:9-9:22: @3[3]: FakeRead(ForLet, _5)
11:9-11:16: @3[6]: _7 = _1
11:9-11:16: @3[7]: FakeRead(ForMatchedPlace, _7)"> let mut countdown = 0;</span></span>
<span class="line"><span class="code even" style="--layer: 1" title="7:19-7:35: @0.Call: _4 = args() -&gt; [return: bb1, unwind: bb13]
7:19-7:35: @1[0]: _3 = &amp;_4
7:19-7:41: @1.Call: _2 = &lt;Args as ExactSizeIterator&gt;::len(move _3) -&gt; [return: bb2, unwind: bb12]
7:19-7:46: @2[1]: _1 = Eq(move _2, const 1_usize)
7:9-7:16: @2[3]: FakeRead(ForLet, _1)
9:25-9:26: @3[2]: _5 = const 0_i32
9:9-9:22: @3[3]: FakeRead(ForLet, _5)
11:9-11:16: @3[6]: _7 = _1
11:9-11:16: @3[7]: FakeRead(ForMatchedPlace, _7)"> if</span></span>
<span class="line"><span class="code even" style="--layer: 1" title="7:19-7:35: @0.Call: _4 = args() -&gt; [return: bb1, unwind: bb13]
7:19-7:35: @1[0]: _3 = &amp;_4
7:19-7:41: @1.Call: _2 = &lt;Args as ExactSizeIterator&gt;::len(move _3) -&gt; [return: bb2, unwind: bb12]
7:19-7:46: @2[1]: _1 = Eq(move _2, const 1_usize)
7:9-7:16: @2[3]: FakeRead(ForLet, _1)
9:25-9:26: @3[2]: _5 = const 0_i32
9:9-9:22: @3[3]: FakeRead(ForLet, _5)
11:9-11:16: @3[6]: _7 = _1
11:9-11:16: @3[7]: FakeRead(ForMatchedPlace, _7)"> is_true<span class="annotation">⦉@0,1,2,3</span></span></span><span class="code" style="--layer: 0"></span></span>
<span class="line"><span class="code" style="--layer: 0"> </span><span><span class="code odd" style="--layer: 1" title="13:9-15:15: @6[0]: _5 = const 10_i32
12:5-17:6: @6[1]: _6 = const ()"><span class="annotation">@4,6⦊</span>{</span></span>
<span class="line"><span class="code odd" style="--layer: 1" title="13:9-15:15: @6[0]: _5 = const 10_i32
12:5-17:6: @6[1]: _6 = const ()"> countdown</span></span>
<span class="line"><span class="code odd" style="--layer: 1" title="13:9-15:15: @6[0]: _5 = const 10_i32
12:5-17:6: @6[1]: _6 = const ()"> =</span></span>
<span class="line"><span class="code odd" style="--layer: 1" title="13:9-15:15: @6[0]: _5 = const 10_i32
12:5-17:6: @6[1]: _6 = const ()"> 10</span></span>
<span class="line"><span class="code odd" style="--layer: 1" title="13:9-15:15: @6[0]: _5 = const 10_i32
12:5-17:6: @6[1]: _6 = const ()"> ;</span></span>
<span class="line"><span class="code odd" style="--layer: 1" title="13:9-15:15: @6[0]: _5 = const 10_i32
12:5-17:6: @6[1]: _6 = const ()"> }<span class="annotation">⦉@4,6</span></span></span><span class="code" style="--layer: 0"></span></span>
<span class="line"><span class="code" style="--layer: 0"> else // Note coverage region difference without semicolon</span></span>
<span class="line"><span class="code" style="--layer: 0"> {</span></span>
<span class="line"><span class="code" style="--layer: 0"> </span><span><span class="code even" style="--layer: 1" title="20:9-22:16: @5[0]: _5 = const 100_i32
20:9-22:16: @5[1]: _6 = const ()"><span class="annotation">@5⦊</span>countdown</span></span>
<span class="line"><span class="code even" style="--layer: 1" title="20:9-22:16: @5[0]: _5 = const 100_i32
20:9-22:16: @5[1]: _6 = const ()"> =</span></span>
<span class="line"><span class="code even" style="--layer: 1" title="20:9-22:16: @5[0]: _5 = const 100_i32
20:9-22:16: @5[1]: _6 = const ()"> 100<span class="annotation">⦉@5</span></span></span><span class="code" style="--layer: 0"></span></span>
<span class="line"><span class="code" style="--layer: 0"> }</span></span>
<span class="line"><span class="code" style="--layer: 0"></span></span>
<span class="line"><span class="code" style="--layer: 0"> if</span></span>
<span class="line"><span class="code" style="--layer: 0"> </span><span><span class="code odd" style="--layer: 1" title="26:9-26:16: @7[3]: _8 = _1
26:9-26:16: @7[4]: FakeRead(ForMatchedPlace, _8)"><span class="annotation">@7⦊</span>is_true<span class="annotation">⦉@7</span></span></span><span class="code" style="--layer: 0"></span></span>
<span class="line"><span class="code" style="--layer: 0"> </span><span><span class="code even" style="--layer: 1" title="28:9-30:15: @10[0]: _5 = const 10_i32
27:5-32:6: @10[1]: _0 = const ()"><span class="annotation">@8,10⦊</span>{</span></span>
<span class="line"><span class="code even" style="--layer: 1" title="28:9-30:15: @10[0]: _5 = const 10_i32
27:5-32:6: @10[1]: _0 = const ()"> countdown</span></span>
<span class="line"><span class="code even" style="--layer: 1" title="28:9-30:15: @10[0]: _5 = const 10_i32
27:5-32:6: @10[1]: _0 = const ()"> =</span></span>
<span class="line"><span class="code even" style="--layer: 1" title="28:9-30:15: @10[0]: _5 = const 10_i32
27:5-32:6: @10[1]: _0 = const ()"> 10</span></span>
<span class="line"><span class="code even" style="--layer: 1" title="28:9-30:15: @10[0]: _5 = const 10_i32
27:5-32:6: @10[1]: _0 = const ()"> ;</span></span>
<span class="line"><span class="code even" style="--layer: 1" title="28:9-30:15: @10[0]: _5 = const 10_i32
27:5-32:6: @10[1]: _0 = const ()"> }<span class="annotation">⦉@8,10</span></span></span><span class="code" style="--layer: 0"></span></span>
<span class="line"><span class="code" style="--layer: 0"> else</span></span>
<span class="line"><span class="code" style="--layer: 0"> </span><span><span class="code odd" style="--layer: 1" title="35:9-37:16: @9[0]: _5 = const 100_i32
34:5-39:6: @9[1]: _0 = const ()"><span class="annotation">@9⦊</span>{</span></span>
<span class="line"><span class="code odd" style="--layer: 1" title="35:9-37:16: @9[0]: _5 = const 100_i32
34:5-39:6: @9[1]: _0 = const ()"> countdown</span></span>
<span class="line"><span class="code odd" style="--layer: 1" title="35:9-37:16: @9[0]: _5 = const 100_i32
34:5-39:6: @9[1]: _0 = const ()"> =</span></span>
<span class="line"><span class="code odd" style="--layer: 1" title="35:9-37:16: @9[0]: _5 = const 100_i32
34:5-39:6: @9[1]: _0 = const ()"> 100</span></span>
<span class="line"><span class="code odd" style="--layer: 1" title="35:9-37:16: @9[0]: _5 = const 100_i32
34:5-39:6: @9[1]: _0 = const ()"> ;</span></span>
<span class="line"><span class="code odd" style="--layer: 1" title="35:9-37:16: @9[0]: _5 = const 100_i32
34:5-39:6: @9[1]: _0 = const ()"> }<span class="annotation">⦉@9</span></span></span><span class="code" style="--layer: 0"></span></span>
<span class="line"><span class="code" style="--layer: 0">}</span><span><span class="code even" style="--layer: 1" title="40:2-40:2: @11.Return: return"><span class="annotation">@11⦊</span><span class="annotation">⦉@11</span></span></span></span></div>
</body>
</html>

View file

@ -0,0 +1,83 @@
<!DOCTYPE html>
<html>
<head>
<title>inner_items.main-InTrait-default_trait_func - Coverage Spans</title>
<style>
.line {
counter-increment: line;
}
.line:before {
content: counter(line) ": ";
font-family: Menlo, Monaco, monospace;
font-style: italic;
width: 3.8em;
display: inline-block;
text-align: right;
filter: opacity(50%);
-webkit-user-select: none;
}
.code {
color: #dddddd;
background-color: #222222;
font-family: Menlo, Monaco, monospace;
line-height: 1.4em;
border-bottom: 2px solid #222222;
white-space: pre;
display: inline-block;
}
.odd {
background-color: #55bbff;
color: #223311;
}
.even {
background-color: #ee7756;
color: #551133;
}
.code {
--index: calc(var(--layer) - 1);
padding-top: calc(var(--index) * 0.15em);
filter:
hue-rotate(calc(var(--index) * 25deg))
saturate(calc(100% - (var(--index) * 2%)))
brightness(calc(100% - (var(--index) * 1.5%)));
}
.annotation {
color: #4444ff;
font-family: monospace;
font-style: italic;
display: none;
-webkit-user-select: none;
}
body:active .annotation {
/* requires holding mouse down anywhere on the page */
display: inline-block;
}
span:hover .annotation {
/* requires hover over a span ONLY on its first line */
display: inline-block;
}
</style>
</head>
<body>
<div class="code" style="counter-reset: line 32"><span class="line"> <span class="code" style="--layer: 0">fn default_trait_func(&amp;mut self) </span><span><span class="code even" style="--layer: 1" title="34:13-34:30: @0.Call: _2 = in_func(const IN_CONST) -&gt; [return: bb1, unwind: bb3]
35:13-35:17: @1[3]: _4 = &amp;mut (*_1)
35:13-35:38: @1.Call: _3 = &lt;Self as InTrait&gt;::trait_func(move _4, const IN_CONST) -&gt; [return: bb2, unwind: bb3]
33:42-36:10: @2[2]: _0 = const ()
36:10-36:10: @2.Return: return"><span class="annotation">@0,1,2⦊</span>{</span></span>
<span class="line"><span class="code even" style="--layer: 1" title="34:13-34:30: @0.Call: _2 = in_func(const IN_CONST) -&gt; [return: bb1, unwind: bb3]
35:13-35:17: @1[3]: _4 = &amp;mut (*_1)
35:13-35:38: @1.Call: _3 = &lt;Self as InTrait&gt;::trait_func(move _4, const IN_CONST) -&gt; [return: bb2, unwind: bb3]
33:42-36:10: @2[2]: _0 = const ()
36:10-36:10: @2.Return: return"> in_func(IN_CONST);</span></span>
<span class="line"><span class="code even" style="--layer: 1" title="34:13-34:30: @0.Call: _2 = in_func(const IN_CONST) -&gt; [return: bb1, unwind: bb3]
35:13-35:17: @1[3]: _4 = &amp;mut (*_1)
35:13-35:38: @1.Call: _3 = &lt;Self as InTrait&gt;::trait_func(move _4, const IN_CONST) -&gt; [return: bb2, unwind: bb3]
33:42-36:10: @2[2]: _0 = const ()
36:10-36:10: @2.Return: return"> self.trait_func(IN_CONST);</span></span>
<span class="line"><span class="code even" style="--layer: 1" title="34:13-34:30: @0.Call: _2 = in_func(const IN_CONST) -&gt; [return: bb1, unwind: bb3]
35:13-35:17: @1[3]: _4 = &amp;mut (*_1)
35:13-35:38: @1.Call: _3 = &lt;Self as InTrait&gt;::trait_func(move _4, const IN_CONST) -&gt; [return: bb2, unwind: bb3]
33:42-36:10: @2[2]: _0 = const ()
36:10-36:10: @2.Return: return"> }<span class="annotation">⦉@0,1,2</span></span></span></span></div>
</body>
</html>

View file

@ -0,0 +1,107 @@
<!DOCTYPE html>
<html>
<head>
<title>inner_items.main-in_func - Coverage Spans</title>
<style>
.line {
counter-increment: line;
}
.line:before {
content: counter(line) ": ";
font-family: Menlo, Monaco, monospace;
font-style: italic;
width: 3.8em;
display: inline-block;
text-align: right;
filter: opacity(50%);
-webkit-user-select: none;
}
.code {
color: #dddddd;
background-color: #222222;
font-family: Menlo, Monaco, monospace;
line-height: 1.4em;
border-bottom: 2px solid #222222;
white-space: pre;
display: inline-block;
}
.odd {
background-color: #55bbff;
color: #223311;
}
.even {
background-color: #ee7756;
color: #551133;
}
.code {
--index: calc(var(--layer) - 1);
padding-top: calc(var(--index) * 0.15em);
filter:
hue-rotate(calc(var(--index) * 25deg))
saturate(calc(100% - (var(--index) * 2%)))
brightness(calc(100% - (var(--index) * 1.5%)));
}
.annotation {
color: #4444ff;
font-family: monospace;
font-style: italic;
display: none;
-webkit-user-select: none;
}
body:active .annotation {
/* requires holding mouse down anywhere on the page */
display: inline-block;
}
span:hover .annotation {
/* requires hover over a span ONLY on its first line */
display: inline-block;
}
</style>
</head>
<body>
<div class="code" style="counter-reset: line 17"><span class="line"> <span class="code" style="--layer: 0">fn in_func(a: u32) {</span></span>
<span class="line"><span class="code" style="--layer: 0"> let </span><span><span class="code even" style="--layer: 1" title="19:17-19:18: @0[1]: _2 = const 1_u32
19:13-19:14: @0[2]: FakeRead(ForLet, _2)"><span class="annotation">@0⦊</span>b = 1<span class="annotation">⦉@0</span></span></span><span class="code" style="--layer: 0">;</span></span>
<span class="line"><span class="code" style="--layer: 0"> let </span><span><span class="code odd" style="--layer: 1" title="20:13-20:14: @1[3]: FakeRead(ForLet, _3)"><span class="annotation">@1,2,3,4⦊</span>c<span class="annotation">⦉@1,2,3,4</span></span></span><span class="code" style="--layer: 0"> = </span><span><span class="code even" style="--layer: 1" title="20:17-20:18: @0[5]: _4 = _1
20:21-20:22: @0[7]: _5 = _2
20:17-20:22: @0[8]: _6 = CheckedAdd(_4, _5)"><span class="annotation">@0⦊</span>a + b<span class="annotation">⦉@0</span></span></span><span class="code" style="--layer: 0">;</span></span>
<span class="line"><span class="code" style="--layer: 0"> </span><span><span class="code odd" style="--layer: 1" title="21:18-21:26: @1[9]: _23 = const in_func::promoted[0]
21:18-21:26: @1[10]: _11 = &amp;(*_23)
21:18-21:26: @1[11]: _10 = &amp;(*_11)
21:18-21:26: @1[12]: _9 = move _10 as &amp;[&amp;str] (Pointer(Unsize))
21:28-21:29: @1[20]: _18 = &amp;_3
21:9-21:30: @1[21]: _17 = (move _18,)
21:9-21:30: @1[23]: FakeRead(ForMatchedPlace, _17)
21:9-21:30: @1[25]: _19 = (_17.0: &amp;u32)
21:9-21:30: @1[28]: _21 = &amp;(*_19)
21:9-21:30: @1[30]: _22 = &lt;u32 as std::fmt::Display&gt;::fmt as for&lt;&#39;r, &#39;s, &#39;t0&gt; fn(&amp;&#39;r u32, &amp;&#39;s mut std::fmt::Formatter&lt;&#39;t0&gt;) -&gt; std::result::Result&lt;(), std::fmt::Error&gt; (Pointer(ReifyFnPointer))
21:9-21:30: @1.Call: _20 = ArgumentV1::new::&lt;u32&gt;(move _21, move _22) -&gt; [return: bb2, unwind: bb5]
21:9-21:30: @2[2]: _16 = [move _20]
21:9-21:30: @2[5]: _15 = &amp;_16
21:9-21:30: @2[6]: _14 = &amp;(*_15)
21:9-21:30: @2[7]: _13 = move _14 as &amp;[std::fmt::ArgumentV1] (Pointer(Unsize))
21:9-21:30: @2.Call: _8 = Arguments::new_v1(move _9, move _13) -&gt; [return: bb3, unwind: bb5]
21:9-21:30: @3.Call: _7 = _print(move _8) -&gt; [return: bb4, unwind: bb5]
21:9-21:30: @4[6]: _0 = const ()
22:6-22:6: @4.Return: return"><span class="annotation">@1,2,3,4⦊</span>println!("c = {}", c)</span></span>
<span class="line"><span class="code odd" style="--layer: 1" title="21:18-21:26: @1[9]: _23 = const in_func::promoted[0]
21:18-21:26: @1[10]: _11 = &amp;(*_23)
21:18-21:26: @1[11]: _10 = &amp;(*_11)
21:18-21:26: @1[12]: _9 = move _10 as &amp;[&amp;str] (Pointer(Unsize))
21:28-21:29: @1[20]: _18 = &amp;_3
21:9-21:30: @1[21]: _17 = (move _18,)
21:9-21:30: @1[23]: FakeRead(ForMatchedPlace, _17)
21:9-21:30: @1[25]: _19 = (_17.0: &amp;u32)
21:9-21:30: @1[28]: _21 = &amp;(*_19)
21:9-21:30: @1[30]: _22 = &lt;u32 as std::fmt::Display&gt;::fmt as for&lt;&#39;r, &#39;s, &#39;t0&gt; fn(&amp;&#39;r u32, &amp;&#39;s mut std::fmt::Formatter&lt;&#39;t0&gt;) -&gt; std::result::Result&lt;(), std::fmt::Error&gt; (Pointer(ReifyFnPointer))
21:9-21:30: @1.Call: _20 = ArgumentV1::new::&lt;u32&gt;(move _21, move _22) -&gt; [return: bb2, unwind: bb5]
21:9-21:30: @2[2]: _16 = [move _20]
21:9-21:30: @2[5]: _15 = &amp;_16
21:9-21:30: @2[6]: _14 = &amp;(*_15)
21:9-21:30: @2[7]: _13 = move _14 as &amp;[std::fmt::ArgumentV1] (Pointer(Unsize))
21:9-21:30: @2.Call: _8 = Arguments::new_v1(move _9, move _13) -&gt; [return: bb3, unwind: bb5]
21:9-21:30: @3.Call: _7 = _print(move _8) -&gt; [return: bb4, unwind: bb5]
21:9-21:30: @4[6]: _0 = const ()
22:6-22:6: @4.Return: return"> }<span class="annotation">⦉@1,2,3,4</span></span></span></span></div>
</body>
</html>

View file

@ -1,8 +1,8 @@
<!DOCTYPE html>
<html>
<head>
<title>coverage_of_if_else - Code Regions</title>
<style>
<title>inner_items.main-{impl#0}-trait_func - Coverage Spans</title>
<style>
.line {
counter-increment: line;
}
@ -56,10 +56,17 @@
/* requires hover over a span ONLY on its first line */
display: inline-block;
}
</style>
</style>
</head>
<body>
<div class="code" style="counter-reset: line 4"><span class="line"><span class="code" style="--layer: 0">fn main() {}</span><span><span class="code even" style="--layer: 1" title="0:Return: $DIR/spanview-terminator.rs:5:13: 5:13:
5:13-5:13: Return: return"><span class="annotation">0:Return⦊</span><span class="annotation">⦉0:Return</span></span></span></span></div>
<div class="code" style="counter-reset: line 39"><span class="line"> <span class="code" style="--layer: 0">fn trait_func(&amp;mut self, incr: u32) {</span></span>
<span class="line"><span class="code" style="--layer: 0"> </span><span><span class="code even" style="--layer: 1" title="41:37-41:41: @0[1]: _3 = _2
41:13-41:41: @0[2]: _4 = CheckedAdd(((*_1).0: u32), _3)"><span class="annotation">@0⦊</span>self.in_struct_field += incr<span class="annotation">⦉@0</span></span></span><span class="code" style="--layer: 0">;</span></span>
<span class="line"><span class="code" style="--layer: 0"> </span><span><span class="code odd" style="--layer: 1" title="42:21-42:41: @1[4]: _6 = ((*_1).0: u32)
42:13-42:42: @1.Call: _5 = in_func(move _6) -&gt; [return: bb2, unwind: bb3]
43:10-43:10: @2.Return: return"><span class="annotation">@1,2⦊</span>in_func(self.in_struct_field);</span></span>
<span class="line"><span class="code odd" style="--layer: 1" title="42:21-42:41: @1[4]: _6 = ((*_1).0: u32)
42:13-42:42: @1.Call: _5 = in_func(move _6) -&gt; [return: bb2, unwind: bb3]
43:10-43:10: @2.Return: return"> }<span class="annotation">⦉@1,2</span></span></span></span></div>
</body>
</html>

View file

@ -0,0 +1,171 @@
<!DOCTYPE html>
<html>
<head>
<title>inner_items.main - Coverage Spans</title>
<style>
.line {
counter-increment: line;
}
.line:before {
content: counter(line) ": ";
font-family: Menlo, Monaco, monospace;
font-style: italic;
width: 3.8em;
display: inline-block;
text-align: right;
filter: opacity(50%);
-webkit-user-select: none;
}
.code {
color: #dddddd;
background-color: #222222;
font-family: Menlo, Monaco, monospace;
line-height: 1.4em;
border-bottom: 2px solid #222222;
white-space: pre;
display: inline-block;
}
.odd {
background-color: #55bbff;
color: #223311;
}
.even {
background-color: #ee7756;
color: #551133;
}
.code {
--index: calc(var(--layer) - 1);
padding-top: calc(var(--index) * 0.15em);
filter:
hue-rotate(calc(var(--index) * 25deg))
saturate(calc(100% - (var(--index) * 2%)))
brightness(calc(100% - (var(--index) * 1.5%)));
}
.annotation {
color: #4444ff;
font-family: monospace;
font-style: italic;
display: none;
-webkit-user-select: none;
}
body:active .annotation {
/* requires holding mouse down anywhere on the page */
display: inline-block;
}
span:hover .annotation {
/* requires hover over a span ONLY on its first line */
display: inline-block;
}
</style>
</head>
<body>
<div class="code" style="counter-reset: line 2"><span class="line"><span class="code" style="--layer: 0">fn main() {</span></span>
<span class="line"><span class="code" style="--layer: 0"> // Initialize test constants in a way that cannot be determined at compile time, to ensure</span></span>
<span class="line"><span class="code" style="--layer: 0"> // rustc and LLVM cannot optimize out statements (or coverage counters) downstream from</span></span>
<span class="line"><span class="code" style="--layer: 0"> // dependent conditions.</span></span>
<span class="line"><span class="code" style="--layer: 0"> let </span><span><span class="code even" style="--layer: 1" title="7:19-7:35: @0.Call: _4 = args() -&gt; [return: bb1, unwind: bb15]
7:19-7:35: @1[0]: _3 = &amp;_4
7:19-7:41: @1.Call: _2 = &lt;Args as ExactSizeIterator&gt;::len(move _3) -&gt; [return: bb2, unwind: bb14]
7:19-7:46: @2[1]: _1 = Eq(move _2, const 1_usize)
7:9-7:16: @2[3]: FakeRead(ForLet, _1)
9:25-9:26: @3[2]: _5 = const 0_u32
9:9-9:22: @3[3]: FakeRead(ForLet, _5)"><span class="annotation">@0,1,2,3⦊</span>is_true = std::env::args().len() == 1;</span></span>
<span class="line"><span class="code even" style="--layer: 1" title="7:19-7:35: @0.Call: _4 = args() -&gt; [return: bb1, unwind: bb15]
7:19-7:35: @1[0]: _3 = &amp;_4
7:19-7:41: @1.Call: _2 = &lt;Args as ExactSizeIterator&gt;::len(move _3) -&gt; [return: bb2, unwind: bb14]
7:19-7:46: @2[1]: _1 = Eq(move _2, const 1_usize)
7:9-7:16: @2[3]: FakeRead(ForLet, _1)
9:25-9:26: @3[2]: _5 = const 0_u32
9:9-9:22: @3[3]: FakeRead(ForLet, _5)"></span></span>
<span class="line"><span class="code even" style="--layer: 1" title="7:19-7:35: @0.Call: _4 = args() -&gt; [return: bb1, unwind: bb15]
7:19-7:35: @1[0]: _3 = &amp;_4
7:19-7:41: @1.Call: _2 = &lt;Args as ExactSizeIterator&gt;::len(move _3) -&gt; [return: bb2, unwind: bb14]
7:19-7:46: @2[1]: _1 = Eq(move _2, const 1_usize)
7:9-7:16: @2[3]: FakeRead(ForLet, _1)
9:25-9:26: @3[2]: _5 = const 0_u32
9:9-9:22: @3[3]: FakeRead(ForLet, _5)"> let mut countdown = 0<span class="annotation">⦉@0,1,2,3</span></span></span><span class="code" style="--layer: 0">;</span></span>
<span class="line"><span class="code" style="--layer: 0"> if </span><span><span class="code even" style="--layer: 1" title="10:8-10:15: @3[6]: _7 = _1
10:8-10:15: @3[7]: FakeRead(ForMatchedPlace, _7)"><span class="annotation">@0,1,2,3⦊</span>is_true<span class="annotation">⦉@0,1,2,3</span></span></span><span class="code" style="--layer: 0"> </span><span><span class="code odd" style="--layer: 1" title="11:9-11:23: @6[0]: _5 = const 10_u32
10:16-12:6: @6[1]: _6 = const ()"><span class="annotation">@4,6⦊</span>{</span></span>
<span class="line"><span class="code odd" style="--layer: 1" title="11:9-11:23: @6[0]: _5 = const 10_u32
10:16-12:6: @6[1]: _6 = const ()"> countdown = 10;</span></span>
<span class="line"><span class="code odd" style="--layer: 1" title="11:9-11:23: @6[0]: _5 = const 10_u32
10:16-12:6: @6[1]: _6 = const ()"> }<span class="annotation">⦉@4,6</span></span></span><span class="code" style="--layer: 0"></span></span>
<span class="line"><span class="code" style="--layer: 0"></span></span>
<span class="line"><span class="code" style="--layer: 0"> mod in_mod {</span></span>
<span class="line"><span class="code" style="--layer: 0"> const IN_MOD_CONST: u32 = 1000;</span></span>
<span class="line"><span class="code" style="--layer: 0"> }</span></span>
<span class="line"><span class="code" style="--layer: 0"></span></span>
<span class="line"><span class="code" style="--layer: 0"> fn in_func(a: u32) {</span></span>
<span class="line"><span class="code" style="--layer: 0"> let b = 1;</span></span>
<span class="line"><span class="code" style="--layer: 0"> let c = a + b;</span></span>
<span class="line"><span class="code" style="--layer: 0"> println!("c = {}", c)</span></span>
<span class="line"><span class="code" style="--layer: 0"> }</span></span>
<span class="line"><span class="code" style="--layer: 0"></span></span>
<span class="line"><span class="code" style="--layer: 0"> struct InStruct {</span></span>
<span class="line"><span class="code" style="--layer: 0"> in_struct_field: u32,</span></span>
<span class="line"><span class="code" style="--layer: 0"> }</span></span>
<span class="line"><span class="code" style="--layer: 0"></span></span>
<span class="line"><span class="code" style="--layer: 0"> const IN_CONST: u32 = 1234;</span></span>
<span class="line"><span class="code" style="--layer: 0"></span></span>
<span class="line"><span class="code" style="--layer: 0"> trait InTrait {</span></span>
<span class="line"><span class="code" style="--layer: 0"> fn trait_func(&amp;mut self, incr: u32);</span></span>
<span class="line"><span class="code" style="--layer: 0"></span></span>
<span class="line"><span class="code" style="--layer: 0"> fn default_trait_func(&amp;mut self) {</span></span>
<span class="line"><span class="code" style="--layer: 0"> in_func(IN_CONST);</span></span>
<span class="line"><span class="code" style="--layer: 0"> self.trait_func(IN_CONST);</span></span>
<span class="line"><span class="code" style="--layer: 0"> }</span></span>
<span class="line"><span class="code" style="--layer: 0"> }</span></span>
<span class="line"><span class="code" style="--layer: 0"></span></span>
<span class="line"><span class="code" style="--layer: 0"> impl InTrait for InStruct {</span></span>
<span class="line"><span class="code" style="--layer: 0"> fn trait_func(&amp;mut self, incr: u32) {</span></span>
<span class="line"><span class="code" style="--layer: 0"> self.in_struct_field += incr;</span></span>
<span class="line"><span class="code" style="--layer: 0"> in_func(self.in_struct_field);</span></span>
<span class="line"><span class="code" style="--layer: 0"> }</span></span>
<span class="line"><span class="code" style="--layer: 0"> }</span></span>
<span class="line"><span class="code" style="--layer: 0"></span></span>
<span class="line"><span class="code" style="--layer: 0"> type InType = String;</span></span>
<span class="line"><span class="code" style="--layer: 0"></span></span>
<span class="line"><span class="code" style="--layer: 0"> if </span><span><span class="code even" style="--layer: 1" title="48:8-48:15: @7[4]: _9 = _1
48:8-48:15: @7[5]: FakeRead(ForMatchedPlace, _9)"><span class="annotation">@7⦊</span>is_true<span class="annotation">⦉@7</span></span></span><span class="code" style="--layer: 0"> </span><span><span class="code odd" style="--layer: 1" title="49:17-49:26: @10[2]: _11 = _5
49:9-49:27: @10.Call: _10 = in_func(move _11) -&gt; [return: bb11, unwind: bb15]
48:16-50:6: @11[2]: _8 = const ()"><span class="annotation">@8,10,11⦊</span>{</span></span>
<span class="line"><span class="code odd" style="--layer: 1" title="49:17-49:26: @10[2]: _11 = _5
49:9-49:27: @10.Call: _10 = in_func(move _11) -&gt; [return: bb11, unwind: bb15]
48:16-50:6: @11[2]: _8 = const ()"> in_func(countdown);</span></span>
<span class="line"><span class="code odd" style="--layer: 1" title="49:17-49:26: @10[2]: _11 = _5
49:9-49:27: @10.Call: _10 = in_func(move _11) -&gt; [return: bb11, unwind: bb15]
48:16-50:6: @11[2]: _8 = const ()"> }<span class="annotation">⦉@8,10,11</span></span></span><span class="code" style="--layer: 0"></span></span>
<span class="line"><span class="code" style="--layer: 0"></span></span>
<span class="line"><span class="code" style="--layer: 0"> let </span><span><span class="code even" style="--layer: 1" title="52:19-54:6: @12[3]: _12 = InStruct { in_struct_field: const 101_u32 }
52:9-52:16: @12[4]: FakeRead(ForLet, _12)
56:5-56:8: @12[7]: _14 = &amp;mut _12
56:5-56:29: @12.Call: _13 = &lt;InStruct as InTrait&gt;::default_trait_func(move _14) -&gt; [return: bb13, unwind: bb15]
57:2-57:2: @13.Return: return"><span class="annotation">@12,13⦊</span>mut val = InStruct {</span></span>
<span class="line"><span class="code even" style="--layer: 1" title="52:19-54:6: @12[3]: _12 = InStruct { in_struct_field: const 101_u32 }
52:9-52:16: @12[4]: FakeRead(ForLet, _12)
56:5-56:8: @12[7]: _14 = &amp;mut _12
56:5-56:29: @12.Call: _13 = &lt;InStruct as InTrait&gt;::default_trait_func(move _14) -&gt; [return: bb13, unwind: bb15]
57:2-57:2: @13.Return: return"> in_struct_field: 101,</span></span>
<span class="line"><span class="code even" style="--layer: 1" title="52:19-54:6: @12[3]: _12 = InStruct { in_struct_field: const 101_u32 }
52:9-52:16: @12[4]: FakeRead(ForLet, _12)
56:5-56:8: @12[7]: _14 = &amp;mut _12
56:5-56:29: @12.Call: _13 = &lt;InStruct as InTrait&gt;::default_trait_func(move _14) -&gt; [return: bb13, unwind: bb15]
57:2-57:2: @13.Return: return"> };</span></span>
<span class="line"><span class="code even" style="--layer: 1" title="52:19-54:6: @12[3]: _12 = InStruct { in_struct_field: const 101_u32 }
52:9-52:16: @12[4]: FakeRead(ForLet, _12)
56:5-56:8: @12[7]: _14 = &amp;mut _12
56:5-56:29: @12.Call: _13 = &lt;InStruct as InTrait&gt;::default_trait_func(move _14) -&gt; [return: bb13, unwind: bb15]
57:2-57:2: @13.Return: return"></span></span>
<span class="line"><span class="code even" style="--layer: 1" title="52:19-54:6: @12[3]: _12 = InStruct { in_struct_field: const 101_u32 }
52:9-52:16: @12[4]: FakeRead(ForLet, _12)
56:5-56:8: @12[7]: _14 = &amp;mut _12
56:5-56:29: @12.Call: _13 = &lt;InStruct as InTrait&gt;::default_trait_func(move _14) -&gt; [return: bb13, unwind: bb15]
57:2-57:2: @13.Return: return"> val.default_trait_func();</span></span>
<span class="line"><span class="code even" style="--layer: 1" title="52:19-54:6: @12[3]: _12 = InStruct { in_struct_field: const 101_u32 }
52:9-52:16: @12[4]: FakeRead(ForLet, _12)
56:5-56:8: @12[7]: _14 = &amp;mut _12
56:5-56:29: @12.Call: _13 = &lt;InStruct as InTrait&gt;::default_trait_func(move _14) -&gt; [return: bb13, unwind: bb15]
57:2-57:2: @13.Return: return">}<span class="annotation">⦉@12,13</span></span></span></span></div>
</body>
</html>

View file

@ -0,0 +1,160 @@
<!DOCTYPE html>
<html>
<head>
<title>lazy_boolean.main - Coverage Spans</title>
<style>
.line {
counter-increment: line;
}
.line:before {
content: counter(line) ": ";
font-family: Menlo, Monaco, monospace;
font-style: italic;
width: 3.8em;
display: inline-block;
text-align: right;
filter: opacity(50%);
-webkit-user-select: none;
}
.code {
color: #dddddd;
background-color: #222222;
font-family: Menlo, Monaco, monospace;
line-height: 1.4em;
border-bottom: 2px solid #222222;
white-space: pre;
display: inline-block;
}
.odd {
background-color: #55bbff;
color: #223311;
}
.even {
background-color: #ee7756;
color: #551133;
}
.code {
--index: calc(var(--layer) - 1);
padding-top: calc(var(--index) * 0.15em);
filter:
hue-rotate(calc(var(--index) * 25deg))
saturate(calc(100% - (var(--index) * 2%)))
brightness(calc(100% - (var(--index) * 1.5%)));
}
.annotation {
color: #4444ff;
font-family: monospace;
font-style: italic;
display: none;
-webkit-user-select: none;
}
body:active .annotation {
/* requires holding mouse down anywhere on the page */
display: inline-block;
}
span:hover .annotation {
/* requires hover over a span ONLY on its first line */
display: inline-block;
}
</style>
</head>
<body>
<div class="code" style="counter-reset: line 2"><span class="line"><span class="code" style="--layer: 0">fn main() {</span></span>
<span class="line"><span class="code" style="--layer: 0"> // Initialize test constants in a way that cannot be determined at compile time, to ensure</span></span>
<span class="line"><span class="code" style="--layer: 0"> // rustc and LLVM cannot optimize out statements (or coverage counters) downstream from</span></span>
<span class="line"><span class="code" style="--layer: 0"> // dependent conditions.</span></span>
<span class="line"><span class="code" style="--layer: 0"> let </span><span><span class="code even" style="--layer: 1" title="7:19-7:35: @0.Call: _4 = args() -&gt; [return: bb1, unwind: bb25]
7:19-7:35: @1[0]: _3 = &amp;_4
7:19-7:41: @1.Call: _2 = &lt;Args as ExactSizeIterator&gt;::len(move _3) -&gt; [return: bb2, unwind: bb24]
7:19-7:46: @2[1]: _1 = Eq(move _2, const 1_usize)
7:9-7:16: @2[3]: FakeRead(ForLet, _1)
9:33-9:42: @3[2]: _8 = (const 0_i32, const 0_i32, const 0_i32)
9:10-9:15: @3[4]: _5 = (_8.0: i32)
9:17-9:22: @3[6]: _6 = (_8.1: i32)
9:24-9:29: @3[8]: _7 = (_8.2: i32)"><span class="annotation">@0,1,2,3⦊</span>is_true = std::env::args().len() == 1;</span></span>
<span class="line"><span class="code even" style="--layer: 1" title="7:19-7:35: @0.Call: _4 = args() -&gt; [return: bb1, unwind: bb25]
7:19-7:35: @1[0]: _3 = &amp;_4
7:19-7:41: @1.Call: _2 = &lt;Args as ExactSizeIterator&gt;::len(move _3) -&gt; [return: bb2, unwind: bb24]
7:19-7:46: @2[1]: _1 = Eq(move _2, const 1_usize)
7:9-7:16: @2[3]: FakeRead(ForLet, _1)
9:33-9:42: @3[2]: _8 = (const 0_i32, const 0_i32, const 0_i32)
9:10-9:15: @3[4]: _5 = (_8.0: i32)
9:17-9:22: @3[6]: _6 = (_8.1: i32)
9:24-9:29: @3[8]: _7 = (_8.2: i32)"></span></span>
<span class="line"><span class="code even" style="--layer: 1" title="7:19-7:35: @0.Call: _4 = args() -&gt; [return: bb1, unwind: bb25]
7:19-7:35: @1[0]: _3 = &amp;_4
7:19-7:41: @1.Call: _2 = &lt;Args as ExactSizeIterator&gt;::len(move _3) -&gt; [return: bb2, unwind: bb24]
7:19-7:46: @2[1]: _1 = Eq(move _2, const 1_usize)
7:9-7:16: @2[3]: FakeRead(ForLet, _1)
9:33-9:42: @3[2]: _8 = (const 0_i32, const 0_i32, const 0_i32)
9:10-9:15: @3[4]: _5 = (_8.0: i32)
9:17-9:22: @3[6]: _6 = (_8.1: i32)
9:24-9:29: @3[8]: _7 = (_8.2: i32)"> let (mut a, mut b, mut c) = (0, 0, 0)<span class="annotation">⦉@0,1,2,3</span></span></span><span class="code" style="--layer: 0">;</span></span>
<span class="line"><span class="code" style="--layer: 0"> if </span><span><span class="code even" style="--layer: 1" title="10:8-10:15: @3[12]: _10 = _1
10:8-10:15: @3[13]: FakeRead(ForMatchedPlace, _10)"><span class="annotation">@0,1,2,3⦊</span>is_true<span class="annotation">⦉@0,1,2,3</span></span></span><span class="code" style="--layer: 0"> </span><span><span class="code odd" style="--layer: 1" title="11:9-11:14: @6[0]: _5 = const 1_i32
12:9-12:15: @6[1]: _6 = const 10_i32
13:9-13:16: @6[2]: _7 = const 100_i32
10:16-14:6: @6[3]: _9 = const ()"><span class="annotation">@4,6⦊</span>{</span></span>
<span class="line"><span class="code odd" style="--layer: 1" title="11:9-11:14: @6[0]: _5 = const 1_i32
12:9-12:15: @6[1]: _6 = const 10_i32
13:9-13:16: @6[2]: _7 = const 100_i32
10:16-14:6: @6[3]: _9 = const ()"> a = 1;</span></span>
<span class="line"><span class="code odd" style="--layer: 1" title="11:9-11:14: @6[0]: _5 = const 1_i32
12:9-12:15: @6[1]: _6 = const 10_i32
13:9-13:16: @6[2]: _7 = const 100_i32
10:16-14:6: @6[3]: _9 = const ()"> b = 10;</span></span>
<span class="line"><span class="code odd" style="--layer: 1" title="11:9-11:14: @6[0]: _5 = const 1_i32
12:9-12:15: @6[1]: _6 = const 10_i32
13:9-13:16: @6[2]: _7 = const 100_i32
10:16-14:6: @6[3]: _9 = const ()"> c = 100;</span></span>
<span class="line"><span class="code odd" style="--layer: 1" title="11:9-11:14: @6[0]: _5 = const 1_i32
12:9-12:15: @6[1]: _6 = const 10_i32
13:9-13:16: @6[2]: _7 = const 100_i32
10:16-14:6: @6[3]: _9 = const ()"> }<span class="annotation">⦉@4,6</span></span></span><span class="code" style="--layer: 0"></span></span>
<span class="line"><span class="code" style="--layer: 0"> let</span></span>
<span class="line"><span class="code" style="--layer: 0"> </span><span><span class="code even" style="--layer: 1" title="16:9-16:17: @11[2]: FakeRead(ForLet, _11)"><span class="annotation">@11⦊</span>somebool<span class="annotation">⦉@11</span></span></span><span class="code" style="--layer: 0"></span></span>
<span class="line"><span class="code" style="--layer: 0"> =</span></span>
<span class="line"><span class="code" style="--layer: 0"> </span><span><span class="code odd" style="--layer: 1" title="18:13-18:14: @7[5]: _13 = _5
18:17-18:18: @7[7]: _14 = _6
18:13-18:18: @7[8]: _12 = Lt(move _13, move _14)"><span class="annotation">@7⦊</span>a &lt; b<span class="annotation">⦉@7</span></span></span><span class="code" style="--layer: 0"></span></span>
<span class="line"><span class="code" style="--layer: 0"> ||</span></span>
<span class="line"><span class="code" style="--layer: 0"> </span><span><span class="code even" style="--layer: 1" title="20:13-20:14: @10[2]: _16 = _6
20:17-20:18: @10[4]: _17 = _7
20:13-20:18: @10[5]: _15 = Lt(move _16, move _17)"><span class="annotation">@10⦊</span>b &lt; c<span class="annotation">⦉@10</span></span></span><span class="code" style="--layer: 0"></span></span>
<span class="line"><span class="code" style="--layer: 0"> ;</span></span>
<span class="line"><span class="code" style="--layer: 0"> let</span></span>
<span class="line"><span class="code" style="--layer: 0"> </span><span><span class="code odd" style="--layer: 1" title="23:9-23:17: @15[2]: FakeRead(ForLet, _18)"><span class="annotation">@15⦊</span>somebool<span class="annotation">⦉@15</span></span></span><span class="code" style="--layer: 0"></span></span>
<span class="line"><span class="code" style="--layer: 0"> =</span></span>
<span class="line"><span class="code" style="--layer: 0"> </span><span><span class="code even" style="--layer: 1" title="25:13-25:14: @11[6]: _20 = _6
25:17-25:18: @11[8]: _21 = _5
25:13-25:18: @11[9]: _19 = Lt(move _20, move _21)"><span class="annotation">@11⦊</span>b &lt; a<span class="annotation">⦉@11</span></span></span><span class="code" style="--layer: 0"></span></span>
<span class="line"><span class="code" style="--layer: 0"> ||</span></span>
<span class="line"><span class="code" style="--layer: 0"> </span><span><span class="code odd" style="--layer: 1" title="27:13-27:14: @14[2]: _23 = _6
27:17-27:18: @14[4]: _24 = _7
27:13-27:18: @14[5]: _22 = Lt(move _23, move _24)"><span class="annotation">@14⦊</span>b &lt; c<span class="annotation">⦉@14</span></span></span><span class="code" style="--layer: 0"></span></span>
<span class="line"><span class="code" style="--layer: 0"> ;</span></span>
<span class="line"><span class="code" style="--layer: 0"> let</span></span>
<span class="line"><span class="code" style="--layer: 0"> </span><span><span class="code even" style="--layer: 1" title="30:9-30:17: @19[2]: FakeRead(ForLet, _25)"><span class="annotation">@19⦊</span>somebool<span class="annotation">⦉@19</span></span></span><span class="code" style="--layer: 0"></span></span>
<span class="line"><span class="code" style="--layer: 0"> =</span></span>
<span class="line"><span class="code" style="--layer: 0"> </span><span><span class="code odd" style="--layer: 1" title="32:13-32:14: @15[6]: _27 = _5
32:17-32:18: @15[8]: _28 = _6
32:13-32:18: @15[9]: _26 = Lt(move _27, move _28)"><span class="annotation">@15⦊</span>a &lt; b<span class="annotation">⦉@15</span></span></span><span class="code" style="--layer: 0"></span></span>
<span class="line"><span class="code" style="--layer: 0"> &amp;&amp;</span></span>
<span class="line"><span class="code" style="--layer: 0"> </span><span><span class="code even" style="--layer: 1" title="34:13-34:14: @18[2]: _30 = _6
34:17-34:18: @18[4]: _31 = _7
34:13-34:18: @18[5]: _29 = Lt(move _30, move _31)"><span class="annotation">@18⦊</span>b &lt; c<span class="annotation">⦉@18</span></span></span><span class="code" style="--layer: 0"></span></span>
<span class="line"><span class="code" style="--layer: 0"> ;</span></span>
<span class="line"><span class="code" style="--layer: 0"> let</span></span>
<span class="line"><span class="code" style="--layer: 0"> </span><span><span class="code odd" style="--layer: 1" title="37:9-37:17: @23[2]: FakeRead(ForLet, _32)"><span class="annotation">@23⦊</span>somebool<span class="annotation">⦉@23</span></span></span><span class="code" style="--layer: 0"></span></span>
<span class="line"><span class="code" style="--layer: 0"> =</span></span>
<span class="line"><span class="code" style="--layer: 0"> </span><span><span class="code even" style="--layer: 1" title="39:13-39:14: @19[6]: _34 = _6
39:17-39:18: @19[8]: _35 = _5
39:13-39:18: @19[9]: _33 = Lt(move _34, move _35)"><span class="annotation">@19⦊</span>b &lt; a<span class="annotation">⦉@19</span></span></span><span class="code" style="--layer: 0"></span></span>
<span class="line"><span class="code" style="--layer: 0"> &amp;&amp;</span></span>
<span class="line"><span class="code" style="--layer: 0"> </span><span><span class="code odd" style="--layer: 1" title="41:13-41:14: @22[2]: _37 = _6
41:17-41:18: @22[4]: _38 = _7
41:13-41:18: @22[5]: _36 = Lt(move _37, move _38)"><span class="annotation">@22⦊</span>b &lt; c<span class="annotation">⦉@22</span></span></span><span class="code" style="--layer: 0"></span></span>
<span class="line"><span class="code" style="--layer: 0"> ;</span></span>
<span class="line"><span class="code" style="--layer: 0">}</span><span><span class="code even" style="--layer: 1" title="43:2-43:2: @23.Return: return"><span class="annotation">@23⦊</span><span class="annotation">⦉@23</span></span></span></span></div>
</body>
</html>

View file

@ -0,0 +1,118 @@
<!DOCTYPE html>
<html>
<head>
<title>loop_break_value.main - Coverage Spans</title>
<style>
.line {
counter-increment: line;
}
.line:before {
content: counter(line) ": ";
font-family: Menlo, Monaco, monospace;
font-style: italic;
width: 3.8em;
display: inline-block;
text-align: right;
filter: opacity(50%);
-webkit-user-select: none;
}
.code {
color: #dddddd;
background-color: #222222;
font-family: Menlo, Monaco, monospace;
line-height: 1.4em;
border-bottom: 2px solid #222222;
white-space: pre;
display: inline-block;
}
.odd {
background-color: #55bbff;
color: #223311;
}
.even {
background-color: #ee7756;
color: #551133;
}
.code {
--index: calc(var(--layer) - 1);
padding-top: calc(var(--index) * 0.15em);
filter:
hue-rotate(calc(var(--index) * 25deg))
saturate(calc(100% - (var(--index) * 2%)))
brightness(calc(100% - (var(--index) * 1.5%)));
}
.annotation {
color: #4444ff;
font-family: monospace;
font-style: italic;
display: none;
-webkit-user-select: none;
}
body:active .annotation {
/* requires holding mouse down anywhere on the page */
display: inline-block;
}
span:hover .annotation {
/* requires hover over a span ONLY on its first line */
display: inline-block;
}
</style>
</head>
<body>
<div class="code" style="counter-reset: line 2"><span class="line"><span class="code" style="--layer: 0">fn main() </span><span><span class="code even" style="--layer: 1" title="6:13-11:10: @0.FalseUnwind: falseUnwind -&gt; [real: bb1, cleanup: bb2]
9:13-9:15: @1[0]: _1 = const 10_i32
4:9-4:15: @1[1]: FakeRead(ForLet, _1)
3:11-13:2: @1[2]: _0 = const ()
13:2-13:2: @1.Return: return"><span class="annotation">@0,1⦊</span>{</span></span>
<span class="line"><span class="code even" style="--layer: 1" title="6:13-11:10: @0.FalseUnwind: falseUnwind -&gt; [real: bb1, cleanup: bb2]
9:13-9:15: @1[0]: _1 = const 10_i32
4:9-4:15: @1[1]: FakeRead(ForLet, _1)
3:11-13:2: @1[2]: _0 = const ()
13:2-13:2: @1.Return: return"> let result</span></span>
<span class="line"><span class="code even" style="--layer: 1" title="6:13-11:10: @0.FalseUnwind: falseUnwind -&gt; [real: bb1, cleanup: bb2]
9:13-9:15: @1[0]: _1 = const 10_i32
4:9-4:15: @1[1]: FakeRead(ForLet, _1)
3:11-13:2: @1[2]: _0 = const ()
13:2-13:2: @1.Return: return"> =</span></span>
<span class="line"><span class="code even" style="--layer: 1" title="6:13-11:10: @0.FalseUnwind: falseUnwind -&gt; [real: bb1, cleanup: bb2]
9:13-9:15: @1[0]: _1 = const 10_i32
4:9-4:15: @1[1]: FakeRead(ForLet, _1)
3:11-13:2: @1[2]: _0 = const ()
13:2-13:2: @1.Return: return"> loop</span></span>
<span class="line"><span class="code even" style="--layer: 1" title="6:13-11:10: @0.FalseUnwind: falseUnwind -&gt; [real: bb1, cleanup: bb2]
9:13-9:15: @1[0]: _1 = const 10_i32
4:9-4:15: @1[1]: FakeRead(ForLet, _1)
3:11-13:2: @1[2]: _0 = const ()
13:2-13:2: @1.Return: return"> {</span></span>
<span class="line"><span class="code even" style="--layer: 1" title="6:13-11:10: @0.FalseUnwind: falseUnwind -&gt; [real: bb1, cleanup: bb2]
9:13-9:15: @1[0]: _1 = const 10_i32
4:9-4:15: @1[1]: FakeRead(ForLet, _1)
3:11-13:2: @1[2]: _0 = const ()
13:2-13:2: @1.Return: return"> break</span></span>
<span class="line"><span class="code even" style="--layer: 1" title="6:13-11:10: @0.FalseUnwind: falseUnwind -&gt; [real: bb1, cleanup: bb2]
9:13-9:15: @1[0]: _1 = const 10_i32
4:9-4:15: @1[1]: FakeRead(ForLet, _1)
3:11-13:2: @1[2]: _0 = const ()
13:2-13:2: @1.Return: return"> 10</span></span>
<span class="line"><span class="code even" style="--layer: 1" title="6:13-11:10: @0.FalseUnwind: falseUnwind -&gt; [real: bb1, cleanup: bb2]
9:13-9:15: @1[0]: _1 = const 10_i32
4:9-4:15: @1[1]: FakeRead(ForLet, _1)
3:11-13:2: @1[2]: _0 = const ()
13:2-13:2: @1.Return: return"> ;</span></span>
<span class="line"><span class="code even" style="--layer: 1" title="6:13-11:10: @0.FalseUnwind: falseUnwind -&gt; [real: bb1, cleanup: bb2]
9:13-9:15: @1[0]: _1 = const 10_i32
4:9-4:15: @1[1]: FakeRead(ForLet, _1)
3:11-13:2: @1[2]: _0 = const ()
13:2-13:2: @1.Return: return"> }</span></span>
<span class="line"><span class="code even" style="--layer: 1" title="6:13-11:10: @0.FalseUnwind: falseUnwind -&gt; [real: bb1, cleanup: bb2]
9:13-9:15: @1[0]: _1 = const 10_i32
4:9-4:15: @1[1]: FakeRead(ForLet, _1)
3:11-13:2: @1[2]: _0 = const ()
13:2-13:2: @1.Return: return"> ;</span></span>
<span class="line"><span class="code even" style="--layer: 1" title="6:13-11:10: @0.FalseUnwind: falseUnwind -&gt; [real: bb1, cleanup: bb2]
9:13-9:15: @1[0]: _1 = const 10_i32
4:9-4:15: @1[1]: FakeRead(ForLet, _1)
3:11-13:2: @1[2]: _0 = const ()
13:2-13:2: @1.Return: return">}<span class="annotation">⦉@0,1</span></span></span></span></div>
</body>
</html>

View file

@ -0,0 +1,127 @@
<!DOCTYPE html>
<html>
<head>
<title>simple_loop.main - Coverage Spans</title>
<style>
.line {
counter-increment: line;
}
.line:before {
content: counter(line) ": ";
font-family: Menlo, Monaco, monospace;
font-style: italic;
width: 3.8em;
display: inline-block;
text-align: right;
filter: opacity(50%);
-webkit-user-select: none;
}
.code {
color: #dddddd;
background-color: #222222;
font-family: Menlo, Monaco, monospace;
line-height: 1.4em;
border-bottom: 2px solid #222222;
white-space: pre;
display: inline-block;
}
.odd {
background-color: #55bbff;
color: #223311;
}
.even {
background-color: #ee7756;
color: #551133;
}
.code {
--index: calc(var(--layer) - 1);
padding-top: calc(var(--index) * 0.15em);
filter:
hue-rotate(calc(var(--index) * 25deg))
saturate(calc(100% - (var(--index) * 2%)))
brightness(calc(100% - (var(--index) * 1.5%)));
}
.annotation {
color: #4444ff;
font-family: monospace;
font-style: italic;
display: none;
-webkit-user-select: none;
}
body:active .annotation {
/* requires holding mouse down anywhere on the page */
display: inline-block;
}
span:hover .annotation {
/* requires hover over a span ONLY on its first line */
display: inline-block;
}
</style>
</head>
<body>
<div class="code" style="counter-reset: line 2"><span class="line"><span class="code" style="--layer: 0">fn main() {</span></span>
<span class="line"><span class="code" style="--layer: 0"> // Initialize test constants in a way that cannot be determined at compile time, to ensure</span></span>
<span class="line"><span class="code" style="--layer: 0"> // rustc and LLVM cannot optimize out statements (or coverage counters) downstream from</span></span>
<span class="line"><span class="code" style="--layer: 0"> // dependent conditions.</span></span>
<span class="line"><span class="code" style="--layer: 0"> let </span><span><span class="code even" style="--layer: 1" title="7:19-7:35: @0.Call: _4 = args() -&gt; [return: bb1, unwind: bb15]
7:19-7:35: @1[0]: _3 = &amp;_4
7:19-7:41: @1.Call: _2 = &lt;Args as ExactSizeIterator&gt;::len(move _3) -&gt; [return: bb2, unwind: bb14]
7:19-7:46: @2[1]: _1 = Eq(move _2, const 1_usize)
7:9-7:16: @2[3]: FakeRead(ForLet, _1)
9:25-9:26: @3[2]: _5 = const 0_i32
9:9-9:22: @3[3]: FakeRead(ForLet, _5)"><span class="annotation">@0,1,2,3⦊</span>is_true = std::env::args().len() == 1;</span></span>
<span class="line"><span class="code even" style="--layer: 1" title="7:19-7:35: @0.Call: _4 = args() -&gt; [return: bb1, unwind: bb15]
7:19-7:35: @1[0]: _3 = &amp;_4
7:19-7:41: @1.Call: _2 = &lt;Args as ExactSizeIterator&gt;::len(move _3) -&gt; [return: bb2, unwind: bb14]
7:19-7:46: @2[1]: _1 = Eq(move _2, const 1_usize)
7:9-7:16: @2[3]: FakeRead(ForLet, _1)
9:25-9:26: @3[2]: _5 = const 0_i32
9:9-9:22: @3[3]: FakeRead(ForLet, _5)"></span></span>
<span class="line"><span class="code even" style="--layer: 1" title="7:19-7:35: @0.Call: _4 = args() -&gt; [return: bb1, unwind: bb15]
7:19-7:35: @1[0]: _3 = &amp;_4
7:19-7:41: @1.Call: _2 = &lt;Args as ExactSizeIterator&gt;::len(move _3) -&gt; [return: bb2, unwind: bb14]
7:19-7:46: @2[1]: _1 = Eq(move _2, const 1_usize)
7:9-7:16: @2[3]: FakeRead(ForLet, _1)
9:25-9:26: @3[2]: _5 = const 0_i32
9:9-9:22: @3[3]: FakeRead(ForLet, _5)"> let mut countdown = 0<span class="annotation">⦉@0,1,2,3</span></span></span><span class="code" style="--layer: 0">;</span></span>
<span class="line"><span class="code" style="--layer: 0"></span></span>
<span class="line"><span class="code" style="--layer: 0"> if</span></span>
<span class="line"><span class="code" style="--layer: 0"> </span><span><span class="code even" style="--layer: 1" title="12:9-12:16: @3[6]: _7 = _1
12:9-12:16: @3[7]: FakeRead(ForMatchedPlace, _7)"><span class="annotation">@0,1,2,3⦊</span>is_true<span class="annotation">⦉@0,1,2,3</span></span></span><span class="code" style="--layer: 0"></span></span>
<span class="line"><span class="code" style="--layer: 0"> </span><span><span class="code odd" style="--layer: 1" title="14:9-16:15: @6[0]: _5 = const 10_i32
13:5-18:6: @6[1]: _6 = const ()"><span class="annotation">@4,6⦊</span>{</span></span>
<span class="line"><span class="code odd" style="--layer: 1" title="14:9-16:15: @6[0]: _5 = const 10_i32
13:5-18:6: @6[1]: _6 = const ()"> countdown</span></span>
<span class="line"><span class="code odd" style="--layer: 1" title="14:9-16:15: @6[0]: _5 = const 10_i32
13:5-18:6: @6[1]: _6 = const ()"> =</span></span>
<span class="line"><span class="code odd" style="--layer: 1" title="14:9-16:15: @6[0]: _5 = const 10_i32
13:5-18:6: @6[1]: _6 = const ()"> 10</span></span>
<span class="line"><span class="code odd" style="--layer: 1" title="14:9-16:15: @6[0]: _5 = const 10_i32
13:5-18:6: @6[1]: _6 = const ()"> ;</span></span>
<span class="line"><span class="code odd" style="--layer: 1" title="14:9-16:15: @6[0]: _5 = const 10_i32
13:5-18:6: @6[1]: _6 = const ()"> }<span class="annotation">⦉@4,6</span></span></span><span class="code" style="--layer: 0"></span></span>
<span class="line"><span class="code" style="--layer: 0"></span></span>
<span class="line"><span class="code" style="--layer: 0"> loop</span></span>
<span class="line"><span class="code" style="--layer: 0"> {</span></span>
<span class="line"><span class="code" style="--layer: 0"> if</span></span>
<span class="line"><span class="code" style="--layer: 0"> </span><span><span class="code even" style="--layer: 1" title="23:13-23:22: @9[3]: _11 = _5
23:13-25:14: @9[4]: _10 = Eq(move _11, const 0_i32)
23:13-25:14: @9[6]: FakeRead(ForMatchedPlace, _10)"><span class="annotation">@8,9⦊</span>countdown</span></span>
<span class="line"><span class="code even" style="--layer: 1" title="23:13-23:22: @9[3]: _11 = _5
23:13-25:14: @9[4]: _10 = Eq(move _11, const 0_i32)
23:13-25:14: @9[6]: FakeRead(ForMatchedPlace, _10)"> ==</span></span>
<span class="line"><span class="code even" style="--layer: 1" title="23:13-23:22: @9[3]: _11 = _5
23:13-25:14: @9[4]: _10 = Eq(move _11, const 0_i32)
23:13-25:14: @9[6]: FakeRead(ForMatchedPlace, _10)"> 0<span class="annotation">⦉@8,9</span></span></span><span class="code" style="--layer: 0"></span></span>
<span class="line"><span class="code" style="--layer: 0"> {</span></span>
<span class="line"><span class="code" style="--layer: 0"> </span><span><span class="code odd" style="--layer: 1" title="27:13-27:18: @12[0]: _0 = const ()"><span class="annotation">@10,12⦊</span>break<span class="annotation">⦉@10,12</span></span></span><span class="code" style="--layer: 0"></span></span>
<span class="line"><span class="code" style="--layer: 0"> ;</span></span>
<span class="line"><span class="code" style="--layer: 0"> }</span></span>
<span class="line"><span class="code" style="--layer: 0"> </span><span><span class="code even" style="--layer: 1" title="30:9-32:10: @11[3]: _13 = CheckedSub(_5, const 1_i32)"><span class="annotation">@11⦊</span>countdown</span></span>
<span class="line"><span class="code even" style="--layer: 1" title="30:9-32:10: @11[3]: _13 = CheckedSub(_5, const 1_i32)"> -=</span></span>
<span class="line"><span class="code even" style="--layer: 1" title="30:9-32:10: @11[3]: _13 = CheckedSub(_5, const 1_i32)"> 1<span class="annotation">⦉@11</span></span></span><span class="code" style="--layer: 0"></span></span>
<span class="line"><span class="code" style="--layer: 0"> ;</span></span>
<span class="line"><span class="code" style="--layer: 0"> }</span></span>
<span class="line"><span class="code" style="--layer: 0">}</span><span><span class="code odd" style="--layer: 1" title="35:2-35:2: @12.Return: return"><span class="annotation">@10,12⦊</span><span class="annotation">⦉@10,12</span></span></span></span></div>
</body>
</html>

View file

@ -0,0 +1,190 @@
<!DOCTYPE html>
<html>
<head>
<title>simple_match.main - Coverage Spans</title>
<style>
.line {
counter-increment: line;
}
.line:before {
content: counter(line) ": ";
font-family: Menlo, Monaco, monospace;
font-style: italic;
width: 3.8em;
display: inline-block;
text-align: right;
filter: opacity(50%);
-webkit-user-select: none;
}
.code {
color: #dddddd;
background-color: #222222;
font-family: Menlo, Monaco, monospace;
line-height: 1.4em;
border-bottom: 2px solid #222222;
white-space: pre;
display: inline-block;
}
.odd {
background-color: #55bbff;
color: #223311;
}
.even {
background-color: #ee7756;
color: #551133;
}
.code {
--index: calc(var(--layer) - 1);
padding-top: calc(var(--index) * 0.15em);
filter:
hue-rotate(calc(var(--index) * 25deg))
saturate(calc(100% - (var(--index) * 2%)))
brightness(calc(100% - (var(--index) * 1.5%)));
}
.annotation {
color: #4444ff;
font-family: monospace;
font-style: italic;
display: none;
-webkit-user-select: none;
}
body:active .annotation {
/* requires holding mouse down anywhere on the page */
display: inline-block;
}
span:hover .annotation {
/* requires hover over a span ONLY on its first line */
display: inline-block;
}
</style>
</head>
<body>
<div class="code" style="counter-reset: line 2"><span class="line"><span class="code" style="--layer: 0">fn main() {</span></span>
<span class="line"><span class="code" style="--layer: 0"> // Initialize test constants in a way that cannot be determined at compile time, to ensure</span></span>
<span class="line"><span class="code" style="--layer: 0"> // rustc and LLVM cannot optimize out statements (or coverage counters) downstream from</span></span>
<span class="line"><span class="code" style="--layer: 0"> // dependent conditions.</span></span>
<span class="line"><span class="code" style="--layer: 0"> let </span><span><span class="code even" style="--layer: 1" title="7:19-7:35: @0.Call: _4 = args() -&gt; [return: bb1, unwind: bb22]
7:19-7:35: @1[0]: _3 = &amp;_4
7:19-7:41: @1.Call: _2 = &lt;Args as ExactSizeIterator&gt;::len(move _3) -&gt; [return: bb2, unwind: bb21]
7:19-7:46: @2[1]: _1 = Eq(move _2, const 1_usize)
7:9-7:16: @2[3]: FakeRead(ForLet, _1)
9:25-9:26: @3[2]: _5 = const 1_i32
9:9-9:22: @3[3]: FakeRead(ForLet, _5)"><span class="annotation">@0,1,2,3⦊</span>is_true = std::env::args().len() == 1;</span></span>
<span class="line"><span class="code even" style="--layer: 1" title="7:19-7:35: @0.Call: _4 = args() -&gt; [return: bb1, unwind: bb22]
7:19-7:35: @1[0]: _3 = &amp;_4
7:19-7:41: @1.Call: _2 = &lt;Args as ExactSizeIterator&gt;::len(move _3) -&gt; [return: bb2, unwind: bb21]
7:19-7:46: @2[1]: _1 = Eq(move _2, const 1_usize)
7:9-7:16: @2[3]: FakeRead(ForLet, _1)
9:25-9:26: @3[2]: _5 = const 1_i32
9:9-9:22: @3[3]: FakeRead(ForLet, _5)"></span></span>
<span class="line"><span class="code even" style="--layer: 1" title="7:19-7:35: @0.Call: _4 = args() -&gt; [return: bb1, unwind: bb22]
7:19-7:35: @1[0]: _3 = &amp;_4
7:19-7:41: @1.Call: _2 = &lt;Args as ExactSizeIterator&gt;::len(move _3) -&gt; [return: bb2, unwind: bb21]
7:19-7:46: @2[1]: _1 = Eq(move _2, const 1_usize)
7:9-7:16: @2[3]: FakeRead(ForLet, _1)
9:25-9:26: @3[2]: _5 = const 1_i32
9:9-9:22: @3[3]: FakeRead(ForLet, _5)"> let mut countdown = 1<span class="annotation">⦉@0,1,2,3</span></span></span><span class="code" style="--layer: 0">;</span></span>
<span class="line"><span class="code" style="--layer: 0"> if </span><span><span class="code even" style="--layer: 1" title="10:8-10:15: @3[6]: _7 = _1
10:8-10:15: @3[7]: FakeRead(ForMatchedPlace, _7)"><span class="annotation">@0,1,2,3⦊</span>is_true<span class="annotation">⦉@0,1,2,3</span></span></span><span class="code" style="--layer: 0"> </span><span><span class="code odd" style="--layer: 1" title="11:9-11:22: @6[0]: _5 = const 0_i32
10:16-12:6: @6[1]: _6 = const ()"><span class="annotation">@4,6⦊</span>{</span></span>
<span class="line"><span class="code odd" style="--layer: 1" title="11:9-11:22: @6[0]: _5 = const 0_i32
10:16-12:6: @6[1]: _6 = const ()"> countdown = 0;</span></span>
<span class="line"><span class="code odd" style="--layer: 1" title="11:9-11:22: @6[0]: _5 = const 0_i32
10:16-12:6: @6[1]: _6 = const ()"> }<span class="annotation">⦉@4,6</span></span></span><span class="code" style="--layer: 0"></span></span>
<span class="line"><span class="code" style="--layer: 0"></span></span>
<span class="line"><span class="code" style="--layer: 0"> </span><span><span class="code even" style="--layer: 1" title="15:9-15:10: @11[2]: _17 = discriminant(_14)"><span class="annotation">@9,10,11⦊</span>for</span></span>
<span class="line"><span class="code even" style="--layer: 1" title="15:9-15:10: @11[2]: _17 = discriminant(_14)"> _<span class="annotation">⦉@9,10,11</span></span></span><span class="code" style="--layer: 0"></span></span>
<span class="line"><span class="code" style="--layer: 0"> in</span></span>
<span class="line"><span class="code" style="--layer: 0"> </span><span><span class="code odd" style="--layer: 1" title="17:9-17:13: @7[4]: _9 = std::ops::Range::&lt;i32&gt; { start: const 0_i32, end: const 2_i32 }
17:9-17:13: @7.Call: _8 = &lt;std::ops::Range&lt;i32&gt; as IntoIterator&gt;::into_iter(move _9) -&gt; [return: bb8, unwind: bb22]
17:9-17:13: @8[1]: FakeRead(ForMatchedPlace, _8)
17:9-17:13: @8[3]: _10 = move _8"><span class="annotation">@7,8⦊</span>0..2<span class="annotation">⦉@7,8</span></span></span><span class="code" style="--layer: 0"></span></span>
<span class="line"><span class="code" style="--layer: 0"> {</span></span>
<span class="line"><span class="code" style="--layer: 0"> let z</span></span>
<span class="line"><span class="code" style="--layer: 0"> ;</span></span>
<span class="line"><span class="code" style="--layer: 0"> match</span></span>
<span class="line"><span class="code" style="--layer: 0"> </span><span><span class="code even" style="--layer: 1" title="22:13-22:22: @15[13]: FakeRead(ForMatchedPlace, _5)
24:13-24:14: @17[1]: _24 = &amp;_5
26:17-26:18: @17[4]: _26 = (*_24)
26:17-28:18: @17[5]: _25 = Lt(move _26, const 1_i32)"><span class="annotation">@13,15,17⦊</span>countdown</span></span>
<span class="line"><span class="code even" style="--layer: 1" title="22:13-22:22: @15[13]: FakeRead(ForMatchedPlace, _5)
24:13-24:14: @17[1]: _24 = &amp;_5
26:17-26:18: @17[4]: _26 = (*_24)
26:17-28:18: @17[5]: _25 = Lt(move _26, const 1_i32)"> {</span></span>
<span class="line"><span class="code even" style="--layer: 1" title="22:13-22:22: @15[13]: FakeRead(ForMatchedPlace, _5)
24:13-24:14: @17[1]: _24 = &amp;_5
26:17-26:18: @17[4]: _26 = (*_24)
26:17-28:18: @17[5]: _25 = Lt(move _26, const 1_i32)"> x</span></span>
<span class="line"><span class="code even" style="--layer: 1" title="22:13-22:22: @15[13]: FakeRead(ForMatchedPlace, _5)
24:13-24:14: @17[1]: _24 = &amp;_5
26:17-26:18: @17[4]: _26 = (*_24)
26:17-28:18: @17[5]: _25 = Lt(move _26, const 1_i32)"> if</span></span>
<span class="line"><span class="code even" style="--layer: 1" title="22:13-22:22: @15[13]: FakeRead(ForMatchedPlace, _5)
24:13-24:14: @17[1]: _24 = &amp;_5
26:17-26:18: @17[4]: _26 = (*_24)
26:17-28:18: @17[5]: _25 = Lt(move _26, const 1_i32)"> x</span></span>
<span class="line"><span class="code even" style="--layer: 1" title="22:13-22:22: @15[13]: FakeRead(ForMatchedPlace, _5)
24:13-24:14: @17[1]: _24 = &amp;_5
26:17-26:18: @17[4]: _26 = (*_24)
26:17-28:18: @17[5]: _25 = Lt(move _26, const 1_i32)"> &lt;</span></span>
<span class="line"><span class="code even" style="--layer: 1" title="22:13-22:22: @15[13]: FakeRead(ForMatchedPlace, _5)
24:13-24:14: @17[1]: _24 = &amp;_5
26:17-26:18: @17[4]: _26 = (*_24)
26:17-28:18: @17[5]: _25 = Lt(move _26, const 1_i32)"> 1<span class="annotation">⦉@13,15,17</span></span></span><span class="code" style="--layer: 0"></span></span>
<span class="line"><span class="code" style="--layer: 0"> =&gt;</span></span>
<span class="line"><span class="code" style="--layer: 0"> </span><span><span class="code odd" style="--layer: 1" title="31:21-31:30: @18[5]: _27 = _5
31:17-31:30: @18[6]: _22 = move _27
33:25-33:34: @18[9]: _28 = _5
33:21-33:22: @18[10]: FakeRead(ForLet, _28)
35:17-35:31: @18[11]: _5 = const 10_i32
30:13-37:14: @18[12]: _21 = const ()"><span class="annotation">@18⦊</span>{</span></span>
<span class="line"><span class="code odd" style="--layer: 1" title="31:21-31:30: @18[5]: _27 = _5
31:17-31:30: @18[6]: _22 = move _27
33:25-33:34: @18[9]: _28 = _5
33:21-33:22: @18[10]: FakeRead(ForLet, _28)
35:17-35:31: @18[11]: _5 = const 10_i32
30:13-37:14: @18[12]: _21 = const ()"> z = countdown</span></span>
<span class="line"><span class="code odd" style="--layer: 1" title="31:21-31:30: @18[5]: _27 = _5
31:17-31:30: @18[6]: _22 = move _27
33:25-33:34: @18[9]: _28 = _5
33:21-33:22: @18[10]: FakeRead(ForLet, _28)
35:17-35:31: @18[11]: _5 = const 10_i32
30:13-37:14: @18[12]: _21 = const ()"> ;</span></span>
<span class="line"><span class="code odd" style="--layer: 1" title="31:21-31:30: @18[5]: _27 = _5
31:17-31:30: @18[6]: _22 = move _27
33:25-33:34: @18[9]: _28 = _5
33:21-33:22: @18[10]: FakeRead(ForLet, _28)
35:17-35:31: @18[11]: _5 = const 10_i32
30:13-37:14: @18[12]: _21 = const ()"> let y = countdown</span></span>
<span class="line"><span class="code odd" style="--layer: 1" title="31:21-31:30: @18[5]: _27 = _5
31:17-31:30: @18[6]: _22 = move _27
33:25-33:34: @18[9]: _28 = _5
33:21-33:22: @18[10]: FakeRead(ForLet, _28)
35:17-35:31: @18[11]: _5 = const 10_i32
30:13-37:14: @18[12]: _21 = const ()"> ;</span></span>
<span class="line"><span class="code odd" style="--layer: 1" title="31:21-31:30: @18[5]: _27 = _5
31:17-31:30: @18[6]: _22 = move _27
33:25-33:34: @18[9]: _28 = _5
33:21-33:22: @18[10]: FakeRead(ForLet, _28)
35:17-35:31: @18[11]: _5 = const 10_i32
30:13-37:14: @18[12]: _21 = const ()"> countdown = 10</span></span>
<span class="line"><span class="code odd" style="--layer: 1" title="31:21-31:30: @18[5]: _27 = _5
31:17-31:30: @18[6]: _22 = move _27
33:25-33:34: @18[9]: _28 = _5
33:21-33:22: @18[10]: FakeRead(ForLet, _28)
35:17-35:31: @18[11]: _5 = const 10_i32
30:13-37:14: @18[12]: _21 = const ()"> ;</span></span>
<span class="line"><span class="code odd" style="--layer: 1" title="31:21-31:30: @18[5]: _27 = _5
31:17-31:30: @18[6]: _22 = move _27
33:25-33:34: @18[9]: _28 = _5
33:21-33:22: @18[10]: FakeRead(ForLet, _28)
35:17-35:31: @18[11]: _5 = const 10_i32
30:13-37:14: @18[12]: _21 = const ()"> }<span class="annotation">⦉@18</span></span></span><span class="code" style="--layer: 0"></span></span>
<span class="line"><span class="code" style="--layer: 0"> _</span></span>
<span class="line"><span class="code" style="--layer: 0"> =&gt;</span></span>
<span class="line"><span class="code" style="--layer: 0"> </span><span><span class="code even" style="--layer: 1" title="40:13-40:15: @16[0]: _21 = const ()"><span class="annotation">@16⦊</span>{}<span class="annotation">⦉@16</span></span></span><span class="code" style="--layer: 0"></span></span>
<span class="line"><span class="code" style="--layer: 0"> }</span></span>
<span class="line"><span class="code" style="--layer: 0"> }</span></span>
<span class="line"><span class="code" style="--layer: 0">}</span><span><span class="code odd" style="--layer: 1" title="43:2-43:2: @12.Return: return"><span class="annotation">@12⦊</span><span class="annotation">⦉@12</span></span></span></span></div>
</body>
</html>

Some files were not shown because too many files have changed in this diff Show more