Rollup merge of #83080 - tmiasko:inline-coverage, r=wesleywiser

Make source-based code coverage compatible with MIR inlining

When codegenning code coverage use the instance that coverage data was
originally generated for, to ensure basic level of compatibility with
MIR inlining.

Fixes #83061
This commit is contained in:
Dylan DPC 2021-03-18 00:28:09 +01:00 committed by GitHub
commit b688b694d0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
25 changed files with 1100 additions and 88 deletions

View File

@ -254,7 +254,7 @@ fn save_function_record(
/// ///
/// 1. The file name of an "Unreachable" function must match the file name of the existing /// 1. The file name of an "Unreachable" function must match the file name of the existing
/// codegenned (covered) function to which the unreachable code regions will be added. /// codegenned (covered) function to which the unreachable code regions will be added.
/// 2. The function to which the unreachable code regions will be added must not be a genaric /// 2. The function to which the unreachable code regions will be added must not be a generic
/// function (must not have type parameters) because the coverage tools will get confused /// function (must not have type parameters) because the coverage tools will get confused
/// if the codegenned function has more than one instantiation and additional `CodeRegion`s /// if the codegenned function has more than one instantiation and additional `CodeRegion`s
/// attached to only one of those instantiations. /// attached to only one of those instantiations.
@ -284,7 +284,7 @@ fn add_unreachable_coverage<'tcx>(
let all_def_ids: DefIdSet = let all_def_ids: DefIdSet =
tcx.mir_keys(LOCAL_CRATE).iter().map(|local_def_id| local_def_id.to_def_id()).collect(); tcx.mir_keys(LOCAL_CRATE).iter().map(|local_def_id| local_def_id.to_def_id()).collect();
let (codegenned_def_ids, _) = tcx.collect_and_partition_mono_items(LOCAL_CRATE); let codegenned_def_ids = tcx.codegened_and_inlined_items(LOCAL_CRATE);
let mut unreachable_def_ids_by_file: FxHashMap<Symbol, Vec<DefId>> = FxHashMap::default(); let mut unreachable_def_ids_by_file: FxHashMap<Symbol, Vec<DefId>> = FxHashMap::default();
for &non_codegenned_def_id in all_def_ids.difference(codegenned_def_ids) { for &non_codegenned_def_id in all_def_ids.difference(codegenned_def_ids) {

View File

@ -8,7 +8,7 @@
use rustc_middle::ty::Instance; use rustc_middle::ty::Instance;
use rustc_middle::ty::TyCtxt; use rustc_middle::ty::TyCtxt;
#[derive(Clone, Debug)] #[derive(Clone, Debug, PartialEq)]
pub struct Expression { pub struct Expression {
lhs: ExpressionOperandId, lhs: ExpressionOperandId,
op: Op, op: Op,
@ -64,7 +64,9 @@ pub fn set_function_source_hash(&mut self, source_hash: u64) {
/// Adds a code region to be counted by an injected counter intrinsic. /// Adds a code region to be counted by an injected counter intrinsic.
pub fn add_counter(&mut self, id: CounterValueReference, region: CodeRegion) { pub fn add_counter(&mut self, id: CounterValueReference, region: CodeRegion) {
self.counters[id].replace(region).expect_none("add_counter called with duplicate `id`"); if let Some(previous_region) = self.counters[id].replace(region.clone()) {
assert_eq!(previous_region, region, "add_counter: code region for id changed");
}
} }
/// Both counters and "counter expressions" (or simply, "expressions") can be operands in other /// Both counters and "counter expressions" (or simply, "expressions") can be operands in other
@ -94,9 +96,18 @@ pub fn add_counter_expression(
expression_id, lhs, op, rhs, region expression_id, lhs, op, rhs, region
); );
let expression_index = self.expression_index(u32::from(expression_id)); let expression_index = self.expression_index(u32::from(expression_id));
self.expressions[expression_index] if let Some(previous_expression) = self.expressions[expression_index].replace(Expression {
.replace(Expression { lhs, op, rhs, region }) lhs,
.expect_none("add_counter_expression called with duplicate `id_descending_from_max`"); op,
rhs,
region: region.clone(),
}) {
assert_eq!(
previous_expression,
Expression { lhs, op, rhs, region },
"add_counter_expression: expression for id changed"
);
}
} }
/// Add a region that will be marked as "unreachable", with a constant "zero counter". /// Add a region that will be marked as "unreachable", with a constant "zero counter".

View File

@ -2,27 +2,38 @@
use rustc_middle::mir::coverage::*; use rustc_middle::mir::coverage::*;
use rustc_middle::mir::Coverage; use rustc_middle::mir::Coverage;
use rustc_middle::mir::SourceScope;
use super::FunctionCx; use super::FunctionCx;
impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
pub fn codegen_coverage(&self, bx: &mut Bx, coverage: Coverage) { pub fn codegen_coverage(&self, bx: &mut Bx, coverage: Coverage, scope: SourceScope) {
// Determine the instance that coverage data was originally generated for.
let scope_data = &self.mir.source_scopes[scope];
let instance = if let Some((inlined_instance, _)) = scope_data.inlined {
self.monomorphize(inlined_instance)
} else if let Some(inlined_scope) = scope_data.inlined_parent_scope {
self.monomorphize(self.mir.source_scopes[inlined_scope].inlined.unwrap().0)
} else {
self.instance
};
let Coverage { kind, code_region } = coverage; let Coverage { kind, code_region } = coverage;
match kind { match kind {
CoverageKind::Counter { function_source_hash, id } => { CoverageKind::Counter { function_source_hash, id } => {
if bx.set_function_source_hash(self.instance, function_source_hash) { if bx.set_function_source_hash(instance, function_source_hash) {
// If `set_function_source_hash()` returned true, the coverage map is enabled, // If `set_function_source_hash()` returned true, the coverage map is enabled,
// so continue adding the counter. // so continue adding the counter.
if let Some(code_region) = code_region { if let Some(code_region) = code_region {
// Note: Some counters do not have code regions, but may still be referenced // Note: Some counters do not have code regions, but may still be referenced
// from expressions. In that case, don't add the counter to the coverage map, // from expressions. In that case, don't add the counter to the coverage map,
// but do inject the counter intrinsic. // but do inject the counter intrinsic.
bx.add_coverage_counter(self.instance, id, code_region); bx.add_coverage_counter(instance, id, code_region);
} }
let coverageinfo = bx.tcx().coverageinfo(self.instance.def_id()); let coverageinfo = bx.tcx().coverageinfo(instance.def_id());
let fn_name = bx.create_pgo_func_name_var(self.instance); let fn_name = bx.create_pgo_func_name_var(instance);
let hash = bx.const_u64(function_source_hash); let hash = bx.const_u64(function_source_hash);
let num_counters = bx.const_u32(coverageinfo.num_counters); let num_counters = bx.const_u32(coverageinfo.num_counters);
let index = bx.const_u32(u32::from(id)); let index = bx.const_u32(u32::from(id));
@ -34,11 +45,11 @@ pub fn codegen_coverage(&self, bx: &mut Bx, coverage: Coverage) {
} }
} }
CoverageKind::Expression { id, lhs, op, rhs } => { CoverageKind::Expression { id, lhs, op, rhs } => {
bx.add_coverage_counter_expression(self.instance, id, lhs, op, rhs, code_region); bx.add_coverage_counter_expression(instance, id, lhs, op, rhs, code_region);
} }
CoverageKind::Unreachable => { CoverageKind::Unreachable => {
bx.add_coverage_unreachable( bx.add_coverage_unreachable(
self.instance, instance,
code_region.expect("unreachable regions always have code regions"), code_region.expect("unreachable regions always have code regions"),
); );
} }

View File

@ -112,7 +112,7 @@ pub fn codegen_statement(&mut self, mut bx: Bx, statement: &mir::Statement<'tcx>
bx bx
} }
mir::StatementKind::Coverage(box ref coverage) => { mir::StatementKind::Coverage(box ref coverage) => {
self.codegen_coverage(&mut bx, coverage.clone()); self.codegen_coverage(&mut bx, coverage.clone(), statement.source_info.scope);
bx bx
} }
mir::StatementKind::CopyNonOverlapping(box mir::CopyNonOverlapping { mir::StatementKind::CopyNonOverlapping(box mir::CopyNonOverlapping {

View File

@ -1407,6 +1407,14 @@
query is_codegened_item(def_id: DefId) -> bool { query is_codegened_item(def_id: DefId) -> bool {
desc { |tcx| "determining whether `{}` needs codegen", tcx.def_path_str(def_id) } desc { |tcx| "determining whether `{}` needs codegen", tcx.def_path_str(def_id) }
} }
/// All items participating in code generation together with items inlined into them.
query codegened_and_inlined_items(_: CrateNum)
-> &'tcx DefIdSet {
eval_always
desc { "codegened_and_inlined_items" }
}
query codegen_unit(_: Symbol) -> &'tcx CodegenUnit<'tcx> { query codegen_unit(_: Symbol) -> &'tcx CodegenUnit<'tcx> {
desc { "codegen_unit" } desc { "codegen_unit" }
} }

View File

@ -424,8 +424,33 @@ fn collect_and_partition_mono_items<'tcx>(
(tcx.arena.alloc(mono_items), codegen_units) (tcx.arena.alloc(mono_items), codegen_units)
} }
fn codegened_and_inlined_items<'tcx>(tcx: TyCtxt<'tcx>, cnum: CrateNum) -> &'tcx DefIdSet {
let (items, cgus) = tcx.collect_and_partition_mono_items(cnum);
let mut visited = DefIdSet::default();
let mut result = items.clone();
for cgu in cgus {
for (item, _) in cgu.items() {
if let MonoItem::Fn(ref instance) = item {
let did = instance.def_id();
if !visited.insert(did) {
continue;
}
for scope in &tcx.instance_mir(instance.def).source_scopes {
if let Some((ref inlined, _)) = scope.inlined {
result.insert(inlined.def_id());
}
}
}
}
}
tcx.arena.alloc(result)
}
pub fn provide(providers: &mut Providers) { pub fn provide(providers: &mut Providers) {
providers.collect_and_partition_mono_items = collect_and_partition_mono_items; providers.collect_and_partition_mono_items = collect_and_partition_mono_items;
providers.codegened_and_inlined_items = codegened_and_inlined_items;
providers.is_codegened_item = |tcx, def_id| { providers.is_codegened_item = |tcx, def_id| {
let (all_mono_items, _) = tcx.collect_and_partition_mono_items(LOCAL_CRATE); let (all_mono_items, _) = tcx.collect_and_partition_mono_items(LOCAL_CRATE);

View File

@ -1,8 +1,7 @@
use super::*; use super::*;
use rustc_middle::mir::coverage::*; use rustc_middle::mir::coverage::*;
use rustc_middle::mir::visit::Visitor; use rustc_middle::mir::{self, Body, Coverage, CoverageInfo};
use rustc_middle::mir::{self, Coverage, CoverageInfo, Location};
use rustc_middle::ty::query::Providers; use rustc_middle::ty::query::Providers;
use rustc_middle::ty::{self, TyCtxt}; use rustc_middle::ty::{self, TyCtxt};
use rustc_span::def_id::DefId; use rustc_span::def_id::DefId;
@ -85,10 +84,21 @@ fn update_from_expression_operand(&mut self, operand_id: u32) {
} }
} }
} }
}
impl Visitor<'_> for CoverageVisitor { fn visit_body(&mut self, body: &Body<'_>) {
fn visit_coverage(&mut self, coverage: &Coverage, _location: Location) { for bb_data in body.basic_blocks().iter() {
for statement in bb_data.statements.iter() {
if let StatementKind::Coverage(box ref coverage) = statement.kind {
if is_inlined(body, statement) {
continue;
}
self.visit_coverage(coverage);
}
}
}
}
fn visit_coverage(&mut self, coverage: &Coverage) {
if self.add_missing_operands { if self.add_missing_operands {
match coverage.kind { match coverage.kind {
CoverageKind::Expression { lhs, rhs, .. } => { CoverageKind::Expression { lhs, rhs, .. } => {
@ -129,10 +139,14 @@ fn coverageinfo_from_mir<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> CoverageInfo
} }
fn covered_file_name<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> Option<Symbol> { fn covered_file_name<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> Option<Symbol> {
for bb_data in mir_body(tcx, def_id).basic_blocks().iter() { let body = mir_body(tcx, def_id);
for bb_data in body.basic_blocks().iter() {
for statement in bb_data.statements.iter() { for statement in bb_data.statements.iter() {
if let StatementKind::Coverage(box ref coverage) = statement.kind { if let StatementKind::Coverage(box ref coverage) = statement.kind {
if let Some(code_region) = coverage.code_region.as_ref() { if let Some(code_region) = coverage.code_region.as_ref() {
if is_inlined(body, statement) {
continue;
}
return Some(code_region.file_name); return Some(code_region.file_name);
} }
} }
@ -151,13 +165,17 @@ fn mir_body<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> &'tcx mir::Body<'tcx> {
} }
fn covered_code_regions<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> Vec<&'tcx CodeRegion> { fn covered_code_regions<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> Vec<&'tcx CodeRegion> {
mir_body(tcx, def_id) let body = mir_body(tcx, def_id);
.basic_blocks() body.basic_blocks()
.iter() .iter()
.map(|data| { .map(|data| {
data.statements.iter().filter_map(|statement| match statement.kind { data.statements.iter().filter_map(|statement| match statement.kind {
StatementKind::Coverage(box ref coverage) => { StatementKind::Coverage(box ref coverage) => {
coverage.code_region.as_ref() // may be None if is_inlined(body, statement) {
None
} else {
coverage.code_region.as_ref() // may be None
}
} }
_ => None, _ => None,
}) })
@ -165,3 +183,8 @@ fn covered_code_regions<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> Vec<&'tcx Cod
.flatten() .flatten()
.collect() .collect()
} }
fn is_inlined(body: &Body<'_>, statement: &Statement<'_>) -> bool {
let scope_data = &body.source_scopes[statement.source_info.scope];
scope_data.inlined.is_some() || scope_data.inlined_parent_scope.is_some()
}

View File

@ -39,15 +39,6 @@ struct CallSite<'tcx> {
/// Returns true if MIR inlining is enabled in the current compilation session. /// Returns true if MIR inlining is enabled in the current compilation session.
crate fn is_enabled(tcx: TyCtxt<'_>) -> bool { crate fn is_enabled(tcx: TyCtxt<'_>) -> bool {
if tcx.sess.opts.debugging_opts.instrument_coverage {
// Since `Inline` happens after `InstrumentCoverage`, the function-specific coverage
// counters can be invalidated, such as by merging coverage counter statements from
// a pre-inlined function into a different function. This kind of change is invalid,
// so inlining must be skipped. Note: This check is performed here so inlining can
// be disabled without preventing other optimizations (regardless of `mir_opt_level`).
return false;
}
if let Some(enabled) = tcx.sess.opts.debugging_opts.inline_mir { if let Some(enabled) = tcx.sess.opts.debugging_opts.inline_mir {
return enabled; return enabled;
} }

View File

@ -1937,25 +1937,6 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options {
} }
Some(SymbolManglingVersion::V0) => {} Some(SymbolManglingVersion::V0) => {}
} }
if let Some(mir_opt_level) = debugging_opts.mir_opt_level {
if mir_opt_level > 1 {
// Functions inlined during MIR transform can, at best, make it impossible to
// effectively cover inlined functions, and, at worst, break coverage map generation
// during LLVM codegen. For example, function counter IDs are only unique within a
// function. Inlining after these counters are injected can produce duplicate counters,
// resulting in an invalid coverage map (and ICE); so this option combination is not
// allowed.
early_warn(
error_format,
&format!(
"`-Z mir-opt-level={}` (or any level > 1) enables function inlining, which \
is incompatible with `-Z instrument-coverage`. Inlining will be disabled.",
mir_opt_level,
),
);
}
}
} }
if let Ok(graphviz_font) = std::env::var("RUSTC_GRAPHVIZ_FONT") { if let Ok(graphviz_font) = std::env::var("RUSTC_GRAPHVIZ_FONT") {

View File

@ -82,13 +82,13 @@ endif
%: $(SOURCEDIR)/lib/%.rs %: $(SOURCEDIR)/lib/%.rs
# Compile the test library with coverage instrumentation # Compile the test library with coverage instrumentation
$(RUSTC) $(SOURCEDIR)/lib/$@.rs \ $(RUSTC) $(SOURCEDIR)/lib/$@.rs \
$$( grep -q '^\/\/ require-rust-edition-2018' $(SOURCEDIR)/lib/$@.rs && echo "--edition=2018" ) \ $$( sed -nE 's#^// compile-flags:(.*)#\1# p' $(SOURCEDIR)/lib/$@.rs) \
--crate-type rlib -Zinstrument-coverage --crate-type rlib -Zinstrument-coverage
%: $(SOURCEDIR)/%.rs %: $(SOURCEDIR)/%.rs
# Compile the test program with coverage instrumentation # Compile the test program with coverage instrumentation
$(RUSTC) $(SOURCEDIR)/$@.rs \ $(RUSTC) $(SOURCEDIR)/$@.rs \
$$( grep -q '^\/\/ require-rust-edition-2018' $(SOURCEDIR)/$@.rs && echo "--edition=2018" ) \ $$( sed -nE 's#^// compile-flags:(.*)#\1# p' $(SOURCEDIR)/$@.rs) \
-L "$(TMPDIR)" -Zinstrument-coverage -L "$(TMPDIR)" -Zinstrument-coverage
# Run it in order to generate some profiling data, # Run it in order to generate some profiling data,
@ -107,7 +107,7 @@ endif
# Run it through rustdoc as well to cover doctests # Run it through rustdoc as well to cover doctests
LLVM_PROFILE_FILE="$(TMPDIR)"/$@-%p.profraw \ LLVM_PROFILE_FILE="$(TMPDIR)"/$@-%p.profraw \
$(RUSTDOC) --crate-name workaround_for_79771 --test $(SOURCEDIR)/$@.rs \ $(RUSTDOC) --crate-name workaround_for_79771 --test $(SOURCEDIR)/$@.rs \
$$( grep -q '^\/\/ require-rust-edition-2018' $(SOURCEDIR)/$@.rs && echo "--edition=2018" ) \ $$( sed -nE 's#^// compile-flags:(.*)#\1# p' $(SOURCEDIR)/$@.rs) \
-L "$(TMPDIR)" -Zinstrument-coverage \ -L "$(TMPDIR)" -Zinstrument-coverage \
-Z unstable-options --persist-doctests=$(TMPDIR)/rustdoc-$@ -Z unstable-options --persist-doctests=$(TMPDIR)/rustdoc-$@

View File

@ -1,6 +1,6 @@
1| |#![allow(unused_assignments, dead_code)] 1| |#![allow(unused_assignments, dead_code)]
2| | 2| |
3| |// require-rust-edition-2018 3| |// compile-flags: --edition=2018
4| | 4| |
5| 1|async fn c(x: u8) -> u8 { 5| 1|async fn c(x: u8) -> u8 {
6| 1| if x == 8 { 6| 1| if x == 8 {

View File

@ -0,0 +1,53 @@
1| |// compile-flags: -Zinline-mir
2| |
3| |use std::fmt::Display;
4| |
5| 1|fn main() {
6| 1| permutations(&['a', 'b', 'c']);
7| 1|}
8| |
9| |#[inline(always)]
10| 1|fn permutations<T: Copy + Display>(xs: &[T]) {
11| 1| let mut ys = xs.to_owned();
12| 1| permutate(&mut ys, 0);
13| 1|}
14| |
15| 16|fn permutate<T: Copy + Display>(xs: &mut [T], k: usize) {
16| 16| let n = length(xs);
17| 16| if k == n {
18| 6| display(xs);
19| 10| } else if k < n {
20| 15| for i in k..n {
^10
21| 15| swap(xs, i, k);
22| 15| permutate(xs, k + 1);
23| 15| swap(xs, i, k);
24| 15| }
25| 0| } else {
26| 0| error();
27| 0| }
28| 16|}
29| |
30| 16|fn length<T>(xs: &[T]) -> usize {
31| 16| xs.len()
32| 16|}
33| |
34| |#[inline]
35| 30|fn swap<T: Copy>(xs: &mut [T], i: usize, j: usize) {
36| 30| let t = xs[i];
37| 30| xs[i] = xs[j];
38| 30| xs[j] = t;
39| 30|}
40| |
41| 6|fn display<T: Display>(xs: &[T]) {
42| 18| for x in xs {
43| 18| print!("{}", x);
44| 18| }
45| 6| println!();
46| 6|}
47| |
48| |#[inline(always)]
49| |fn error() {
50| | panic!("error");
51| |}

View File

@ -19,12 +19,12 @@
18| 2| println!("used_only_from_bin_crate_generic_function with {:?}", arg); 18| 2| println!("used_only_from_bin_crate_generic_function with {:?}", arg);
19| 2|} 19| 2|}
------------------ ------------------
| used_crate::used_only_from_bin_crate_generic_function::<&str>: | used_crate::used_only_from_bin_crate_generic_function::<&alloc::vec::Vec<i32>>:
| 17| 1|pub fn used_only_from_bin_crate_generic_function<T: Debug>(arg: T) { | 17| 1|pub fn used_only_from_bin_crate_generic_function<T: Debug>(arg: T) {
| 18| 1| println!("used_only_from_bin_crate_generic_function with {:?}", arg); | 18| 1| println!("used_only_from_bin_crate_generic_function with {:?}", arg);
| 19| 1|} | 19| 1|}
------------------ ------------------
| used_crate::used_only_from_bin_crate_generic_function::<&alloc::vec::Vec<i32>>: | used_crate::used_only_from_bin_crate_generic_function::<&str>:
| 17| 1|pub fn used_only_from_bin_crate_generic_function<T: Debug>(arg: T) { | 17| 1|pub fn used_only_from_bin_crate_generic_function<T: Debug>(arg: T) {
| 18| 1| println!("used_only_from_bin_crate_generic_function with {:?}", arg); | 18| 1| println!("used_only_from_bin_crate_generic_function with {:?}", arg);
| 19| 1|} | 19| 1|}

View File

@ -38,9 +38,7 @@ endif
%: $(SOURCEDIR)/lib/%.rs %: $(SOURCEDIR)/lib/%.rs
# Compile the test library with coverage instrumentation # Compile the test library with coverage instrumentation
$(RUSTC) $(SOURCEDIR)/lib/$@.rs \ $(RUSTC) $(SOURCEDIR)/lib/$@.rs \
$$( grep -q '^\/\/ require-rust-edition-2018' $(SOURCEDIR)/lib/$@.rs && \ $$( sed -nE 's#^// compile-flags:(.*)#\1# p' $(SOURCEDIR)/lib/$@.rs) \
echo "--edition=2018" \
) \
--crate-type rlib \ --crate-type rlib \
-Ztrim-diagnostic-paths=no \ -Ztrim-diagnostic-paths=no \
-Zinstrument-coverage \ -Zinstrument-coverage \
@ -70,9 +68,7 @@ endif
%: $(SOURCEDIR)/%.rs %: $(SOURCEDIR)/%.rs
# Compile the test program with coverage instrumentation # Compile the test program with coverage instrumentation
$(RUSTC) $(SOURCEDIR)/$@.rs \ $(RUSTC) $(SOURCEDIR)/$@.rs \
$$( grep -q '^\/\/ require-rust-edition-2018' $(SOURCEDIR)/$@.rs && \ $$( sed -nE 's#^// compile-flags:(.*)#\1# p' $(SOURCEDIR)/$@.rs) \
echo "--edition=2018" \
) \
-L "$(TMPDIR)" \ -L "$(TMPDIR)" \
-Ztrim-diagnostic-paths=no \ -Ztrim-diagnostic-paths=no \
-Zinstrument-coverage \ -Zinstrument-coverage \

View File

@ -0,0 +1,161 @@
<!DOCTYPE html>
<!--
Preview this file as rendered HTML from the github source at:
https://htmlpreview.github.io/?https://github.com/rust-lang/rust/blob/master/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.inline/inline.display.-------.InstrumentCoverage.0.html
For revisions in Pull Requests (PR):
* Replace "rust-lang" with the github PR author
* Replace "master" with the PR branch name
-->
<html>
<head>
<title>inline.display - 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 40"><span class="line"><span><span class="code even" style="--layer: 1"><span class="annotation">@0,1⦊</span>fn display&lt;T: Display&gt;(xs: &amp;[T]) <span class="annotation">⦉@0,1</span></span></span><span class="code" style="--layer: 0">{</span></span>
<span class="line"><span class="code" style="--layer: 0"> for </span><span><span class="code odd" style="--layer: 1" title="42:9-42:10: @8[1]: _13 = ((_9 as Some).0: &amp;T)
42:9-42:10: @8[3]: _14 = _13
42:9-42:10: @8[4]: _7 = move _14
42:9-42:10: @8[5]: _8 = const ()
42:9-42:10: @8[13]: FakeRead(ForLet, _16)"><span class="annotation">@6,8,9,10,11⦊</span>x<span class="annotation">⦉@6,8,9,10,11</span></span></span><span class="code" style="--layer: 0"> in </span><span><span class="code odd" style="--layer: 1" title="42:14-42:16: @8[12]: _16 = _7
43:16-43:20: @8[20]: _47 = const display::&lt;T&gt;::promoted[2]
43:16-43:20: @8[21]: _22 = &amp;(*_47)
43:16-43:20: @8[22]: _21 = &amp;(*_22)
43:16-43:20: @8[23]: _20 = move _21 as &amp;[&amp;str] (Pointer(Unsize))
43:22-43:23: @8[31]: _29 = &amp;_16
43:9-43:25: @8[32]: _28 = (move _29,)
43:9-43:25: @8[34]: FakeRead(ForMatchedPlace, _28)
43:9-43:25: @8[36]: _30 = (_28.0: &amp;&amp;T)
43:9-43:25: @8[39]: _32 = &amp;(*_30)
43:9-43:25: @8[41]: _33 = &lt;&amp;T as std::fmt::Display&gt;::fmt as for&lt;&#39;r, &#39;s, &#39;t0&gt; fn(&amp;&#39;r &amp;T, &amp;&#39;s mut std::fmt::Formatter&lt;&#39;t0&gt;) -&gt; std::result::Result&lt;(), std::fmt::Error&gt; (Pointer(ReifyFnPointer))
43:9-43:25: @8.Call: _31 = std::fmt::ArgumentV1::new::&lt;&amp;T&gt;(move _32, move _33) -&gt; [return: bb9, unwind: bb14]
43:9-43:25: @9[2]: _27 = [move _31]
43:9-43:25: @9[5]: _26 = &amp;_27
43:9-43:25: @9[6]: _25 = &amp;(*_26)
43:9-43:25: @9[7]: _24 = move _25 as &amp;[std::fmt::ArgumentV1] (Pointer(Unsize))
43:9-43:25: @9.Call: _19 = std::fmt::Arguments::new_v1(move _20, move _24) -&gt; [return: bb10, unwind: bb14]
43:9-43:25: @10.Call: _18 = std::io::_print(move _19) -&gt; [return: bb11, unwind: bb14]
42:17-44:6: @11[6]: _17 = const ()"><span class="annotation">@6,8,9,10,11⦊</span>xs {</span></span>
<span class="line"><span class="code odd" style="--layer: 1" title="42:14-42:16: @8[12]: _16 = _7
43:16-43:20: @8[20]: _47 = const display::&lt;T&gt;::promoted[2]
43:16-43:20: @8[21]: _22 = &amp;(*_47)
43:16-43:20: @8[22]: _21 = &amp;(*_22)
43:16-43:20: @8[23]: _20 = move _21 as &amp;[&amp;str] (Pointer(Unsize))
43:22-43:23: @8[31]: _29 = &amp;_16
43:9-43:25: @8[32]: _28 = (move _29,)
43:9-43:25: @8[34]: FakeRead(ForMatchedPlace, _28)
43:9-43:25: @8[36]: _30 = (_28.0: &amp;&amp;T)
43:9-43:25: @8[39]: _32 = &amp;(*_30)
43:9-43:25: @8[41]: _33 = &lt;&amp;T as std::fmt::Display&gt;::fmt as for&lt;&#39;r, &#39;s, &#39;t0&gt; fn(&amp;&#39;r &amp;T, &amp;&#39;s mut std::fmt::Formatter&lt;&#39;t0&gt;) -&gt; std::result::Result&lt;(), std::fmt::Error&gt; (Pointer(ReifyFnPointer))
43:9-43:25: @8.Call: _31 = std::fmt::ArgumentV1::new::&lt;&amp;T&gt;(move _32, move _33) -&gt; [return: bb9, unwind: bb14]
43:9-43:25: @9[2]: _27 = [move _31]
43:9-43:25: @9[5]: _26 = &amp;_27
43:9-43:25: @9[6]: _25 = &amp;(*_26)
43:9-43:25: @9[7]: _24 = move _25 as &amp;[std::fmt::ArgumentV1] (Pointer(Unsize))
43:9-43:25: @9.Call: _19 = std::fmt::Arguments::new_v1(move _20, move _24) -&gt; [return: bb10, unwind: bb14]
43:9-43:25: @10.Call: _18 = std::io::_print(move _19) -&gt; [return: bb11, unwind: bb14]
42:17-44:6: @11[6]: _17 = const ()"> print!("{}", x);</span></span>
<span class="line"><span class="code odd" style="--layer: 1" title="42:14-42:16: @8[12]: _16 = _7
43:16-43:20: @8[20]: _47 = const display::&lt;T&gt;::promoted[2]
43:16-43:20: @8[21]: _22 = &amp;(*_47)
43:16-43:20: @8[22]: _21 = &amp;(*_22)
43:16-43:20: @8[23]: _20 = move _21 as &amp;[&amp;str] (Pointer(Unsize))
43:22-43:23: @8[31]: _29 = &amp;_16
43:9-43:25: @8[32]: _28 = (move _29,)
43:9-43:25: @8[34]: FakeRead(ForMatchedPlace, _28)
43:9-43:25: @8[36]: _30 = (_28.0: &amp;&amp;T)
43:9-43:25: @8[39]: _32 = &amp;(*_30)
43:9-43:25: @8[41]: _33 = &lt;&amp;T as std::fmt::Display&gt;::fmt as for&lt;&#39;r, &#39;s, &#39;t0&gt; fn(&amp;&#39;r &amp;T, &amp;&#39;s mut std::fmt::Formatter&lt;&#39;t0&gt;) -&gt; std::result::Result&lt;(), std::fmt::Error&gt; (Pointer(ReifyFnPointer))
43:9-43:25: @8.Call: _31 = std::fmt::ArgumentV1::new::&lt;&amp;T&gt;(move _32, move _33) -&gt; [return: bb9, unwind: bb14]
43:9-43:25: @9[2]: _27 = [move _31]
43:9-43:25: @9[5]: _26 = &amp;_27
43:9-43:25: @9[6]: _25 = &amp;(*_26)
43:9-43:25: @9[7]: _24 = move _25 as &amp;[std::fmt::ArgumentV1] (Pointer(Unsize))
43:9-43:25: @9.Call: _19 = std::fmt::Arguments::new_v1(move _20, move _24) -&gt; [return: bb10, unwind: bb14]
43:9-43:25: @10.Call: _18 = std::io::_print(move _19) -&gt; [return: bb11, unwind: bb14]
42:17-44:6: @11[6]: _17 = const ()"> }<span class="annotation">⦉@6,8,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 even" style="--layer: 1" title="45:5-45:16: @5[13]: _46 = const display::&lt;T&gt;::promoted[1]
45:5-45:16: @5[14]: _38 = &amp;(*_46)
45:5-45:16: @5[15]: _37 = &amp;(*_38)
45:5-45:16: @5[16]: _36 = move _37 as &amp;[&amp;str] (Pointer(Unsize))
45:5-45:16: @5[22]: _44 = ()
45:5-45:16: @5[23]: FakeRead(ForMatchedPlace, _44)
45:5-45:16: @5[24]: _45 = const display::&lt;T&gt;::promoted[0]
45:5-45:16: @5[25]: _42 = &amp;(*_45)
45:5-45:16: @5[26]: _41 = &amp;(*_42)
45:5-45:16: @5[27]: _40 = move _41 as &amp;[std::fmt::ArgumentV1] (Pointer(Unsize))
45:5-45:16: @5.Call: _35 = std::fmt::Arguments::new_v1(move _36, move _40) -&gt; [return: bb12, unwind: bb14]
45:5-45:16: @12.Call: _34 = std::io::_print(move _35) -&gt; [return: bb13, unwind: bb14]
46:2-46:2: @13.Return: return"><span class="annotation">@5,12,13⦊</span>println!();</span></span>
<span class="line"><span class="code even" style="--layer: 1" title="45:5-45:16: @5[13]: _46 = const display::&lt;T&gt;::promoted[1]
45:5-45:16: @5[14]: _38 = &amp;(*_46)
45:5-45:16: @5[15]: _37 = &amp;(*_38)
45:5-45:16: @5[16]: _36 = move _37 as &amp;[&amp;str] (Pointer(Unsize))
45:5-45:16: @5[22]: _44 = ()
45:5-45:16: @5[23]: FakeRead(ForMatchedPlace, _44)
45:5-45:16: @5[24]: _45 = const display::&lt;T&gt;::promoted[0]
45:5-45:16: @5[25]: _42 = &amp;(*_45)
45:5-45:16: @5[26]: _41 = &amp;(*_42)
45:5-45:16: @5[27]: _40 = move _41 as &amp;[std::fmt::ArgumentV1] (Pointer(Unsize))
45:5-45:16: @5.Call: _35 = std::fmt::Arguments::new_v1(move _36, move _40) -&gt; [return: bb12, unwind: bb14]
45:5-45:16: @12.Call: _34 = std::io::_print(move _35) -&gt; [return: bb13, unwind: bb14]
46:2-46:2: @13.Return: return">}<span class="annotation">⦉@5,12,13</span></span></span></span></div>
</body>
</html>

View File

@ -0,0 +1,79 @@
<!DOCTYPE html>
<!--
Preview this file as rendered HTML from the github source at:
https://htmlpreview.github.io/?https://github.com/rust-lang/rust/blob/master/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.inline/inline.error.-------.InstrumentCoverage.0.html
For revisions in Pull Requests (PR):
* Replace "rust-lang" with the github PR author
* Replace "master" with the PR branch name
-->
<html>
<head>
<title>inline.error - 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 48"><span class="line"><span><span class="code even" style="--layer: 1" title="50:5-50:21: @0.Call: std::rt::begin_panic::&lt;&amp;str&gt;(const &quot;error&quot;) -&gt; bb1
49:12-51:2: @1.Resume: resume"><span class="annotation">@0,1⦊</span>fn error() {</span></span>
<span class="line"><span class="code even" style="--layer: 1" title="50:5-50:21: @0.Call: std::rt::begin_panic::&lt;&amp;str&gt;(const &quot;error&quot;) -&gt; bb1
49:12-51:2: @1.Resume: resume"> panic!("error");</span></span>
<span class="line"><span class="code even" style="--layer: 1" title="50:5-50:21: @0.Call: std::rt::begin_panic::&lt;&amp;str&gt;(const &quot;error&quot;) -&gt; bb1
49:12-51:2: @1.Resume: resume">}<span class="annotation">⦉@0,1</span></span></span></span></div>
</body>
</html>

View File

@ -0,0 +1,82 @@
<!DOCTYPE html>
<!--
Preview this file as rendered HTML from the github source at:
https://htmlpreview.github.io/?https://github.com/rust-lang/rust/blob/master/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.inline/inline.length.-------.InstrumentCoverage.0.html
For revisions in Pull Requests (PR):
* Replace "rust-lang" with the github PR author
* Replace "master" with the PR branch name
-->
<html>
<head>
<title>inline.length - 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 29"><span class="line"><span><span class="code even" style="--layer: 1" title="31:5-31:7: @0[1]: _2 = &amp;(*_1)
31:5-31:13: @0.Call: _0 = core::slice::&lt;impl [T]&gt;::len(move _2) -&gt; [return: bb1, unwind: bb2]
32:2-32:2: @1.Return: return"><span class="annotation">@0,1⦊</span>fn length&lt;T&gt;(xs: &amp;[T]) -&gt; usize {</span></span>
<span class="line"><span class="code even" style="--layer: 1" title="31:5-31:7: @0[1]: _2 = &amp;(*_1)
31:5-31:13: @0.Call: _0 = core::slice::&lt;impl [T]&gt;::len(move _2) -&gt; [return: bb1, unwind: bb2]
32:2-32:2: @1.Return: return"> xs.len()</span></span>
<span class="line"><span class="code even" style="--layer: 1" title="31:5-31:7: @0[1]: _2 = &amp;(*_1)
31:5-31:13: @0.Call: _0 = core::slice::&lt;impl [T]&gt;::len(move _2) -&gt; [return: bb1, unwind: bb2]
32:2-32:2: @1.Return: return">}<span class="annotation">⦉@0,1</span></span></span></span></div>
</body>
</html>

View File

@ -0,0 +1,94 @@
<!DOCTYPE html>
<!--
Preview this file as rendered HTML from the github source at:
https://htmlpreview.github.io/?https://github.com/rust-lang/rust/blob/master/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.inline/inline.main.-------.InstrumentCoverage.0.html
For revisions in Pull Requests (PR):
* Replace "rust-lang" with the github PR author
* Replace "master" with the PR branch name
-->
<html>
<head>
<title>inline.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 4"><span class="line"><span><span class="code even" style="--layer: 1" title="6:18-6:34: @0[4]: _6 = const main::promoted[0]
6:18-6:34: @0[5]: _4 = &amp;(*_6)
6:18-6:34: @0[6]: _3 = &amp;(*_4)
6:18-6:34: @0[7]: _2 = move _3 as &amp;[char] (Pointer(Unsize))
6:5-6:35: @0.Call: _1 = permutations::&lt;char&gt;(move _2) -&gt; [return: bb1, unwind: bb2]
5:11-7:2: @1[3]: _0 = const ()
7:2-7:2: @1.Return: return"><span class="annotation">@0,1⦊</span>fn main() {</span></span>
<span class="line"><span class="code even" style="--layer: 1" title="6:18-6:34: @0[4]: _6 = const main::promoted[0]
6:18-6:34: @0[5]: _4 = &amp;(*_6)
6:18-6:34: @0[6]: _3 = &amp;(*_4)
6:18-6:34: @0[7]: _2 = move _3 as &amp;[char] (Pointer(Unsize))
6:5-6:35: @0.Call: _1 = permutations::&lt;char&gt;(move _2) -&gt; [return: bb1, unwind: bb2]
5:11-7:2: @1[3]: _0 = const ()
7:2-7:2: @1.Return: return"> permutations(&amp;['a', 'b', 'c']);</span></span>
<span class="line"><span class="code even" style="--layer: 1" title="6:18-6:34: @0[4]: _6 = const main::promoted[0]
6:18-6:34: @0[5]: _4 = &amp;(*_6)
6:18-6:34: @0[6]: _3 = &amp;(*_4)
6:18-6:34: @0[7]: _2 = move _3 as &amp;[char] (Pointer(Unsize))
6:5-6:35: @0.Call: _1 = permutations::&lt;char&gt;(move _2) -&gt; [return: bb1, unwind: bb2]
5:11-7:2: @1[3]: _0 = const ()
7:2-7:2: @1.Return: return">}<span class="annotation">⦉@0,1</span></span></span></span></div>
</body>
</html>

View File

@ -0,0 +1,183 @@
<!DOCTYPE html>
<!--
Preview this file as rendered HTML from the github source at:
https://htmlpreview.github.io/?https://github.com/rust-lang/rust/blob/master/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.inline/inline.permutate.-------.InstrumentCoverage.0.html
For revisions in Pull Requests (PR):
* Replace "rust-lang" with the github PR author
* Replace "master" with the PR branch name
-->
<html>
<head>
<title>inline.permutate - 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 14"><span class="line"><span><span class="code even" style="--layer: 1" title="16:20-16:22: @0[2]: _4 = &amp;(*_1)
16:13-16:23: @0.Call: _3 = length::&lt;T&gt;(move _4) -&gt; [return: bb1, unwind: bb22]
16:9-16:10: @1[1]: FakeRead(ForLet, _3)
17:8-17:9: @1[4]: _6 = _2
17:13-17:14: @1[6]: _7 = _3
17:8-17:14: @1[7]: _5 = Eq(move _6, move _7)"><span class="annotation">@0,1⦊</span>fn permutate&lt;T: Copy + Display&gt;(xs: &amp;mut [T], k: usize) {</span></span>
<span class="line"><span class="code even" style="--layer: 1" title="16:20-16:22: @0[2]: _4 = &amp;(*_1)
16:13-16:23: @0.Call: _3 = length::&lt;T&gt;(move _4) -&gt; [return: bb1, unwind: bb22]
16:9-16:10: @1[1]: FakeRead(ForLet, _3)
17:8-17:9: @1[4]: _6 = _2
17:13-17:14: @1[6]: _7 = _3
17:8-17:14: @1[7]: _5 = Eq(move _6, move _7)"> let n = length(xs);</span></span>
<span class="line"><span class="code even" style="--layer: 1" title="16:20-16:22: @0[2]: _4 = &amp;(*_1)
16:13-16:23: @0.Call: _3 = length::&lt;T&gt;(move _4) -&gt; [return: bb1, unwind: bb22]
16:9-16:10: @1[1]: FakeRead(ForLet, _3)
17:8-17:9: @1[4]: _6 = _2
17:13-17:14: @1[6]: _7 = _3
17:8-17:14: @1[7]: _5 = Eq(move _6, move _7)"> if k == n<span class="annotation">⦉@0,1</span></span></span><span class="code" style="--layer: 0"> </span><span><span class="code odd" style="--layer: 1" title="18:17-18:19: @2[2]: _9 = &amp;(*_1)
18:9-18:20: @2.Call: _8 = display::&lt;T&gt;(move _9) -&gt; [return: bb4, unwind: bb22]
17:15-19:6: @4[2]: _0 = const ()"><span class="annotation">@2,4⦊</span>{</span></span>
<span class="line"><span class="code odd" style="--layer: 1" title="18:17-18:19: @2[2]: _9 = &amp;(*_1)
18:9-18:20: @2.Call: _8 = display::&lt;T&gt;(move _9) -&gt; [return: bb4, unwind: bb22]
17:15-19:6: @4[2]: _0 = const ()"> display(xs);</span></span>
<span class="line"><span class="code odd" style="--layer: 1" title="18:17-18:19: @2[2]: _9 = &amp;(*_1)
18:9-18:20: @2.Call: _8 = display::&lt;T&gt;(move _9) -&gt; [return: bb4, unwind: bb22]
17:15-19:6: @4[2]: _0 = const ()"> }<span class="annotation">⦉@2,4</span></span></span><span class="code" style="--layer: 0"> else if </span><span><span class="code even" style="--layer: 1" title="19:15-19:16: @3[2]: _11 = _2
19:19-19:20: @3[4]: _12 = _3
19:15-19:20: @3[5]: _10 = Lt(move _11, move _12)"><span class="annotation">@3⦊</span>k &lt; n<span class="annotation">⦉@3</span></span></span><span class="code" style="--layer: 0"> {</span></span>
<span class="line"><span class="code" style="--layer: 0"> for </span><span><span class="code odd" style="--layer: 1" title="20:13-20:14: @14[1]: _25 = ((_21 as Some).0: usize)
20:13-20:14: @14[3]: _26 = _25
20:13-20:14: @14[4]: _19 = move _26
20:13-20:14: @14[5]: _20 = const ()
20:13-20:14: @14[13]: FakeRead(ForLet, _28)"><span class="annotation">@12,14,15,16,17,18⦊</span>i<span class="annotation">⦉@12,14,15,16,17,18</span></span></span><span class="code" style="--layer: 0"> in </span><span><span class="code even" style="--layer: 1" title="20:18-20:19: @5[3]: _15 = _2
20:21-20:22: @5[5]: _16 = _3"><span class="annotation">@5,7⦊</span>k..n<span class="annotation">⦉@5,7</span></span></span><span class="code" style="--layer: 0"> </span><span><span class="code odd" style="--layer: 1" title="21:18-21:20: @14[17]: _31 = &amp;mut (*_1)
21:22-21:23: @14[19]: _32 = _28
21:25-21:26: @14[21]: _33 = _2
21:13-21:27: @14.Call: _30 = swap::&lt;T&gt;(move _31, move _32, move _33) -&gt; [return: bb15, unwind: bb22]
22:23-22:25: @15[6]: _35 = &amp;mut (*_1)
22:27-22:28: @15[9]: _37 = _2
22:27-22:32: @15[10]: _38 = CheckedAdd(_37, const 1_usize)
22:27-22:32: @16[0]: _36 = move (_38.0: usize)
22:13-22:33: @16.Call: _34 = permutate::&lt;T&gt;(move _35, move _36) -&gt; [return: bb17, unwind: bb22]
23:18-23:20: @17[5]: _40 = &amp;mut (*_1)
23:22-23:23: @17[7]: _41 = _28
23:25-23:26: @17[9]: _42 = _2
23:13-23:27: @17.Call: _39 = swap::&lt;T&gt;(move _40, move _41, move _42) -&gt; [return: bb18, unwind: bb22]
20:23-24:10: @18[4]: _29 = const ()"><span class="annotation">@12,14,15,16,17,18⦊</span>{</span></span>
<span class="line"><span class="code odd" style="--layer: 1" title="21:18-21:20: @14[17]: _31 = &amp;mut (*_1)
21:22-21:23: @14[19]: _32 = _28
21:25-21:26: @14[21]: _33 = _2
21:13-21:27: @14.Call: _30 = swap::&lt;T&gt;(move _31, move _32, move _33) -&gt; [return: bb15, unwind: bb22]
22:23-22:25: @15[6]: _35 = &amp;mut (*_1)
22:27-22:28: @15[9]: _37 = _2
22:27-22:32: @15[10]: _38 = CheckedAdd(_37, const 1_usize)
22:27-22:32: @16[0]: _36 = move (_38.0: usize)
22:13-22:33: @16.Call: _34 = permutate::&lt;T&gt;(move _35, move _36) -&gt; [return: bb17, unwind: bb22]
23:18-23:20: @17[5]: _40 = &amp;mut (*_1)
23:22-23:23: @17[7]: _41 = _28
23:25-23:26: @17[9]: _42 = _2
23:13-23:27: @17.Call: _39 = swap::&lt;T&gt;(move _40, move _41, move _42) -&gt; [return: bb18, unwind: bb22]
20:23-24:10: @18[4]: _29 = const ()"> swap(xs, i, k);</span></span>
<span class="line"><span class="code odd" style="--layer: 1" title="21:18-21:20: @14[17]: _31 = &amp;mut (*_1)
21:22-21:23: @14[19]: _32 = _28
21:25-21:26: @14[21]: _33 = _2
21:13-21:27: @14.Call: _30 = swap::&lt;T&gt;(move _31, move _32, move _33) -&gt; [return: bb15, unwind: bb22]
22:23-22:25: @15[6]: _35 = &amp;mut (*_1)
22:27-22:28: @15[9]: _37 = _2
22:27-22:32: @15[10]: _38 = CheckedAdd(_37, const 1_usize)
22:27-22:32: @16[0]: _36 = move (_38.0: usize)
22:13-22:33: @16.Call: _34 = permutate::&lt;T&gt;(move _35, move _36) -&gt; [return: bb17, unwind: bb22]
23:18-23:20: @17[5]: _40 = &amp;mut (*_1)
23:22-23:23: @17[7]: _41 = _28
23:25-23:26: @17[9]: _42 = _2
23:13-23:27: @17.Call: _39 = swap::&lt;T&gt;(move _40, move _41, move _42) -&gt; [return: bb18, unwind: bb22]
20:23-24:10: @18[4]: _29 = const ()"> permutate(xs, k + 1);</span></span>
<span class="line"><span class="code odd" style="--layer: 1" title="21:18-21:20: @14[17]: _31 = &amp;mut (*_1)
21:22-21:23: @14[19]: _32 = _28
21:25-21:26: @14[21]: _33 = _2
21:13-21:27: @14.Call: _30 = swap::&lt;T&gt;(move _31, move _32, move _33) -&gt; [return: bb15, unwind: bb22]
22:23-22:25: @15[6]: _35 = &amp;mut (*_1)
22:27-22:28: @15[9]: _37 = _2
22:27-22:32: @15[10]: _38 = CheckedAdd(_37, const 1_usize)
22:27-22:32: @16[0]: _36 = move (_38.0: usize)
22:13-22:33: @16.Call: _34 = permutate::&lt;T&gt;(move _35, move _36) -&gt; [return: bb17, unwind: bb22]
23:18-23:20: @17[5]: _40 = &amp;mut (*_1)
23:22-23:23: @17[7]: _41 = _28
23:25-23:26: @17[9]: _42 = _2
23:13-23:27: @17.Call: _39 = swap::&lt;T&gt;(move _40, move _41, move _42) -&gt; [return: bb18, unwind: bb22]
20:23-24:10: @18[4]: _29 = const ()"> swap(xs, i, k);</span></span>
<span class="line"><span class="code odd" style="--layer: 1" title="21:18-21:20: @14[17]: _31 = &amp;mut (*_1)
21:22-21:23: @14[19]: _32 = _28
21:25-21:26: @14[21]: _33 = _2
21:13-21:27: @14.Call: _30 = swap::&lt;T&gt;(move _31, move _32, move _33) -&gt; [return: bb15, unwind: bb22]
22:23-22:25: @15[6]: _35 = &amp;mut (*_1)
22:27-22:28: @15[9]: _37 = _2
22:27-22:32: @15[10]: _38 = CheckedAdd(_37, const 1_usize)
22:27-22:32: @16[0]: _36 = move (_38.0: usize)
22:13-22:33: @16.Call: _34 = permutate::&lt;T&gt;(move _35, move _36) -&gt; [return: bb17, unwind: bb22]
23:18-23:20: @17[5]: _40 = &amp;mut (*_1)
23:22-23:23: @17[7]: _41 = _28
23:25-23:26: @17[9]: _42 = _2
23:13-23:27: @17.Call: _39 = swap::&lt;T&gt;(move _40, move _41, move _42) -&gt; [return: bb18, unwind: bb22]
20:23-24:10: @18[4]: _29 = const ()"> }<span class="annotation">⦉@12,14,15,16,17,18</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="code even" style="--layer: 1" title="26:9-26:16: @6.Call: _43 = error() -&gt; [return: bb19, unwind: bb22]
25:12-27:6: @19[1]: _0 = const ()"><span class="annotation">@6,19⦊</span>{</span></span>
<span class="line"><span class="code even" style="--layer: 1" title="26:9-26:16: @6.Call: _43 = error() -&gt; [return: bb19, unwind: bb22]
25:12-27:6: @19[1]: _0 = const ()"> error();</span></span>
<span class="line"><span class="code even" style="--layer: 1" title="26:9-26:16: @6.Call: _43 = error() -&gt; [return: bb19, unwind: bb22]
25:12-27:6: @19[1]: _0 = const ()"> }<span class="annotation">⦉@6,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="code odd" style="--layer: 1" title="28:2-28:2: @21.Return: return"><span class="annotation">@21⦊</span><span class="annotation">⦉@21</span></span></span></span></div>
</body>
</html>

View File

@ -0,0 +1,113 @@
<!DOCTYPE html>
<!--
Preview this file as rendered HTML from the github source at:
https://htmlpreview.github.io/?https://github.com/rust-lang/rust/blob/master/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.inline/inline.permutations.-------.InstrumentCoverage.0.html
For revisions in Pull Requests (PR):
* Replace "rust-lang" with the github PR author
* Replace "master" with the PR branch name
-->
<html>
<head>
<title>inline.permutations - 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 9"><span class="line"><span><span class="code even" style="--layer: 1" title="11:18-11:20: @0[2]: _3 = &amp;(*_1)
11:18-11:31: @0.Call: _2 = &lt;[T] as std::borrow::ToOwned&gt;::to_owned(move _3) -&gt; [return: bb1, unwind: bb6]
11:9-11:15: @1[1]: FakeRead(ForLet, _2)
12:15-12:22: @1[7]: _8 = &amp;mut _2
12:15-12:22: @1[8]: _7 = &amp;mut (*_8)
12:15-12:22: @1.Call: _6 = &lt;std::vec::Vec&lt;T&gt; as std::ops::DerefMut&gt;::deref_mut(move _7) -&gt; [return: bb2, unwind: bb5]
12:15-12:22: @2[0]: _5 = &amp;mut (*_6)
12:5-12:26: @2.Call: _4 = permutate::&lt;T&gt;(move _5, const 0_usize) -&gt; [return: bb3, unwind: bb5]
10:46-13:2: @3[4]: _0 = const ()
13:2-13:2: @4.Return: return"><span class="annotation">@0,1,2,3,4⦊</span>fn permutations&lt;T: Copy + Display&gt;(xs: &amp;[T]) {</span></span>
<span class="line"><span class="code even" style="--layer: 1" title="11:18-11:20: @0[2]: _3 = &amp;(*_1)
11:18-11:31: @0.Call: _2 = &lt;[T] as std::borrow::ToOwned&gt;::to_owned(move _3) -&gt; [return: bb1, unwind: bb6]
11:9-11:15: @1[1]: FakeRead(ForLet, _2)
12:15-12:22: @1[7]: _8 = &amp;mut _2
12:15-12:22: @1[8]: _7 = &amp;mut (*_8)
12:15-12:22: @1.Call: _6 = &lt;std::vec::Vec&lt;T&gt; as std::ops::DerefMut&gt;::deref_mut(move _7) -&gt; [return: bb2, unwind: bb5]
12:15-12:22: @2[0]: _5 = &amp;mut (*_6)
12:5-12:26: @2.Call: _4 = permutate::&lt;T&gt;(move _5, const 0_usize) -&gt; [return: bb3, unwind: bb5]
10:46-13:2: @3[4]: _0 = const ()
13:2-13:2: @4.Return: return"> let mut ys = xs.to_owned();</span></span>
<span class="line"><span class="code even" style="--layer: 1" title="11:18-11:20: @0[2]: _3 = &amp;(*_1)
11:18-11:31: @0.Call: _2 = &lt;[T] as std::borrow::ToOwned&gt;::to_owned(move _3) -&gt; [return: bb1, unwind: bb6]
11:9-11:15: @1[1]: FakeRead(ForLet, _2)
12:15-12:22: @1[7]: _8 = &amp;mut _2
12:15-12:22: @1[8]: _7 = &amp;mut (*_8)
12:15-12:22: @1.Call: _6 = &lt;std::vec::Vec&lt;T&gt; as std::ops::DerefMut&gt;::deref_mut(move _7) -&gt; [return: bb2, unwind: bb5]
12:15-12:22: @2[0]: _5 = &amp;mut (*_6)
12:5-12:26: @2.Call: _4 = permutate::&lt;T&gt;(move _5, const 0_usize) -&gt; [return: bb3, unwind: bb5]
10:46-13:2: @3[4]: _0 = const ()
13:2-13:2: @4.Return: return"> permutate(&amp;mut ys, 0);</span></span>
<span class="line"><span class="code even" style="--layer: 1" title="11:18-11:20: @0[2]: _3 = &amp;(*_1)
11:18-11:31: @0.Call: _2 = &lt;[T] as std::borrow::ToOwned&gt;::to_owned(move _3) -&gt; [return: bb1, unwind: bb6]
11:9-11:15: @1[1]: FakeRead(ForLet, _2)
12:15-12:22: @1[7]: _8 = &amp;mut _2
12:15-12:22: @1[8]: _7 = &amp;mut (*_8)
12:15-12:22: @1.Call: _6 = &lt;std::vec::Vec&lt;T&gt; as std::ops::DerefMut&gt;::deref_mut(move _7) -&gt; [return: bb2, unwind: bb5]
12:15-12:22: @2[0]: _5 = &amp;mut (*_6)
12:5-12:26: @2.Call: _4 = permutate::&lt;T&gt;(move _5, const 0_usize) -&gt; [return: bb3, unwind: bb5]
10:46-13:2: @3[4]: _0 = const ()
13:2-13:2: @4.Return: return">}<span class="annotation">⦉@0,1,2,3,4</span></span></span></span></div>
</body>
</html>

View File

@ -0,0 +1,173 @@
<!DOCTYPE html>
<!--
Preview this file as rendered HTML from the github source at:
https://htmlpreview.github.io/?https://github.com/rust-lang/rust/blob/master/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.inline/inline.swap.-------.InstrumentCoverage.0.html
For revisions in Pull Requests (PR):
* Replace "rust-lang" with the github PR author
* Replace "master" with the PR branch name
-->
<html>
<head>
<title>inline.swap - 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 34"><span class="line"><span><span class="code even" style="--layer: 1" title="36:16-36:17: @0[2]: _5 = _2
36:13-36:18: @0[3]: _6 = Len((*_1))
36:13-36:18: @0[4]: _7 = Lt(_5, _6)
36:13-36:18: @1[0]: _4 = (*_1)[_5]
36:9-36:10: @1[1]: FakeRead(ForLet, _4)
37:16-37:17: @1[5]: _9 = _3
37:13-37:18: @1[6]: _10 = Len((*_1))
37:13-37:18: @1[7]: _11 = Lt(_9, _10)
37:13-37:18: @2[0]: _8 = (*_1)[_9]
37:8-37:9: @2[2]: _12 = _2
37:5-37:10: @2[3]: _13 = Len((*_1))
37:5-37:10: @2[4]: _14 = Lt(_12, _13)
37:5-37:18: @3[0]: (*_1)[_12] = move _8
38:13-38:14: @3[5]: _15 = _4
38:8-38:9: @3[7]: _16 = _3
38:5-38:10: @3[8]: _17 = Len((*_1))
38:5-38:10: @3[9]: _18 = Lt(_16, _17)
38:5-38:14: @4[0]: (*_1)[_16] = move _15
35:52-39:2: @4[3]: _0 = const ()
39:2-39:2: @4.Return: return"><span class="annotation">@0,1,2,3,4⦊</span>fn swap&lt;T: Copy&gt;(xs: &amp;mut [T], i: usize, j: usize) {</span></span>
<span class="line"><span class="code even" style="--layer: 1" title="36:16-36:17: @0[2]: _5 = _2
36:13-36:18: @0[3]: _6 = Len((*_1))
36:13-36:18: @0[4]: _7 = Lt(_5, _6)
36:13-36:18: @1[0]: _4 = (*_1)[_5]
36:9-36:10: @1[1]: FakeRead(ForLet, _4)
37:16-37:17: @1[5]: _9 = _3
37:13-37:18: @1[6]: _10 = Len((*_1))
37:13-37:18: @1[7]: _11 = Lt(_9, _10)
37:13-37:18: @2[0]: _8 = (*_1)[_9]
37:8-37:9: @2[2]: _12 = _2
37:5-37:10: @2[3]: _13 = Len((*_1))
37:5-37:10: @2[4]: _14 = Lt(_12, _13)
37:5-37:18: @3[0]: (*_1)[_12] = move _8
38:13-38:14: @3[5]: _15 = _4
38:8-38:9: @3[7]: _16 = _3
38:5-38:10: @3[8]: _17 = Len((*_1))
38:5-38:10: @3[9]: _18 = Lt(_16, _17)
38:5-38:14: @4[0]: (*_1)[_16] = move _15
35:52-39:2: @4[3]: _0 = const ()
39:2-39:2: @4.Return: return"> let t = xs[i];</span></span>
<span class="line"><span class="code even" style="--layer: 1" title="36:16-36:17: @0[2]: _5 = _2
36:13-36:18: @0[3]: _6 = Len((*_1))
36:13-36:18: @0[4]: _7 = Lt(_5, _6)
36:13-36:18: @1[0]: _4 = (*_1)[_5]
36:9-36:10: @1[1]: FakeRead(ForLet, _4)
37:16-37:17: @1[5]: _9 = _3
37:13-37:18: @1[6]: _10 = Len((*_1))
37:13-37:18: @1[7]: _11 = Lt(_9, _10)
37:13-37:18: @2[0]: _8 = (*_1)[_9]
37:8-37:9: @2[2]: _12 = _2
37:5-37:10: @2[3]: _13 = Len((*_1))
37:5-37:10: @2[4]: _14 = Lt(_12, _13)
37:5-37:18: @3[0]: (*_1)[_12] = move _8
38:13-38:14: @3[5]: _15 = _4
38:8-38:9: @3[7]: _16 = _3
38:5-38:10: @3[8]: _17 = Len((*_1))
38:5-38:10: @3[9]: _18 = Lt(_16, _17)
38:5-38:14: @4[0]: (*_1)[_16] = move _15
35:52-39:2: @4[3]: _0 = const ()
39:2-39:2: @4.Return: return"> xs[i] = xs[j];</span></span>
<span class="line"><span class="code even" style="--layer: 1" title="36:16-36:17: @0[2]: _5 = _2
36:13-36:18: @0[3]: _6 = Len((*_1))
36:13-36:18: @0[4]: _7 = Lt(_5, _6)
36:13-36:18: @1[0]: _4 = (*_1)[_5]
36:9-36:10: @1[1]: FakeRead(ForLet, _4)
37:16-37:17: @1[5]: _9 = _3
37:13-37:18: @1[6]: _10 = Len((*_1))
37:13-37:18: @1[7]: _11 = Lt(_9, _10)
37:13-37:18: @2[0]: _8 = (*_1)[_9]
37:8-37:9: @2[2]: _12 = _2
37:5-37:10: @2[3]: _13 = Len((*_1))
37:5-37:10: @2[4]: _14 = Lt(_12, _13)
37:5-37:18: @3[0]: (*_1)[_12] = move _8
38:13-38:14: @3[5]: _15 = _4
38:8-38:9: @3[7]: _16 = _3
38:5-38:10: @3[8]: _17 = Len((*_1))
38:5-38:10: @3[9]: _18 = Lt(_16, _17)
38:5-38:14: @4[0]: (*_1)[_16] = move _15
35:52-39:2: @4[3]: _0 = const ()
39:2-39:2: @4.Return: return"> xs[j] = t;</span></span>
<span class="line"><span class="code even" style="--layer: 1" title="36:16-36:17: @0[2]: _5 = _2
36:13-36:18: @0[3]: _6 = Len((*_1))
36:13-36:18: @0[4]: _7 = Lt(_5, _6)
36:13-36:18: @1[0]: _4 = (*_1)[_5]
36:9-36:10: @1[1]: FakeRead(ForLet, _4)
37:16-37:17: @1[5]: _9 = _3
37:13-37:18: @1[6]: _10 = Len((*_1))
37:13-37:18: @1[7]: _11 = Lt(_9, _10)
37:13-37:18: @2[0]: _8 = (*_1)[_9]
37:8-37:9: @2[2]: _12 = _2
37:5-37:10: @2[3]: _13 = Len((*_1))
37:5-37:10: @2[4]: _14 = Lt(_12, _13)
37:5-37:18: @3[0]: (*_1)[_12] = move _8
38:13-38:14: @3[5]: _15 = _4
38:8-38:9: @3[7]: _16 = _3
38:5-38:10: @3[8]: _17 = Len((*_1))
38:5-38:10: @3[9]: _18 = Lt(_16, _17)
38:5-38:14: @4[0]: (*_1)[_16] = move _15
35:52-39:2: @4[3]: _0 = const ()
39:2-39:2: @4.Return: return">}<span class="annotation">⦉@0,1,2,3,4</span></span></span></span></div>
</body>
</html>

View File

@ -1,6 +1,6 @@
#![allow(unused_assignments, dead_code)] #![allow(unused_assignments, dead_code)]
// require-rust-edition-2018 // compile-flags: --edition=2018
async fn c(x: u8) -> u8 { async fn c(x: u8) -> u8 {
if x == 8 { if x == 8 {

View File

@ -0,0 +1,51 @@
// compile-flags: -Zinline-mir
use std::fmt::Display;
fn main() {
permutations(&['a', 'b', 'c']);
}
#[inline(always)]
fn permutations<T: Copy + Display>(xs: &[T]) {
let mut ys = xs.to_owned();
permutate(&mut ys, 0);
}
fn permutate<T: Copy + Display>(xs: &mut [T], k: usize) {
let n = length(xs);
if k == n {
display(xs);
} else if k < n {
for i in k..n {
swap(xs, i, k);
permutate(xs, k + 1);
swap(xs, i, k);
}
} else {
error();
}
}
fn length<T>(xs: &[T]) -> usize {
xs.len()
}
#[inline]
fn swap<T: Copy>(xs: &mut [T], i: usize, j: usize) {
let t = xs[i];
xs[i] = xs[j];
xs[j] = t;
}
fn display<T: Display>(xs: &[T]) {
for x in xs {
print!("{}", x);
}
println!();
}
#[inline(always)]
fn error() {
panic!("error");
}

View File

@ -1,21 +0,0 @@
// Ensures -Zmir-opt-level=3 (specifically, inlining) is not allowed with -Zinstrument-coverage.
// Regression test for issue #80060.
//
// needs-profiler-support
// build-pass
// compile-flags: -Zmir-opt-level=3 -Zinstrument-coverage
#[inline(never)]
fn foo() {}
pub fn baz() {
bar();
}
#[inline(always)]
fn bar() {
foo();
}
fn main() {
bar();
}

View File

@ -1,2 +0,0 @@
warning: `-Z mir-opt-level=3` (or any level > 1) enables function inlining, which is incompatible with `-Z instrument-coverage`. Inlining will be disabled.