add borrows to NLL MIR dumps
explicitly disable `-Zmir-include-spans` in mir-opt tests This will override the NLL default of true, and keep the blessed dumps easier to work with.
This commit is contained in:
parent
f3f5b4dcf2
commit
dff3d3588d
6 changed files with 24 additions and 1 deletions
|
@ -229,7 +229,7 @@ fn do_mir_borrowck<'tcx>(
|
|||
|
||||
// Dump MIR results into a file, if that is enabled. This let us
|
||||
// write unit-tests, as well as helping with debugging.
|
||||
nll::dump_nll_mir(&infcx, body, ®ioncx, &opt_closure_req);
|
||||
nll::dump_nll_mir(&infcx, body, ®ioncx, &opt_closure_req, &borrow_set);
|
||||
|
||||
// We also have a `#[rustc_regions]` annotation that causes us to dump
|
||||
// information.
|
||||
|
|
|
@ -224,6 +224,7 @@ pub(super) fn dump_nll_mir<'tcx>(
|
|||
body: &Body<'tcx>,
|
||||
regioncx: &RegionInferenceContext<'tcx>,
|
||||
closure_region_requirements: &Option<ClosureRegionRequirements<'tcx>>,
|
||||
borrow_set: &BorrowSet<'tcx>,
|
||||
) {
|
||||
let tcx = infcx.tcx;
|
||||
if !dump_enabled(tcx, "nll", body.source.def_id()) {
|
||||
|
@ -259,6 +260,18 @@ pub(super) fn dump_nll_mir<'tcx>(
|
|||
})?;
|
||||
writeln!(out, "|")?;
|
||||
}
|
||||
|
||||
if borrow_set.len() > 0 {
|
||||
writeln!(out, "| Borrows")?;
|
||||
for (borrow_idx, borrow_data) in borrow_set.iter_enumerated() {
|
||||
writeln!(
|
||||
out,
|
||||
"| {:?}: issued at {:?} in {:?}",
|
||||
borrow_idx, borrow_data.reserve_location, borrow_data.region
|
||||
)?;
|
||||
}
|
||||
writeln!(out, "|")?;
|
||||
}
|
||||
}
|
||||
|
||||
PassWhere::BeforeLocation(_) => {}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue