@@ -210,13 +210,23 @@ pub(crate) fn compute_regions<'cx, 'tcx>(
210
210
}
211
211
}
212
212
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 > (
214
223
infcx : & BorrowckInferCtxt < ' tcx > ,
215
224
body : & Body < ' tcx > ,
216
225
regioncx : & RegionInferenceContext < ' tcx > ,
217
226
closure_region_requirements : & Option < ClosureRegionRequirements < ' tcx > > ,
218
227
) {
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 ( ) ) {
220
230
return ;
221
231
}
222
232
@@ -230,7 +240,7 @@ pub(super) fn dump_mir_results<'tcx>(
230
240
) ,
231
241
} ;
232
242
dump_mir_with_options (
233
- infcx . tcx ,
243
+ tcx,
234
244
false ,
235
245
"nll" ,
236
246
& 0 ,
@@ -239,16 +249,14 @@ pub(super) fn dump_mir_results<'tcx>(
239
249
match pass_where {
240
250
// Before the CFG, dump out the values for each region variable.
241
251
PassWhere :: BeforeCFG => {
242
- regioncx. dump_mir ( infcx . tcx , out) ?;
252
+ regioncx. dump_mir ( tcx, out) ?;
243
253
writeln ! ( out, "|" ) ?;
244
254
245
255
if let Some ( closure_region_requirements) = closure_region_requirements {
246
256
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
+ } ) ?;
252
260
writeln ! ( out, "|" ) ?;
253
261
}
254
262
}
@@ -264,15 +272,15 @@ pub(super) fn dump_mir_results<'tcx>(
264
272
options,
265
273
) ;
266
274
267
- // Also dump the inference graph constraints as a graphviz file.
275
+ // Also dump the region constraint graph as a graphviz file.
268
276
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) ?;
270
278
regioncx. dump_graphviz_raw_constraints ( & mut file) ?;
271
279
} ;
272
280
273
- // Also dump the inference graph constraints as a graphviz file.
281
+ // Also dump the region constraint SCC graph as a graphviz file.
274
282
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) ?;
276
284
regioncx. dump_graphviz_scc_constraints ( & mut file) ?;
277
285
} ;
278
286
}
0 commit comments