@@ -26,11 +26,15 @@ fn render_universe(u: UniverseIndex) -> String {
2626 format ! ( "/{:?}" , u)
2727}
2828
29- fn render_region_vid ( rvid : RegionVid , regioncx : & RegionInferenceContext < ' _ > ) -> String {
29+ fn render_region_vid < ' tcx > (
30+ tcx : TyCtxt < ' tcx > ,
31+ rvid : RegionVid ,
32+ regioncx : & RegionInferenceContext < ' tcx > ,
33+ ) -> String {
3034 let universe_str = render_universe ( regioncx. region_definition ( rvid) . universe ) ;
3135
3236 let external_name_str = if let Some ( external_name) =
33- regioncx. region_definition ( rvid) . external_name . and_then ( |e| e. get_name ( ) )
37+ regioncx. region_definition ( rvid) . external_name . and_then ( |e| e. get_name ( tcx ) )
3438 {
3539 format ! ( " ({external_name})" )
3640 } else {
@@ -42,12 +46,20 @@ fn render_region_vid(rvid: RegionVid, regioncx: &RegionInferenceContext<'_>) ->
4246
4347impl < ' tcx > RegionInferenceContext < ' tcx > {
4448 /// Write out the region constraint graph.
45- pub ( crate ) fn dump_graphviz_raw_constraints ( & self , mut w : & mut dyn Write ) -> io:: Result < ( ) > {
46- dot:: render ( & RawConstraints { regioncx : self } , & mut w)
49+ pub ( crate ) fn dump_graphviz_raw_constraints (
50+ & self ,
51+ tcx : TyCtxt < ' tcx > ,
52+ mut w : & mut dyn Write ,
53+ ) -> io:: Result < ( ) > {
54+ dot:: render ( & RawConstraints { tcx, regioncx : self } , & mut w)
4755 }
4856
4957 /// Write out the region constraint SCC graph.
50- pub ( crate ) fn dump_graphviz_scc_constraints ( & self , mut w : & mut dyn Write ) -> io:: Result < ( ) > {
58+ pub ( crate ) fn dump_graphviz_scc_constraints (
59+ & self ,
60+ tcx : TyCtxt < ' tcx > ,
61+ mut w : & mut dyn Write ,
62+ ) -> io:: Result < ( ) > {
5163 let mut nodes_per_scc: IndexVec < ConstraintSccIndex , _ > =
5264 self . constraint_sccs . all_sccs ( ) . map ( |_| Vec :: new ( ) ) . collect ( ) ;
5365
@@ -56,11 +68,12 @@ impl<'tcx> RegionInferenceContext<'tcx> {
5668 nodes_per_scc[ scc] . push ( region) ;
5769 }
5870
59- dot:: render ( & SccConstraints { regioncx : self , nodes_per_scc } , & mut w)
71+ dot:: render ( & SccConstraints { tcx , regioncx : self , nodes_per_scc } , & mut w)
6072 }
6173}
6274
6375struct RawConstraints < ' a , ' tcx > {
76+ tcx : TyCtxt < ' tcx > ,
6477 regioncx : & ' a RegionInferenceContext < ' tcx > ,
6578}
6679
@@ -78,7 +91,7 @@ impl<'a, 'this, 'tcx> dot::Labeller<'this> for RawConstraints<'a, 'tcx> {
7891 Some ( dot:: LabelText :: LabelStr ( Cow :: Borrowed ( "box" ) ) )
7992 }
8093 fn node_label ( & ' this self , n : & RegionVid ) -> dot:: LabelText < ' this > {
81- dot:: LabelText :: LabelStr ( render_region_vid ( * n, self . regioncx ) . into ( ) )
94+ dot:: LabelText :: LabelStr ( render_region_vid ( self . tcx , * n, self . regioncx ) . into ( ) )
8295 }
8396 fn edge_label ( & ' this self , e : & OutlivesConstraint < ' tcx > ) -> dot:: LabelText < ' this > {
8497 dot:: LabelText :: LabelStr ( render_outlives_constraint ( e) . into ( ) )
@@ -110,6 +123,7 @@ impl<'a, 'this, 'tcx> dot::GraphWalk<'this> for RawConstraints<'a, 'tcx> {
110123}
111124
112125struct SccConstraints < ' a , ' tcx > {
126+ tcx : TyCtxt < ' tcx > ,
113127 regioncx : & ' a RegionInferenceContext < ' tcx > ,
114128 nodes_per_scc : IndexVec < ConstraintSccIndex , Vec < RegionVid > > ,
115129}
@@ -128,8 +142,10 @@ impl<'a, 'this, 'tcx> dot::Labeller<'this> for SccConstraints<'a, 'tcx> {
128142 Some ( dot:: LabelText :: LabelStr ( Cow :: Borrowed ( "box" ) ) )
129143 }
130144 fn node_label ( & ' this self , n : & ConstraintSccIndex ) -> dot:: LabelText < ' this > {
131- let nodes_str =
132- self . nodes_per_scc [ * n] . iter ( ) . map ( |n| render_region_vid ( * n, self . regioncx ) ) . join ( ", " ) ;
145+ let nodes_str = self . nodes_per_scc [ * n]
146+ . iter ( )
147+ . map ( |n| render_region_vid ( self . tcx , * n, self . regioncx ) )
148+ . join ( ", " ) ;
133149 dot:: LabelText :: LabelStr ( format ! ( "SCC({n}) = {{{nodes_str}}}" , n = n. as_usize( ) ) . into ( ) )
134150 }
135151}
0 commit comments