diff --git a/src/librustc_mir/borrow_check/nll/mod.rs b/src/librustc_mir/borrow_check/nll/mod.rs index 26298a289fc..641d7ed342c 100644 --- a/src/librustc_mir/borrow_check/nll/mod.rs +++ b/src/librustc_mir/borrow_check/nll/mod.rs @@ -296,7 +296,7 @@ fn dump_mir_results<'a, 'gcx, 'tcx>( let _: io::Result<()> = do catch { let mut file = pretty::create_dump_file(infcx.tcx, "regioncx.dot", None, "nll", &0, source)?; - regioncx.dump_graphviz(&mut file)?; + regioncx.dump_graphviz_raw_constraints(&mut file)?; }; } diff --git a/src/librustc_mir/borrow_check/nll/region_infer/graphviz.rs b/src/librustc_mir/borrow_check/nll/region_infer/graphviz.rs index 8be51257cd6..2e41c8f8dd6 100644 --- a/src/librustc_mir/borrow_check/nll/region_infer/graphviz.rs +++ b/src/librustc_mir/borrow_check/nll/region_infer/graphviz.rs @@ -19,15 +19,18 @@ use std::io::{self, Write}; use super::*; use borrow_check::nll::constraints::OutlivesConstraint; - impl<'tcx> RegionInferenceContext<'tcx> { /// Write out the region constraint graph. - pub(crate) fn dump_graphviz(&self, mut w: &mut dyn Write) -> io::Result<()> { - dot::render(self, &mut w) + pub(crate) fn dump_graphviz_raw_constraints(&self, mut w: &mut dyn Write) -> io::Result<()> { + dot::render(&RawConstraints { regioncx: self }, &mut w) } } -impl<'this, 'tcx> dot::Labeller<'this> for RegionInferenceContext<'tcx> { +struct RawConstraints<'a, 'tcx: 'a> { + regioncx: &'a RegionInferenceContext<'tcx> +} + +impl<'a, 'this, 'tcx> dot::Labeller<'this> for RawConstraints<'a, 'tcx> { type Node = RegionVid; type Edge = OutlivesConstraint; @@ -48,16 +51,16 @@ impl<'this, 'tcx> dot::Labeller<'this> for RegionInferenceContext<'tcx> { } } -impl<'this, 'tcx> dot::GraphWalk<'this> for RegionInferenceContext<'tcx> { +impl<'a, 'this, 'tcx> dot::GraphWalk<'this> for RawConstraints<'a, 'tcx> { type Node = RegionVid; type Edge = OutlivesConstraint; fn nodes(&'this self) -> dot::Nodes<'this, RegionVid> { - let vids: Vec = self.definitions.indices().collect(); + let vids: Vec = self.regioncx.definitions.indices().collect(); vids.into_cow() } fn edges(&'this self) -> dot::Edges<'this, OutlivesConstraint> { - (&self.constraints.raw[..]).into_cow() + (&self.regioncx.constraints.raw[..]).into_cow() } // Render `a: b` as `a <- b`, indicating the flow