Skip to content

Commit d2cd212

Browse files
committed
---
yaml --- r: 271481 b: refs/heads/auto c: caac0b9 h: refs/heads/master i: 271479: fec24e3
1 parent db4d64b commit d2cd212

File tree

2 files changed

+25
-14
lines changed

2 files changed

+25
-14
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
88
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
99
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1010
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
11-
refs/heads/auto: 9d00deee9619db6722b27630bd037ab32fc3b9ab
11+
refs/heads/auto: caac0b969fd888014c3ff80238d8a00c6eae4feb
1212
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1313
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336
1414
refs/tags/0.2: 1754d02027f2924bed83b0160ee340c7f41d5ea1

branches/auto/src/librustc_mir/pretty.rs

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,33 @@ use syntax::ast::NodeId;
1616
const INDENT: &'static str = " ";
1717

1818
/// 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)?;
2839
}
40+
writeln!(w, "}}")?;
2941
Ok(())
3042
}
3143

3244
/// 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<()> {
3446
let data = mir.basic_block_data(block);
3547

3648
// 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
4961

5062
/// Write out a human-readable textual representation of the MIR's `fn` type and the types of its
5163
/// 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<()> {
5566
write!(w, "fn {}(", tcx.map.path_to_string(nid))?;
5667

5768
// fn argument types.

0 commit comments

Comments
 (0)