@@ -210,13 +210,23 @@ pub(crate) fn compute_regions<'cx, 'tcx>(
210210 }
211211}
212212
213- pub ( super ) fn dump_mir_results < ' tcx > (
213+ /// `-Zdump-mir=nll` dumps MIR annotated with NLL specific information:
214+ /// - free regions
215+ /// - inferred region values
216+ /// - region liveness
217+ /// - inference constraints and their causes
218+ ///
219+ /// As well as graphviz `.dot` visualizations of:
220+ /// - the region constraints graph
221+ /// - the region SCC graph
222+ pub ( super ) fn dump_nll_mir < ' tcx > (
214223 infcx : & BorrowckInferCtxt < ' tcx > ,
215224 body : & Body < ' tcx > ,
216225 regioncx : & RegionInferenceContext < ' tcx > ,
217226 closure_region_requirements : & Option < ClosureRegionRequirements < ' tcx > > ,
218227) {
219- if !dump_enabled ( infcx. tcx , "nll" , body. source . def_id ( ) ) {
228+ let tcx = infcx. tcx ;
229+ if !dump_enabled ( tcx, "nll" , body. source . def_id ( ) ) {
220230 return ;
221231 }
222232
@@ -230,7 +240,7 @@ pub(super) fn dump_mir_results<'tcx>(
230240 ) ,
231241 } ;
232242 dump_mir_with_options (
233- infcx . tcx ,
243+ tcx,
234244 false ,
235245 "nll" ,
236246 & 0 ,
@@ -239,16 +249,14 @@ pub(super) fn dump_mir_results<'tcx>(
239249 match pass_where {
240250 // Before the CFG, dump out the values for each region variable.
241251 PassWhere :: BeforeCFG => {
242- regioncx. dump_mir ( infcx . tcx , out) ?;
252+ regioncx. dump_mir ( tcx, out) ?;
243253 writeln ! ( out, "|" ) ?;
244254
245255 if let Some ( closure_region_requirements) = closure_region_requirements {
246256 writeln ! ( out, "| Free Region Constraints" ) ?;
247- for_each_region_constraint (
248- infcx. tcx ,
249- closure_region_requirements,
250- & mut |msg| writeln ! ( out, "| {msg}" ) ,
251- ) ?;
257+ for_each_region_constraint ( tcx, closure_region_requirements, & mut |msg| {
258+ writeln ! ( out, "| {msg}" )
259+ } ) ?;
252260 writeln ! ( out, "|" ) ?;
253261 }
254262 }
@@ -264,15 +272,15 @@ pub(super) fn dump_mir_results<'tcx>(
264272 options,
265273 ) ;
266274
267- // Also dump the inference graph constraints as a graphviz file.
275+ // Also dump the region constraint graph as a graphviz file.
268276 let _: io:: Result < ( ) > = try {
269- let mut file = create_dump_file ( infcx . tcx , "regioncx.all.dot" , false , "nll" , & 0 , body) ?;
277+ let mut file = create_dump_file ( tcx, "regioncx.all.dot" , false , "nll" , & 0 , body) ?;
270278 regioncx. dump_graphviz_raw_constraints ( & mut file) ?;
271279 } ;
272280
273- // Also dump the inference graph constraints as a graphviz file.
281+ // Also dump the region constraint SCC graph as a graphviz file.
274282 let _: io:: Result < ( ) > = try {
275- let mut file = create_dump_file ( infcx . tcx , "regioncx.scc.dot" , false , "nll" , & 0 , body) ?;
283+ let mut file = create_dump_file ( tcx, "regioncx.scc.dot" , false , "nll" , & 0 , body) ?;
276284 regioncx. dump_graphviz_scc_constraints ( & mut file) ?;
277285 } ;
278286}
0 commit comments