Skip to content

Commit 0d84e0b

Browse files
committedMar 16, 2021
Add test case for -Zinline-mir & -Zinstrument-coverage
1 parent 4b6cc0c commit 0d84e0b

11 files changed

+992
-3
lines changed
 

‎src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.async.txt

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

‎src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.uses_crate.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@
1919
18| 2| println!("used_only_from_bin_crate_generic_function with {:?}", arg);
2020
19| 2|}
2121
------------------
22-
| used_crate::used_only_from_bin_crate_generic_function::<&str>:
22+
| used_crate::used_only_from_bin_crate_generic_function::<&alloc::vec::Vec<i32>>:
2323
| 17| 1|pub fn used_only_from_bin_crate_generic_function<T: Debug>(arg: T) {
2424
| 18| 1| println!("used_only_from_bin_crate_generic_function with {:?}", arg);
2525
| 19| 1|}
2626
------------------
27-
| used_crate::used_only_from_bin_crate_generic_function::<&alloc::vec::Vec<i32>>:
27+
| used_crate::used_only_from_bin_crate_generic_function::<&str>:
2828
| 17| 1|pub fn used_only_from_bin_crate_generic_function<T: Debug>(arg: T) {
2929
| 18| 1| println!("used_only_from_bin_crate_generic_function with {:?}", arg);
3030
| 19| 1|}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,161 @@
1+
<!DOCTYPE html>
2+
<!--
3+
4+
Preview this file as rendered HTML from the github source at:
5+
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
6+
7+
For revisions in Pull Requests (PR):
8+
* Replace "rust-lang" with the github PR author
9+
* Replace "master" with the PR branch name
10+
11+
-->
12+
<html>
13+
<head>
14+
<title>inline.display - Coverage Spans</title>
15+
<style>
16+
.line {
17+
counter-increment: line;
18+
}
19+
.line:before {
20+
content: counter(line) ": ";
21+
font-family: Menlo, Monaco, monospace;
22+
font-style: italic;
23+
width: 3.8em;
24+
display: inline-block;
25+
text-align: right;
26+
filter: opacity(50%);
27+
-webkit-user-select: none;
28+
}
29+
.code {
30+
color: #dddddd;
31+
background-color: #222222;
32+
font-family: Menlo, Monaco, monospace;
33+
line-height: 1.4em;
34+
border-bottom: 2px solid #222222;
35+
white-space: pre;
36+
display: inline-block;
37+
}
38+
.odd {
39+
background-color: #55bbff;
40+
color: #223311;
41+
}
42+
.even {
43+
background-color: #ee7756;
44+
color: #551133;
45+
}
46+
.code {
47+
--index: calc(var(--layer) - 1);
48+
padding-top: calc(var(--index) * 0.15em);
49+
filter:
50+
hue-rotate(calc(var(--index) * 25deg))
51+
saturate(calc(100% - (var(--index) * 2%)))
52+
brightness(calc(100% - (var(--index) * 1.5%)));
53+
}
54+
.annotation {
55+
color: #4444ff;
56+
font-family: monospace;
57+
font-style: italic;
58+
display: none;
59+
-webkit-user-select: none;
60+
}
61+
body:active .annotation {
62+
/* requires holding mouse down anywhere on the page */
63+
display: inline-block;
64+
}
65+
span:hover .annotation {
66+
/* requires hover over a span ONLY on its first line */
67+
display: inline-block;
68+
}
69+
</style>
70+
</head>
71+
<body>
72+
<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>
73+
<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)
74+
42:9-42:10: @8[3]: _14 = _13
75+
42:9-42:10: @8[4]: _7 = move _14
76+
42:9-42:10: @8[5]: _8 = const ()
77+
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
78+
43:16-43:20: @8[20]: _47 = const display::&lt;T&gt;::promoted[2]
79+
43:16-43:20: @8[21]: _22 = &amp;(*_47)
80+
43:16-43:20: @8[22]: _21 = &amp;(*_22)
81+
43:16-43:20: @8[23]: _20 = move _21 as &amp;[&amp;str] (Pointer(Unsize))
82+
43:22-43:23: @8[31]: _29 = &amp;_16
83+
43:9-43:25: @8[32]: _28 = (move _29,)
84+
43:9-43:25: @8[34]: FakeRead(ForMatchedPlace, _28)
85+
43:9-43:25: @8[36]: _30 = (_28.0: &amp;&amp;T)
86+
43:9-43:25: @8[39]: _32 = &amp;(*_30)
87+
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))
88+
43:9-43:25: @8.Call: _31 = std::fmt::ArgumentV1::new::&lt;&amp;T&gt;(move _32, move _33) -&gt; [return: bb9, unwind: bb14]
89+
43:9-43:25: @9[2]: _27 = [move _31]
90+
43:9-43:25: @9[5]: _26 = &amp;_27
91+
43:9-43:25: @9[6]: _25 = &amp;(*_26)
92+
43:9-43:25: @9[7]: _24 = move _25 as &amp;[std::fmt::ArgumentV1] (Pointer(Unsize))
93+
43:9-43:25: @9.Call: _19 = std::fmt::Arguments::new_v1(move _20, move _24) -&gt; [return: bb10, unwind: bb14]
94+
43:9-43:25: @10.Call: _18 = std::io::_print(move _19) -&gt; [return: bb11, unwind: bb14]
95+
42:17-44:6: @11[6]: _17 = const ()"><span class="annotation">@6,8,9,10,11⦊</span>xs {</span></span>
96+
<span class="line"><span class="code odd" style="--layer: 1" title="42:14-42:16: @8[12]: _16 = _7
97+
43:16-43:20: @8[20]: _47 = const display::&lt;T&gt;::promoted[2]
98+
43:16-43:20: @8[21]: _22 = &amp;(*_47)
99+
43:16-43:20: @8[22]: _21 = &amp;(*_22)
100+
43:16-43:20: @8[23]: _20 = move _21 as &amp;[&amp;str] (Pointer(Unsize))
101+
43:22-43:23: @8[31]: _29 = &amp;_16
102+
43:9-43:25: @8[32]: _28 = (move _29,)
103+
43:9-43:25: @8[34]: FakeRead(ForMatchedPlace, _28)
104+
43:9-43:25: @8[36]: _30 = (_28.0: &amp;&amp;T)
105+
43:9-43:25: @8[39]: _32 = &amp;(*_30)
106+
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))
107+
43:9-43:25: @8.Call: _31 = std::fmt::ArgumentV1::new::&lt;&amp;T&gt;(move _32, move _33) -&gt; [return: bb9, unwind: bb14]
108+
43:9-43:25: @9[2]: _27 = [move _31]
109+
43:9-43:25: @9[5]: _26 = &amp;_27
110+
43:9-43:25: @9[6]: _25 = &amp;(*_26)
111+
43:9-43:25: @9[7]: _24 = move _25 as &amp;[std::fmt::ArgumentV1] (Pointer(Unsize))
112+
43:9-43:25: @9.Call: _19 = std::fmt::Arguments::new_v1(move _20, move _24) -&gt; [return: bb10, unwind: bb14]
113+
43:9-43:25: @10.Call: _18 = std::io::_print(move _19) -&gt; [return: bb11, unwind: bb14]
114+
42:17-44:6: @11[6]: _17 = const ()"> print!("{}", x);</span></span>
115+
<span class="line"><span class="code odd" style="--layer: 1" title="42:14-42:16: @8[12]: _16 = _7
116+
43:16-43:20: @8[20]: _47 = const display::&lt;T&gt;::promoted[2]
117+
43:16-43:20: @8[21]: _22 = &amp;(*_47)
118+
43:16-43:20: @8[22]: _21 = &amp;(*_22)
119+
43:16-43:20: @8[23]: _20 = move _21 as &amp;[&amp;str] (Pointer(Unsize))
120+
43:22-43:23: @8[31]: _29 = &amp;_16
121+
43:9-43:25: @8[32]: _28 = (move _29,)
122+
43:9-43:25: @8[34]: FakeRead(ForMatchedPlace, _28)
123+
43:9-43:25: @8[36]: _30 = (_28.0: &amp;&amp;T)
124+
43:9-43:25: @8[39]: _32 = &amp;(*_30)
125+
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))
126+
43:9-43:25: @8.Call: _31 = std::fmt::ArgumentV1::new::&lt;&amp;T&gt;(move _32, move _33) -&gt; [return: bb9, unwind: bb14]
127+
43:9-43:25: @9[2]: _27 = [move _31]
128+
43:9-43:25: @9[5]: _26 = &amp;_27
129+
43:9-43:25: @9[6]: _25 = &amp;(*_26)
130+
43:9-43:25: @9[7]: _24 = move _25 as &amp;[std::fmt::ArgumentV1] (Pointer(Unsize))
131+
43:9-43:25: @9.Call: _19 = std::fmt::Arguments::new_v1(move _20, move _24) -&gt; [return: bb10, unwind: bb14]
132+
43:9-43:25: @10.Call: _18 = std::io::_print(move _19) -&gt; [return: bb11, unwind: bb14]
133+
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>
134+
<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]
135+
45:5-45:16: @5[14]: _38 = &amp;(*_46)
136+
45:5-45:16: @5[15]: _37 = &amp;(*_38)
137+
45:5-45:16: @5[16]: _36 = move _37 as &amp;[&amp;str] (Pointer(Unsize))
138+
45:5-45:16: @5[22]: _44 = ()
139+
45:5-45:16: @5[23]: FakeRead(ForMatchedPlace, _44)
140+
45:5-45:16: @5[24]: _45 = const display::&lt;T&gt;::promoted[0]
141+
45:5-45:16: @5[25]: _42 = &amp;(*_45)
142+
45:5-45:16: @5[26]: _41 = &amp;(*_42)
143+
45:5-45:16: @5[27]: _40 = move _41 as &amp;[std::fmt::ArgumentV1] (Pointer(Unsize))
144+
45:5-45:16: @5.Call: _35 = std::fmt::Arguments::new_v1(move _36, move _40) -&gt; [return: bb12, unwind: bb14]
145+
45:5-45:16: @12.Call: _34 = std::io::_print(move _35) -&gt; [return: bb13, unwind: bb14]
146+
46:2-46:2: @13.Return: return"><span class="annotation">@5,12,13⦊</span>println!();</span></span>
147+
<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]
148+
45:5-45:16: @5[14]: _38 = &amp;(*_46)
149+
45:5-45:16: @5[15]: _37 = &amp;(*_38)
150+
45:5-45:16: @5[16]: _36 = move _37 as &amp;[&amp;str] (Pointer(Unsize))
151+
45:5-45:16: @5[22]: _44 = ()
152+
45:5-45:16: @5[23]: FakeRead(ForMatchedPlace, _44)
153+
45:5-45:16: @5[24]: _45 = const display::&lt;T&gt;::promoted[0]
154+
45:5-45:16: @5[25]: _42 = &amp;(*_45)
155+
45:5-45:16: @5[26]: _41 = &amp;(*_42)
156+
45:5-45:16: @5[27]: _40 = move _41 as &amp;[std::fmt::ArgumentV1] (Pointer(Unsize))
157+
45:5-45:16: @5.Call: _35 = std::fmt::Arguments::new_v1(move _36, move _40) -&gt; [return: bb12, unwind: bb14]
158+
45:5-45:16: @12.Call: _34 = std::io::_print(move _35) -&gt; [return: bb13, unwind: bb14]
159+
46:2-46:2: @13.Return: return">}<span class="annotation">⦉@5,12,13</span></span></span></span></div>
160+
</body>
161+
</html>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
<!DOCTYPE html>
2+
<!--
3+
4+
Preview this file as rendered HTML from the github source at:
5+
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
6+
7+
For revisions in Pull Requests (PR):
8+
* Replace "rust-lang" with the github PR author
9+
* Replace "master" with the PR branch name
10+
11+
-->
12+
<html>
13+
<head>
14+
<title>inline.error - Coverage Spans</title>
15+
<style>
16+
.line {
17+
counter-increment: line;
18+
}
19+
.line:before {
20+
content: counter(line) ": ";
21+
font-family: Menlo, Monaco, monospace;
22+
font-style: italic;
23+
width: 3.8em;
24+
display: inline-block;
25+
text-align: right;
26+
filter: opacity(50%);
27+
-webkit-user-select: none;
28+
}
29+
.code {
30+
color: #dddddd;
31+
background-color: #222222;
32+
font-family: Menlo, Monaco, monospace;
33+
line-height: 1.4em;
34+
border-bottom: 2px solid #222222;
35+
white-space: pre;
36+
display: inline-block;
37+
}
38+
.odd {
39+
background-color: #55bbff;
40+
color: #223311;
41+
}
42+
.even {
43+
background-color: #ee7756;
44+
color: #551133;
45+
}
46+
.code {
47+
--index: calc(var(--layer) - 1);
48+
padding-top: calc(var(--index) * 0.15em);
49+
filter:
50+
hue-rotate(calc(var(--index) * 25deg))
51+
saturate(calc(100% - (var(--index) * 2%)))
52+
brightness(calc(100% - (var(--index) * 1.5%)));
53+
}
54+
.annotation {
55+
color: #4444ff;
56+
font-family: monospace;
57+
font-style: italic;
58+
display: none;
59+
-webkit-user-select: none;
60+
}
61+
body:active .annotation {
62+
/* requires holding mouse down anywhere on the page */
63+
display: inline-block;
64+
}
65+
span:hover .annotation {
66+
/* requires hover over a span ONLY on its first line */
67+
display: inline-block;
68+
}
69+
</style>
70+
</head>
71+
<body>
72+
<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
73+
49:12-51:2: @1.Resume: resume"><span class="annotation">@0,1⦊</span>fn error() {</span></span>
74+
<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
75+
49:12-51:2: @1.Resume: resume"> panic!("error");</span></span>
76+
<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
77+
49:12-51:2: @1.Resume: resume">}<span class="annotation">⦉@0,1</span></span></span></span></div>
78+
</body>
79+
</html>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
<!DOCTYPE html>
2+
<!--
3+
4+
Preview this file as rendered HTML from the github source at:
5+
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
6+
7+
For revisions in Pull Requests (PR):
8+
* Replace "rust-lang" with the github PR author
9+
* Replace "master" with the PR branch name
10+
11+
-->
12+
<html>
13+
<head>
14+
<title>inline.length - Coverage Spans</title>
15+
<style>
16+
.line {
17+
counter-increment: line;
18+
}
19+
.line:before {
20+
content: counter(line) ": ";
21+
font-family: Menlo, Monaco, monospace;
22+
font-style: italic;
23+
width: 3.8em;
24+
display: inline-block;
25+
text-align: right;
26+
filter: opacity(50%);
27+
-webkit-user-select: none;
28+
}
29+
.code {
30+
color: #dddddd;
31+
background-color: #222222;
32+
font-family: Menlo, Monaco, monospace;
33+
line-height: 1.4em;
34+
border-bottom: 2px solid #222222;
35+
white-space: pre;
36+
display: inline-block;
37+
}
38+
.odd {
39+
background-color: #55bbff;
40+
color: #223311;
41+
}
42+
.even {
43+
background-color: #ee7756;
44+
color: #551133;
45+
}
46+
.code {
47+
--index: calc(var(--layer) - 1);
48+
padding-top: calc(var(--index) * 0.15em);
49+
filter:
50+
hue-rotate(calc(var(--index) * 25deg))
51+
saturate(calc(100% - (var(--index) * 2%)))
52+
brightness(calc(100% - (var(--index) * 1.5%)));
53+
}
54+
.annotation {
55+
color: #4444ff;
56+
font-family: monospace;
57+
font-style: italic;
58+
display: none;
59+
-webkit-user-select: none;
60+
}
61+
body:active .annotation {
62+
/* requires holding mouse down anywhere on the page */
63+
display: inline-block;
64+
}
65+
span:hover .annotation {
66+
/* requires hover over a span ONLY on its first line */
67+
display: inline-block;
68+
}
69+
</style>
70+
</head>
71+
<body>
72+
<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)
73+
31:5-31:13: @0.Call: _0 = core::slice::&lt;impl [T]&gt;::len(move _2) -&gt; [return: bb1, unwind: bb2]
74+
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>
75+
<span class="line"><span class="code even" style="--layer: 1" title="31:5-31:7: @0[1]: _2 = &amp;(*_1)
76+
31:5-31:13: @0.Call: _0 = core::slice::&lt;impl [T]&gt;::len(move _2) -&gt; [return: bb1, unwind: bb2]
77+
32:2-32:2: @1.Return: return"> xs.len()</span></span>
78+
<span class="line"><span class="code even" style="--layer: 1" title="31:5-31:7: @0[1]: _2 = &amp;(*_1)
79+
31:5-31:13: @0.Call: _0 = core::slice::&lt;impl [T]&gt;::len(move _2) -&gt; [return: bb1, unwind: bb2]
80+
32:2-32:2: @1.Return: return">}<span class="annotation">⦉@0,1</span></span></span></span></div>
81+
</body>
82+
</html>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
<!DOCTYPE html>
2+
<!--
3+
4+
Preview this file as rendered HTML from the github source at:
5+
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
6+
7+
For revisions in Pull Requests (PR):
8+
* Replace "rust-lang" with the github PR author
9+
* Replace "master" with the PR branch name
10+
11+
-->
12+
<html>
13+
<head>
14+
<title>inline.main - Coverage Spans</title>
15+
<style>
16+
.line {
17+
counter-increment: line;
18+
}
19+
.line:before {
20+
content: counter(line) ": ";
21+
font-family: Menlo, Monaco, monospace;
22+
font-style: italic;
23+
width: 3.8em;
24+
display: inline-block;
25+
text-align: right;
26+
filter: opacity(50%);
27+
-webkit-user-select: none;
28+
}
29+
.code {
30+
color: #dddddd;
31+
background-color: #222222;
32+
font-family: Menlo, Monaco, monospace;
33+
line-height: 1.4em;
34+
border-bottom: 2px solid #222222;
35+
white-space: pre;
36+
display: inline-block;
37+
}
38+
.odd {
39+
background-color: #55bbff;
40+
color: #223311;
41+
}
42+
.even {
43+
background-color: #ee7756;
44+
color: #551133;
45+
}
46+
.code {
47+
--index: calc(var(--layer) - 1);
48+
padding-top: calc(var(--index) * 0.15em);
49+
filter:
50+
hue-rotate(calc(var(--index) * 25deg))
51+
saturate(calc(100% - (var(--index) * 2%)))
52+
brightness(calc(100% - (var(--index) * 1.5%)));
53+
}
54+
.annotation {
55+
color: #4444ff;
56+
font-family: monospace;
57+
font-style: italic;
58+
display: none;
59+
-webkit-user-select: none;
60+
}
61+
body:active .annotation {
62+
/* requires holding mouse down anywhere on the page */
63+
display: inline-block;
64+
}
65+
span:hover .annotation {
66+
/* requires hover over a span ONLY on its first line */
67+
display: inline-block;
68+
}
69+
</style>
70+
</head>
71+
<body>
72+
<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]
73+
6:18-6:34: @0[5]: _4 = &amp;(*_6)
74+
6:18-6:34: @0[6]: _3 = &amp;(*_4)
75+
6:18-6:34: @0[7]: _2 = move _3 as &amp;[char] (Pointer(Unsize))
76+
6:5-6:35: @0.Call: _1 = permutations::&lt;char&gt;(move _2) -&gt; [return: bb1, unwind: bb2]
77+
5:11-7:2: @1[3]: _0 = const ()
78+
7:2-7:2: @1.Return: return"><span class="annotation">@0,1⦊</span>fn main() {</span></span>
79+
<span class="line"><span class="code even" style="--layer: 1" title="6:18-6:34: @0[4]: _6 = const main::promoted[0]
80+
6:18-6:34: @0[5]: _4 = &amp;(*_6)
81+
6:18-6:34: @0[6]: _3 = &amp;(*_4)
82+
6:18-6:34: @0[7]: _2 = move _3 as &amp;[char] (Pointer(Unsize))
83+
6:5-6:35: @0.Call: _1 = permutations::&lt;char&gt;(move _2) -&gt; [return: bb1, unwind: bb2]
84+
5:11-7:2: @1[3]: _0 = const ()
85+
7:2-7:2: @1.Return: return"> permutations(&amp;['a', 'b', 'c']);</span></span>
86+
<span class="line"><span class="code even" style="--layer: 1" title="6:18-6:34: @0[4]: _6 = const main::promoted[0]
87+
6:18-6:34: @0[5]: _4 = &amp;(*_6)
88+
6:18-6:34: @0[6]: _3 = &amp;(*_4)
89+
6:18-6:34: @0[7]: _2 = move _3 as &amp;[char] (Pointer(Unsize))
90+
6:5-6:35: @0.Call: _1 = permutations::&lt;char&gt;(move _2) -&gt; [return: bb1, unwind: bb2]
91+
5:11-7:2: @1[3]: _0 = const ()
92+
7:2-7:2: @1.Return: return">}<span class="annotation">⦉@0,1</span></span></span></span></div>
93+
</body>
94+
</html>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,183 @@
1+
<!DOCTYPE html>
2+
<!--
3+
4+
Preview this file as rendered HTML from the github source at:
5+
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
6+
7+
For revisions in Pull Requests (PR):
8+
* Replace "rust-lang" with the github PR author
9+
* Replace "master" with the PR branch name
10+
11+
-->
12+
<html>
13+
<head>
14+
<title>inline.permutate - Coverage Spans</title>
15+
<style>
16+
.line {
17+
counter-increment: line;
18+
}
19+
.line:before {
20+
content: counter(line) ": ";
21+
font-family: Menlo, Monaco, monospace;
22+
font-style: italic;
23+
width: 3.8em;
24+
display: inline-block;
25+
text-align: right;
26+
filter: opacity(50%);
27+
-webkit-user-select: none;
28+
}
29+
.code {
30+
color: #dddddd;
31+
background-color: #222222;
32+
font-family: Menlo, Monaco, monospace;
33+
line-height: 1.4em;
34+
border-bottom: 2px solid #222222;
35+
white-space: pre;
36+
display: inline-block;
37+
}
38+
.odd {
39+
background-color: #55bbff;
40+
color: #223311;
41+
}
42+
.even {
43+
background-color: #ee7756;
44+
color: #551133;
45+
}
46+
.code {
47+
--index: calc(var(--layer) - 1);
48+
padding-top: calc(var(--index) * 0.15em);
49+
filter:
50+
hue-rotate(calc(var(--index) * 25deg))
51+
saturate(calc(100% - (var(--index) * 2%)))
52+
brightness(calc(100% - (var(--index) * 1.5%)));
53+
}
54+
.annotation {
55+
color: #4444ff;
56+
font-family: monospace;
57+
font-style: italic;
58+
display: none;
59+
-webkit-user-select: none;
60+
}
61+
body:active .annotation {
62+
/* requires holding mouse down anywhere on the page */
63+
display: inline-block;
64+
}
65+
span:hover .annotation {
66+
/* requires hover over a span ONLY on its first line */
67+
display: inline-block;
68+
}
69+
</style>
70+
</head>
71+
<body>
72+
<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)
73+
16:13-16:23: @0.Call: _3 = length::&lt;T&gt;(move _4) -&gt; [return: bb1, unwind: bb22]
74+
16:9-16:10: @1[1]: FakeRead(ForLet, _3)
75+
17:8-17:9: @1[4]: _6 = _2
76+
17:13-17:14: @1[6]: _7 = _3
77+
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>
78+
<span class="line"><span class="code even" style="--layer: 1" title="16:20-16:22: @0[2]: _4 = &amp;(*_1)
79+
16:13-16:23: @0.Call: _3 = length::&lt;T&gt;(move _4) -&gt; [return: bb1, unwind: bb22]
80+
16:9-16:10: @1[1]: FakeRead(ForLet, _3)
81+
17:8-17:9: @1[4]: _6 = _2
82+
17:13-17:14: @1[6]: _7 = _3
83+
17:8-17:14: @1[7]: _5 = Eq(move _6, move _7)"> let n = length(xs);</span></span>
84+
<span class="line"><span class="code even" style="--layer: 1" title="16:20-16:22: @0[2]: _4 = &amp;(*_1)
85+
16:13-16:23: @0.Call: _3 = length::&lt;T&gt;(move _4) -&gt; [return: bb1, unwind: bb22]
86+
16:9-16:10: @1[1]: FakeRead(ForLet, _3)
87+
17:8-17:9: @1[4]: _6 = _2
88+
17:13-17:14: @1[6]: _7 = _3
89+
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)
90+
18:9-18:20: @2.Call: _8 = display::&lt;T&gt;(move _9) -&gt; [return: bb4, unwind: bb22]
91+
17:15-19:6: @4[2]: _0 = const ()"><span class="annotation">@2,4⦊</span>{</span></span>
92+
<span class="line"><span class="code odd" style="--layer: 1" title="18:17-18:19: @2[2]: _9 = &amp;(*_1)
93+
18:9-18:20: @2.Call: _8 = display::&lt;T&gt;(move _9) -&gt; [return: bb4, unwind: bb22]
94+
17:15-19:6: @4[2]: _0 = const ()"> display(xs);</span></span>
95+
<span class="line"><span class="code odd" style="--layer: 1" title="18:17-18:19: @2[2]: _9 = &amp;(*_1)
96+
18:9-18:20: @2.Call: _8 = display::&lt;T&gt;(move _9) -&gt; [return: bb4, unwind: bb22]
97+
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
98+
19:19-19:20: @3[4]: _12 = _3
99+
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>
100+
<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)
101+
20:13-20:14: @14[3]: _26 = _25
102+
20:13-20:14: @14[4]: _19 = move _26
103+
20:13-20:14: @14[5]: _20 = const ()
104+
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
105+
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)
106+
21:22-21:23: @14[19]: _32 = _28
107+
21:25-21:26: @14[21]: _33 = _2
108+
21:13-21:27: @14.Call: _30 = swap::&lt;T&gt;(move _31, move _32, move _33) -&gt; [return: bb15, unwind: bb22]
109+
22:23-22:25: @15[6]: _35 = &amp;mut (*_1)
110+
22:27-22:28: @15[9]: _37 = _2
111+
22:27-22:32: @15[10]: _38 = CheckedAdd(_37, const 1_usize)
112+
22:27-22:32: @16[0]: _36 = move (_38.0: usize)
113+
22:13-22:33: @16.Call: _34 = permutate::&lt;T&gt;(move _35, move _36) -&gt; [return: bb17, unwind: bb22]
114+
23:18-23:20: @17[5]: _40 = &amp;mut (*_1)
115+
23:22-23:23: @17[7]: _41 = _28
116+
23:25-23:26: @17[9]: _42 = _2
117+
23:13-23:27: @17.Call: _39 = swap::&lt;T&gt;(move _40, move _41, move _42) -&gt; [return: bb18, unwind: bb22]
118+
20:23-24:10: @18[4]: _29 = const ()"><span class="annotation">@12,14,15,16,17,18⦊</span>{</span></span>
119+
<span class="line"><span class="code odd" style="--layer: 1" title="21:18-21:20: @14[17]: _31 = &amp;mut (*_1)
120+
21:22-21:23: @14[19]: _32 = _28
121+
21:25-21:26: @14[21]: _33 = _2
122+
21:13-21:27: @14.Call: _30 = swap::&lt;T&gt;(move _31, move _32, move _33) -&gt; [return: bb15, unwind: bb22]
123+
22:23-22:25: @15[6]: _35 = &amp;mut (*_1)
124+
22:27-22:28: @15[9]: _37 = _2
125+
22:27-22:32: @15[10]: _38 = CheckedAdd(_37, const 1_usize)
126+
22:27-22:32: @16[0]: _36 = move (_38.0: usize)
127+
22:13-22:33: @16.Call: _34 = permutate::&lt;T&gt;(move _35, move _36) -&gt; [return: bb17, unwind: bb22]
128+
23:18-23:20: @17[5]: _40 = &amp;mut (*_1)
129+
23:22-23:23: @17[7]: _41 = _28
130+
23:25-23:26: @17[9]: _42 = _2
131+
23:13-23:27: @17.Call: _39 = swap::&lt;T&gt;(move _40, move _41, move _42) -&gt; [return: bb18, unwind: bb22]
132+
20:23-24:10: @18[4]: _29 = const ()"> swap(xs, i, k);</span></span>
133+
<span class="line"><span class="code odd" style="--layer: 1" title="21:18-21:20: @14[17]: _31 = &amp;mut (*_1)
134+
21:22-21:23: @14[19]: _32 = _28
135+
21:25-21:26: @14[21]: _33 = _2
136+
21:13-21:27: @14.Call: _30 = swap::&lt;T&gt;(move _31, move _32, move _33) -&gt; [return: bb15, unwind: bb22]
137+
22:23-22:25: @15[6]: _35 = &amp;mut (*_1)
138+
22:27-22:28: @15[9]: _37 = _2
139+
22:27-22:32: @15[10]: _38 = CheckedAdd(_37, const 1_usize)
140+
22:27-22:32: @16[0]: _36 = move (_38.0: usize)
141+
22:13-22:33: @16.Call: _34 = permutate::&lt;T&gt;(move _35, move _36) -&gt; [return: bb17, unwind: bb22]
142+
23:18-23:20: @17[5]: _40 = &amp;mut (*_1)
143+
23:22-23:23: @17[7]: _41 = _28
144+
23:25-23:26: @17[9]: _42 = _2
145+
23:13-23:27: @17.Call: _39 = swap::&lt;T&gt;(move _40, move _41, move _42) -&gt; [return: bb18, unwind: bb22]
146+
20:23-24:10: @18[4]: _29 = const ()"> permutate(xs, k + 1);</span></span>
147+
<span class="line"><span class="code odd" style="--layer: 1" title="21:18-21:20: @14[17]: _31 = &amp;mut (*_1)
148+
21:22-21:23: @14[19]: _32 = _28
149+
21:25-21:26: @14[21]: _33 = _2
150+
21:13-21:27: @14.Call: _30 = swap::&lt;T&gt;(move _31, move _32, move _33) -&gt; [return: bb15, unwind: bb22]
151+
22:23-22:25: @15[6]: _35 = &amp;mut (*_1)
152+
22:27-22:28: @15[9]: _37 = _2
153+
22:27-22:32: @15[10]: _38 = CheckedAdd(_37, const 1_usize)
154+
22:27-22:32: @16[0]: _36 = move (_38.0: usize)
155+
22:13-22:33: @16.Call: _34 = permutate::&lt;T&gt;(move _35, move _36) -&gt; [return: bb17, unwind: bb22]
156+
23:18-23:20: @17[5]: _40 = &amp;mut (*_1)
157+
23:22-23:23: @17[7]: _41 = _28
158+
23:25-23:26: @17[9]: _42 = _2
159+
23:13-23:27: @17.Call: _39 = swap::&lt;T&gt;(move _40, move _41, move _42) -&gt; [return: bb18, unwind: bb22]
160+
20:23-24:10: @18[4]: _29 = const ()"> swap(xs, i, k);</span></span>
161+
<span class="line"><span class="code odd" style="--layer: 1" title="21:18-21:20: @14[17]: _31 = &amp;mut (*_1)
162+
21:22-21:23: @14[19]: _32 = _28
163+
21:25-21:26: @14[21]: _33 = _2
164+
21:13-21:27: @14.Call: _30 = swap::&lt;T&gt;(move _31, move _32, move _33) -&gt; [return: bb15, unwind: bb22]
165+
22:23-22:25: @15[6]: _35 = &amp;mut (*_1)
166+
22:27-22:28: @15[9]: _37 = _2
167+
22:27-22:32: @15[10]: _38 = CheckedAdd(_37, const 1_usize)
168+
22:27-22:32: @16[0]: _36 = move (_38.0: usize)
169+
22:13-22:33: @16.Call: _34 = permutate::&lt;T&gt;(move _35, move _36) -&gt; [return: bb17, unwind: bb22]
170+
23:18-23:20: @17[5]: _40 = &amp;mut (*_1)
171+
23:22-23:23: @17[7]: _41 = _28
172+
23:25-23:26: @17[9]: _42 = _2
173+
23:13-23:27: @17.Call: _39 = swap::&lt;T&gt;(move _40, move _41, move _42) -&gt; [return: bb18, unwind: bb22]
174+
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>
175+
<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]
176+
25:12-27:6: @19[1]: _0 = const ()"><span class="annotation">@6,19⦊</span>{</span></span>
177+
<span class="line"><span class="code even" style="--layer: 1" title="26:9-26:16: @6.Call: _43 = error() -&gt; [return: bb19, unwind: bb22]
178+
25:12-27:6: @19[1]: _0 = const ()"> error();</span></span>
179+
<span class="line"><span class="code even" style="--layer: 1" title="26:9-26:16: @6.Call: _43 = error() -&gt; [return: bb19, unwind: bb22]
180+
25:12-27:6: @19[1]: _0 = const ()"> }<span class="annotation">⦉@6,19</span></span></span><span class="code" style="--layer: 0"></span></span>
181+
<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>
182+
</body>
183+
</html>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
<!DOCTYPE html>
2+
<!--
3+
4+
Preview this file as rendered HTML from the github source at:
5+
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
6+
7+
For revisions in Pull Requests (PR):
8+
* Replace "rust-lang" with the github PR author
9+
* Replace "master" with the PR branch name
10+
11+
-->
12+
<html>
13+
<head>
14+
<title>inline.permutations - Coverage Spans</title>
15+
<style>
16+
.line {
17+
counter-increment: line;
18+
}
19+
.line:before {
20+
content: counter(line) ": ";
21+
font-family: Menlo, Monaco, monospace;
22+
font-style: italic;
23+
width: 3.8em;
24+
display: inline-block;
25+
text-align: right;
26+
filter: opacity(50%);
27+
-webkit-user-select: none;
28+
}
29+
.code {
30+
color: #dddddd;
31+
background-color: #222222;
32+
font-family: Menlo, Monaco, monospace;
33+
line-height: 1.4em;
34+
border-bottom: 2px solid #222222;
35+
white-space: pre;
36+
display: inline-block;
37+
}
38+
.odd {
39+
background-color: #55bbff;
40+
color: #223311;
41+
}
42+
.even {
43+
background-color: #ee7756;
44+
color: #551133;
45+
}
46+
.code {
47+
--index: calc(var(--layer) - 1);
48+
padding-top: calc(var(--index) * 0.15em);
49+
filter:
50+
hue-rotate(calc(var(--index) * 25deg))
51+
saturate(calc(100% - (var(--index) * 2%)))
52+
brightness(calc(100% - (var(--index) * 1.5%)));
53+
}
54+
.annotation {
55+
color: #4444ff;
56+
font-family: monospace;
57+
font-style: italic;
58+
display: none;
59+
-webkit-user-select: none;
60+
}
61+
body:active .annotation {
62+
/* requires holding mouse down anywhere on the page */
63+
display: inline-block;
64+
}
65+
span:hover .annotation {
66+
/* requires hover over a span ONLY on its first line */
67+
display: inline-block;
68+
}
69+
</style>
70+
</head>
71+
<body>
72+
<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)
73+
11:18-11:31: @0.Call: _2 = &lt;[T] as std::borrow::ToOwned&gt;::to_owned(move _3) -&gt; [return: bb1, unwind: bb6]
74+
11:9-11:15: @1[1]: FakeRead(ForLet, _2)
75+
12:15-12:22: @1[7]: _8 = &amp;mut _2
76+
12:15-12:22: @1[8]: _7 = &amp;mut (*_8)
77+
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]
78+
12:15-12:22: @2[0]: _5 = &amp;mut (*_6)
79+
12:5-12:26: @2.Call: _4 = permutate::&lt;T&gt;(move _5, const 0_usize) -&gt; [return: bb3, unwind: bb5]
80+
10:46-13:2: @3[4]: _0 = const ()
81+
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>
82+
<span class="line"><span class="code even" style="--layer: 1" title="11:18-11:20: @0[2]: _3 = &amp;(*_1)
83+
11:18-11:31: @0.Call: _2 = &lt;[T] as std::borrow::ToOwned&gt;::to_owned(move _3) -&gt; [return: bb1, unwind: bb6]
84+
11:9-11:15: @1[1]: FakeRead(ForLet, _2)
85+
12:15-12:22: @1[7]: _8 = &amp;mut _2
86+
12:15-12:22: @1[8]: _7 = &amp;mut (*_8)
87+
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]
88+
12:15-12:22: @2[0]: _5 = &amp;mut (*_6)
89+
12:5-12:26: @2.Call: _4 = permutate::&lt;T&gt;(move _5, const 0_usize) -&gt; [return: bb3, unwind: bb5]
90+
10:46-13:2: @3[4]: _0 = const ()
91+
13:2-13:2: @4.Return: return"> let mut ys = xs.to_owned();</span></span>
92+
<span class="line"><span class="code even" style="--layer: 1" title="11:18-11:20: @0[2]: _3 = &amp;(*_1)
93+
11:18-11:31: @0.Call: _2 = &lt;[T] as std::borrow::ToOwned&gt;::to_owned(move _3) -&gt; [return: bb1, unwind: bb6]
94+
11:9-11:15: @1[1]: FakeRead(ForLet, _2)
95+
12:15-12:22: @1[7]: _8 = &amp;mut _2
96+
12:15-12:22: @1[8]: _7 = &amp;mut (*_8)
97+
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]
98+
12:15-12:22: @2[0]: _5 = &amp;mut (*_6)
99+
12:5-12:26: @2.Call: _4 = permutate::&lt;T&gt;(move _5, const 0_usize) -&gt; [return: bb3, unwind: bb5]
100+
10:46-13:2: @3[4]: _0 = const ()
101+
13:2-13:2: @4.Return: return"> permutate(&amp;mut ys, 0);</span></span>
102+
<span class="line"><span class="code even" style="--layer: 1" title="11:18-11:20: @0[2]: _3 = &amp;(*_1)
103+
11:18-11:31: @0.Call: _2 = &lt;[T] as std::borrow::ToOwned&gt;::to_owned(move _3) -&gt; [return: bb1, unwind: bb6]
104+
11:9-11:15: @1[1]: FakeRead(ForLet, _2)
105+
12:15-12:22: @1[7]: _8 = &amp;mut _2
106+
12:15-12:22: @1[8]: _7 = &amp;mut (*_8)
107+
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]
108+
12:15-12:22: @2[0]: _5 = &amp;mut (*_6)
109+
12:5-12:26: @2.Call: _4 = permutate::&lt;T&gt;(move _5, const 0_usize) -&gt; [return: bb3, unwind: bb5]
110+
10:46-13:2: @3[4]: _0 = const ()
111+
13:2-13:2: @4.Return: return">}<span class="annotation">⦉@0,1,2,3,4</span></span></span></span></div>
112+
</body>
113+
</html>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,173 @@
1+
<!DOCTYPE html>
2+
<!--
3+
4+
Preview this file as rendered HTML from the github source at:
5+
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
6+
7+
For revisions in Pull Requests (PR):
8+
* Replace "rust-lang" with the github PR author
9+
* Replace "master" with the PR branch name
10+
11+
-->
12+
<html>
13+
<head>
14+
<title>inline.swap - Coverage Spans</title>
15+
<style>
16+
.line {
17+
counter-increment: line;
18+
}
19+
.line:before {
20+
content: counter(line) ": ";
21+
font-family: Menlo, Monaco, monospace;
22+
font-style: italic;
23+
width: 3.8em;
24+
display: inline-block;
25+
text-align: right;
26+
filter: opacity(50%);
27+
-webkit-user-select: none;
28+
}
29+
.code {
30+
color: #dddddd;
31+
background-color: #222222;
32+
font-family: Menlo, Monaco, monospace;
33+
line-height: 1.4em;
34+
border-bottom: 2px solid #222222;
35+
white-space: pre;
36+
display: inline-block;
37+
}
38+
.odd {
39+
background-color: #55bbff;
40+
color: #223311;
41+
}
42+
.even {
43+
background-color: #ee7756;
44+
color: #551133;
45+
}
46+
.code {
47+
--index: calc(var(--layer) - 1);
48+
padding-top: calc(var(--index) * 0.15em);
49+
filter:
50+
hue-rotate(calc(var(--index) * 25deg))
51+
saturate(calc(100% - (var(--index) * 2%)))
52+
brightness(calc(100% - (var(--index) * 1.5%)));
53+
}
54+
.annotation {
55+
color: #4444ff;
56+
font-family: monospace;
57+
font-style: italic;
58+
display: none;
59+
-webkit-user-select: none;
60+
}
61+
body:active .annotation {
62+
/* requires holding mouse down anywhere on the page */
63+
display: inline-block;
64+
}
65+
span:hover .annotation {
66+
/* requires hover over a span ONLY on its first line */
67+
display: inline-block;
68+
}
69+
</style>
70+
</head>
71+
<body>
72+
<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
73+
36:13-36:18: @0[3]: _6 = Len((*_1))
74+
36:13-36:18: @0[4]: _7 = Lt(_5, _6)
75+
36:13-36:18: @1[0]: _4 = (*_1)[_5]
76+
36:9-36:10: @1[1]: FakeRead(ForLet, _4)
77+
37:16-37:17: @1[5]: _9 = _3
78+
37:13-37:18: @1[6]: _10 = Len((*_1))
79+
37:13-37:18: @1[7]: _11 = Lt(_9, _10)
80+
37:13-37:18: @2[0]: _8 = (*_1)[_9]
81+
37:8-37:9: @2[2]: _12 = _2
82+
37:5-37:10: @2[3]: _13 = Len((*_1))
83+
37:5-37:10: @2[4]: _14 = Lt(_12, _13)
84+
37:5-37:18: @3[0]: (*_1)[_12] = move _8
85+
38:13-38:14: @3[5]: _15 = _4
86+
38:8-38:9: @3[7]: _16 = _3
87+
38:5-38:10: @3[8]: _17 = Len((*_1))
88+
38:5-38:10: @3[9]: _18 = Lt(_16, _17)
89+
38:5-38:14: @4[0]: (*_1)[_16] = move _15
90+
35:52-39:2: @4[3]: _0 = const ()
91+
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>
92+
<span class="line"><span class="code even" style="--layer: 1" title="36:16-36:17: @0[2]: _5 = _2
93+
36:13-36:18: @0[3]: _6 = Len((*_1))
94+
36:13-36:18: @0[4]: _7 = Lt(_5, _6)
95+
36:13-36:18: @1[0]: _4 = (*_1)[_5]
96+
36:9-36:10: @1[1]: FakeRead(ForLet, _4)
97+
37:16-37:17: @1[5]: _9 = _3
98+
37:13-37:18: @1[6]: _10 = Len((*_1))
99+
37:13-37:18: @1[7]: _11 = Lt(_9, _10)
100+
37:13-37:18: @2[0]: _8 = (*_1)[_9]
101+
37:8-37:9: @2[2]: _12 = _2
102+
37:5-37:10: @2[3]: _13 = Len((*_1))
103+
37:5-37:10: @2[4]: _14 = Lt(_12, _13)
104+
37:5-37:18: @3[0]: (*_1)[_12] = move _8
105+
38:13-38:14: @3[5]: _15 = _4
106+
38:8-38:9: @3[7]: _16 = _3
107+
38:5-38:10: @3[8]: _17 = Len((*_1))
108+
38:5-38:10: @3[9]: _18 = Lt(_16, _17)
109+
38:5-38:14: @4[0]: (*_1)[_16] = move _15
110+
35:52-39:2: @4[3]: _0 = const ()
111+
39:2-39:2: @4.Return: return"> let t = xs[i];</span></span>
112+
<span class="line"><span class="code even" style="--layer: 1" title="36:16-36:17: @0[2]: _5 = _2
113+
36:13-36:18: @0[3]: _6 = Len((*_1))
114+
36:13-36:18: @0[4]: _7 = Lt(_5, _6)
115+
36:13-36:18: @1[0]: _4 = (*_1)[_5]
116+
36:9-36:10: @1[1]: FakeRead(ForLet, _4)
117+
37:16-37:17: @1[5]: _9 = _3
118+
37:13-37:18: @1[6]: _10 = Len((*_1))
119+
37:13-37:18: @1[7]: _11 = Lt(_9, _10)
120+
37:13-37:18: @2[0]: _8 = (*_1)[_9]
121+
37:8-37:9: @2[2]: _12 = _2
122+
37:5-37:10: @2[3]: _13 = Len((*_1))
123+
37:5-37:10: @2[4]: _14 = Lt(_12, _13)
124+
37:5-37:18: @3[0]: (*_1)[_12] = move _8
125+
38:13-38:14: @3[5]: _15 = _4
126+
38:8-38:9: @3[7]: _16 = _3
127+
38:5-38:10: @3[8]: _17 = Len((*_1))
128+
38:5-38:10: @3[9]: _18 = Lt(_16, _17)
129+
38:5-38:14: @4[0]: (*_1)[_16] = move _15
130+
35:52-39:2: @4[3]: _0 = const ()
131+
39:2-39:2: @4.Return: return"> xs[i] = xs[j];</span></span>
132+
<span class="line"><span class="code even" style="--layer: 1" title="36:16-36:17: @0[2]: _5 = _2
133+
36:13-36:18: @0[3]: _6 = Len((*_1))
134+
36:13-36:18: @0[4]: _7 = Lt(_5, _6)
135+
36:13-36:18: @1[0]: _4 = (*_1)[_5]
136+
36:9-36:10: @1[1]: FakeRead(ForLet, _4)
137+
37:16-37:17: @1[5]: _9 = _3
138+
37:13-37:18: @1[6]: _10 = Len((*_1))
139+
37:13-37:18: @1[7]: _11 = Lt(_9, _10)
140+
37:13-37:18: @2[0]: _8 = (*_1)[_9]
141+
37:8-37:9: @2[2]: _12 = _2
142+
37:5-37:10: @2[3]: _13 = Len((*_1))
143+
37:5-37:10: @2[4]: _14 = Lt(_12, _13)
144+
37:5-37:18: @3[0]: (*_1)[_12] = move _8
145+
38:13-38:14: @3[5]: _15 = _4
146+
38:8-38:9: @3[7]: _16 = _3
147+
38:5-38:10: @3[8]: _17 = Len((*_1))
148+
38:5-38:10: @3[9]: _18 = Lt(_16, _17)
149+
38:5-38:14: @4[0]: (*_1)[_16] = move _15
150+
35:52-39:2: @4[3]: _0 = const ()
151+
39:2-39:2: @4.Return: return"> xs[j] = t;</span></span>
152+
<span class="line"><span class="code even" style="--layer: 1" title="36:16-36:17: @0[2]: _5 = _2
153+
36:13-36:18: @0[3]: _6 = Len((*_1))
154+
36:13-36:18: @0[4]: _7 = Lt(_5, _6)
155+
36:13-36:18: @1[0]: _4 = (*_1)[_5]
156+
36:9-36:10: @1[1]: FakeRead(ForLet, _4)
157+
37:16-37:17: @1[5]: _9 = _3
158+
37:13-37:18: @1[6]: _10 = Len((*_1))
159+
37:13-37:18: @1[7]: _11 = Lt(_9, _10)
160+
37:13-37:18: @2[0]: _8 = (*_1)[_9]
161+
37:8-37:9: @2[2]: _12 = _2
162+
37:5-37:10: @2[3]: _13 = Len((*_1))
163+
37:5-37:10: @2[4]: _14 = Lt(_12, _13)
164+
37:5-37:18: @3[0]: (*_1)[_12] = move _8
165+
38:13-38:14: @3[5]: _15 = _4
166+
38:8-38:9: @3[7]: _16 = _3
167+
38:5-38:10: @3[8]: _17 = Len((*_1))
168+
38:5-38:10: @3[9]: _18 = Lt(_16, _17)
169+
38:5-38:14: @4[0]: (*_1)[_16] = move _15
170+
35:52-39:2: @4[3]: _0 = const ()
171+
39:2-39:2: @4.Return: return">}<span class="annotation">⦉@0,1,2,3,4</span></span></span></span></div>
172+
</body>
173+
</html>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
// compile-flags: -Zinline-mir
2+
3+
use std::fmt::Display;
4+
5+
fn main() {
6+
permutations(&['a', 'b', 'c']);
7+
}
8+
9+
#[inline(always)]
10+
fn permutations<T: Copy + Display>(xs: &[T]) {
11+
let mut ys = xs.to_owned();
12+
permutate(&mut ys, 0);
13+
}
14+
15+
fn permutate<T: Copy + Display>(xs: &mut [T], k: usize) {
16+
let n = length(xs);
17+
if k == n {
18+
display(xs);
19+
} else if k < n {
20+
for i in k..n {
21+
swap(xs, i, k);
22+
permutate(xs, k + 1);
23+
swap(xs, i, k);
24+
}
25+
} else {
26+
error();
27+
}
28+
}
29+
30+
fn length<T>(xs: &[T]) -> usize {
31+
xs.len()
32+
}
33+
34+
#[inline]
35+
fn swap<T: Copy>(xs: &mut [T], i: usize, j: usize) {
36+
let t = xs[i];
37+
xs[i] = xs[j];
38+
xs[j] = t;
39+
}
40+
41+
fn display<T: Display>(xs: &[T]) {
42+
for x in xs {
43+
print!("{}", x);
44+
}
45+
println!();
46+
}
47+
48+
#[inline(always)]
49+
fn error() {
50+
panic!("error");
51+
}

0 commit comments

Comments
 (0)
Please sign in to comment.