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