@@ -16,21 +16,33 @@ use syntax::ast::NodeId;
16
16
const INDENT : & ' static str = " " ;
17
17
18
18
/// Write out a human-readable textual representation for the given MIR.
19
- pub fn write_mir_pretty < ' a , ' t , W , I > ( tcx : & ty:: TyCtxt < ' t > , iter : I , w : & mut W ) -> io:: Result < ( ) >
20
- where W : Write , I : Iterator < Item =( & ' a NodeId , & ' a Mir < ' a > ) > {
21
- for ( & nodeid, mir) in iter {
22
- write_mir_intro ( tcx, nodeid, mir, w) ?;
23
- // Nodes
24
- for block in mir. all_basic_blocks ( ) {
25
- write_basic_block ( block, mir, w) ?;
26
- }
27
- writeln ! ( w, "}}" ) ?
19
+ pub fn write_mir_pretty < ' a , ' tcx , I > ( tcx : & ty:: TyCtxt < ' tcx > ,
20
+ iter : I ,
21
+ w : & mut Write )
22
+ -> io:: Result < ( ) >
23
+ where I : Iterator < Item =( & ' a NodeId , & ' a Mir < ' tcx > ) > , ' tcx : ' a
24
+ {
25
+ for ( & node_id, mir) in iter {
26
+ write_mir_fn ( tcx, node_id, mir, w) ?;
27
+ }
28
+ Ok ( ( ) )
29
+ }
30
+
31
+ pub fn write_mir_fn < ' tcx > ( tcx : & ty:: TyCtxt < ' tcx > ,
32
+ node_id : NodeId ,
33
+ mir : & Mir < ' tcx > ,
34
+ w : & mut Write )
35
+ -> io:: Result < ( ) > {
36
+ write_mir_intro ( tcx, node_id, mir, w) ?;
37
+ for block in mir. all_basic_blocks ( ) {
38
+ write_basic_block ( block, mir, w) ?;
28
39
}
40
+ writeln ! ( w, "}}" ) ?;
29
41
Ok ( ( ) )
30
42
}
31
43
32
44
/// Write out a human-readable textual representation for the given basic block.
33
- fn write_basic_block < W : Write > ( block : BasicBlock , mir : & Mir , w : & mut W ) -> io:: Result < ( ) > {
45
+ fn write_basic_block ( block : BasicBlock , mir : & Mir , w : & mut Write ) -> io:: Result < ( ) > {
34
46
let data = mir. basic_block_data ( block) ;
35
47
36
48
// Basic block label at the top.
@@ -49,9 +61,8 @@ fn write_basic_block<W: Write>(block: BasicBlock, mir: &Mir, w: &mut W) -> io::R
49
61
50
62
/// Write out a human-readable textual representation of the MIR's `fn` type and the types of its
51
63
/// local variables (both user-defined bindings and compiler temporaries).
52
- fn write_mir_intro < W : Write > ( tcx : & ty:: TyCtxt , nid : NodeId , mir : & Mir , w : & mut W )
53
- -> io:: Result < ( ) > {
54
-
64
+ fn write_mir_intro ( tcx : & ty:: TyCtxt , nid : NodeId , mir : & Mir , w : & mut Write )
65
+ -> io:: Result < ( ) > {
55
66
write ! ( w, "fn {}(" , tcx. map. path_to_string( nid) ) ?;
56
67
57
68
// fn argument types.
0 commit comments