rewrite write_mir_fn_graphviz
to cope with non-global tcx
This commit is contained in:
parent
d9fb792d7c
commit
9b3af6ce3c
2 changed files with 14 additions and 13 deletions
|
@ -25,6 +25,7 @@ Rust MIR: a lowered representation of Rust. Also: an experiment!
|
||||||
#![feature(placement_in_syntax)]
|
#![feature(placement_in_syntax)]
|
||||||
#![feature(collection_placement)]
|
#![feature(collection_placement)]
|
||||||
#![feature(nonzero)]
|
#![feature(nonzero)]
|
||||||
|
#![feature(underscore_lifetimes)]
|
||||||
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate bitflags;
|
extern crate bitflags;
|
||||||
|
|
|
@ -21,10 +21,10 @@ use rustc_data_structures::indexed_vec::Idx;
|
||||||
use super::pretty::dump_mir_def_ids;
|
use super::pretty::dump_mir_def_ids;
|
||||||
|
|
||||||
/// Write a graphviz DOT graph of a list of MIRs.
|
/// Write a graphviz DOT graph of a list of MIRs.
|
||||||
pub fn write_mir_graphviz<'a, 'tcx, W>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
pub fn write_mir_graphviz<'tcx, W>(tcx: TyCtxt<'_, '_, 'tcx>,
|
||||||
single: Option<DefId>,
|
single: Option<DefId>,
|
||||||
w: &mut W)
|
w: &mut W)
|
||||||
-> io::Result<()>
|
-> io::Result<()>
|
||||||
where W: Write
|
where W: Write
|
||||||
{
|
{
|
||||||
for def_id in dump_mir_def_ids(tcx, single) {
|
for def_id in dump_mir_def_ids(tcx, single) {
|
||||||
|
@ -36,10 +36,10 @@ pub fn write_mir_graphviz<'a, 'tcx, W>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Write a graphviz DOT graph of the MIR.
|
/// Write a graphviz DOT graph of the MIR.
|
||||||
pub fn write_mir_fn_graphviz<'a, 'tcx, W>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
pub fn write_mir_fn_graphviz<'tcx, W>(tcx: TyCtxt<'_, '_, 'tcx>,
|
||||||
nodeid: NodeId,
|
nodeid: NodeId,
|
||||||
mir: &Mir,
|
mir: &Mir,
|
||||||
w: &mut W) -> io::Result<()>
|
w: &mut W) -> io::Result<()>
|
||||||
where W: Write
|
where W: Write
|
||||||
{
|
{
|
||||||
writeln!(w, "digraph Mir_{} {{", nodeid)?;
|
writeln!(w, "digraph Mir_{} {{", nodeid)?;
|
||||||
|
@ -137,11 +137,11 @@ fn write_edges<W: Write>(source: BasicBlock, mir: &Mir, w: &mut W) -> io::Result
|
||||||
/// Write the graphviz DOT label for the overall graph. This is essentially a block of text that
|
/// Write the graphviz DOT label for the overall graph. This is essentially a block of text that
|
||||||
/// will appear below the graph, showing the type of the `fn` this MIR represents and the types of
|
/// will appear below the graph, showing the type of the `fn` this MIR represents and the types of
|
||||||
/// all the variables and temporaries.
|
/// all the variables and temporaries.
|
||||||
fn write_graph_label<'a, 'tcx, W: Write>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
fn write_graph_label<'a, 'gcx, 'tcx, W: Write>(tcx: TyCtxt<'a, 'gcx, 'tcx>,
|
||||||
nid: NodeId,
|
nid: NodeId,
|
||||||
mir: &Mir,
|
mir: &Mir,
|
||||||
w: &mut W)
|
w: &mut W)
|
||||||
-> io::Result<()> {
|
-> io::Result<()> {
|
||||||
write!(w, " label=<fn {}(", dot::escape_html(&tcx.node_path_str(nid)))?;
|
write!(w, " label=<fn {}(", dot::escape_html(&tcx.node_path_str(nid)))?;
|
||||||
|
|
||||||
// fn argument types.
|
// fn argument types.
|
||||||
|
|
Loading…
Reference in a new issue