about summary refs log tree commit diff
path: root/src/test/run-make-fulldeps/coverage/loops_branches.rs
blob: 938421d32e7a5725fe6be25c8825128b18390c79 (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
#![allow(unused_assignments, unused_variables, while_true)]

// This test confirms an earlier problem was resolved, supporting the MIR graph generated by the
// structure of this `fmt` function.

struct DebugTest;

impl std::fmt::Debug for DebugTest {
    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
        if true {
            if false {
                while true {
                }
            }
            write!(f, "error")?;
        } else {
        }
        Ok(())
    }
}

fn main() {
    let debug_test = DebugTest;
    println!("{:?}", debug_test);
}

/*

This is the error message generated, before the issue was fixed:

error: internal compiler error: compiler/rustc_mir/src/transform/coverage/mod.rs:374:42:
Error processing: DefId(0:6 ~ bug_incomplete_cov_graph_traversal_simplified[317d]::{impl#0}::fmt):
Error { message: "`TraverseCoverageGraphWithLoops` missed some `BasicCoverageBlock`s:
[bcb6, bcb7, bcb9]" }

*/