Add user type annotations to MIR dump.

This commit writes the user type annotations to the MIR dump so that
they are visible again.
This commit is contained in:
David Wood 2018-11-25 13:31:34 +01:00
parent 4be7214d30
commit 162dcdc16f
No known key found for this signature in database
GPG key ID: 01760B4F9F53F154
2 changed files with 16 additions and 1 deletions

View file

@ -230,13 +230,14 @@ fn dump_mir_results<'a, 'gcx, 'tcx>(
// Before the CFG, dump out the values for each region variable.
PassWhere::BeforeCFG => {
regioncx.dump_mir(out)?;
writeln!(out, "|")?;
if let Some(closure_region_requirements) = closure_region_requirements {
writeln!(out, "|")?;
writeln!(out, "| Free Region Constraints")?;
for_each_region_constraint(closure_region_requirements, &mut |msg| {
writeln!(out, "| {}", msg)
})?;
writeln!(out, "|")?;
}
}

View file

@ -142,6 +142,7 @@ fn dump_matched_mir_node<'a, 'gcx, 'tcx, F>(
}
writeln!(file, "")?;
extra_data(PassWhere::BeforeCFG, &mut file)?;
write_user_type_annotations(mir, &mut file)?;
write_mir_fn(tcx, source, mir, &mut extra_data, &mut file)?;
extra_data(PassWhere::AfterCFG, &mut file)?;
};
@ -618,6 +619,19 @@ fn write_temp_decls(mir: &Mir, w: &mut dyn Write) -> io::Result<()> {
Ok(())
}
fn write_user_type_annotations(mir: &Mir, w: &mut dyn Write) -> io::Result<()> {
if !mir.user_type_annotations.is_empty() {
writeln!(w, "| User Type Annotations")?;
}
for (index, (span, annotation)) in mir.user_type_annotations.iter_enumerated() {
writeln!(w, "| {:?}: {:?} at {:?}", index.index(), annotation, span)?;
}
if !mir.user_type_annotations.is_empty() {
writeln!(w, "|")?;
}
Ok(())
}
pub fn dump_mir_def_ids(tcx: TyCtxt, single: Option<DefId>) -> Vec<DefId> {
if let Some(i) = single {
vec![i]