]> git.proxmox.com Git - rustc.git/blame - src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.loops_branches.txt
New upstream version 1.54.0+dfsg1
[rustc.git] / src / test / run-make-fulldeps / coverage-reports / expected_show_coverage.loops_branches.txt
CommitLineData
fc512014 1 1| |#![allow(unused_assignments, unused_variables, while_true)]
29967ef6 2 2| |
cdc7bbd5
XL
3 3| |// This test confirms that (1) unexecuted infinite loops are handled correctly by the
4 4| |// InstrumentCoverage MIR pass; and (2) Counter Expressions that subtract from zero can be dropped.
29967ef6
XL
5 5| |
6 6| |struct DebugTest;
7 7| |
8 8| |impl std::fmt::Debug for DebugTest {
fc512014 9 9| 1| fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
29967ef6
XL
10 10| 1| if true {
11 11| 1| if false {
17df50a5
XL
12 12| 0| while true {
13 13| 0| }
29967ef6 14 14| 1| }
17df50a5
XL
15 15| 1| write!(f, "cool")?;
16 ^0
17 16| 0| } else {
18 17| 0| }
cdc7bbd5
XL
19 18| |
20 19| 10| for i in 0..10 {
21 20| 10| if true {
22 21| 10| if false {
17df50a5 23 22| 0| while true {}
cdc7bbd5 24 23| 10| }
17df50a5
XL
25 24| 10| write!(f, "cool")?;
26 ^0
27 25| 0| } else {
28 26| 0| }
cdc7bbd5
XL
29 27| | }
30 28| 1| Ok(())
31 29| 1| }
32 30| |}
33 31| |
34 32| |struct DisplayTest;
35 33| |
36 34| |impl std::fmt::Display for DisplayTest {
37 35| 1| fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
38 36| 1| if false {
17df50a5 39 37| 0| } else {
cdc7bbd5 40 38| 1| if false {
17df50a5 41 39| 0| while true {}
cdc7bbd5 42 40| 1| }
17df50a5
XL
43 41| 1| write!(f, "cool")?;
44 ^0
cdc7bbd5
XL
45 42| | }
46 43| 10| for i in 0..10 {
47 44| 10| if false {
17df50a5 48 45| 0| } else {
cdc7bbd5 49 46| 10| if false {
17df50a5 50 47| 0| while true {}
cdc7bbd5 51 48| 10| }
17df50a5
XL
52 49| 10| write!(f, "cool")?;
53 ^0
cdc7bbd5
XL
54 50| | }
55 51| | }
56 52| 1| Ok(())
57 53| 1| }
58 54| |}
59 55| |
60 56| 1|fn main() {
61 57| 1| let debug_test = DebugTest;
62 58| 1| println!("{:?}", debug_test);
63 59| 1| let display_test = DisplayTest;
64 60| 1| println!("{}", display_test);
65 61| 1|}
29967ef6 66