@@ -135,7 +135,7 @@ fn dump_matched_mir_node<'tcx, F>(
135135 }
136136 writeln ! ( file) ?;
137137 extra_data ( PassWhere :: BeforeCFG , & mut file) ?;
138- write_user_type_annotations ( body, & mut file) ?;
138+ write_user_type_annotations ( tcx , body, & mut file) ?;
139139 write_mir_fn ( tcx, source, body, & mut extra_data, & mut file) ?;
140140 extra_data ( PassWhere :: AfterCFG , & mut file) ?;
141141 } ;
@@ -351,7 +351,7 @@ fn write_extra<'tcx, F>(tcx: TyCtxt<'tcx>, write: &mut dyn Write, mut visit_op:
351351where
352352 F : FnMut ( & mut ExtraComments < ' tcx > ) ,
353353{
354- let mut extra_comments = ExtraComments { _tcx : tcx, comments : vec ! [ ] } ;
354+ let mut extra_comments = ExtraComments { tcx, comments : vec ! [ ] } ;
355355 visit_op ( & mut extra_comments) ;
356356 for comment in extra_comments. comments {
357357 writeln ! ( write, "{:A$} // {}" , "" , comment, A = ALIGN ) ?;
@@ -360,7 +360,7 @@ where
360360}
361361
362362struct ExtraComments < ' tcx > {
363- _tcx : TyCtxt < ' tcx > , // don't need it now, but bet we will soon
363+ tcx : TyCtxt < ' tcx > ,
364364 comments : Vec < String > ,
365365}
366366
@@ -377,7 +377,7 @@ impl Visitor<'tcx> for ExtraComments<'tcx> {
377377 self . super_constant ( constant, location) ;
378378 let Constant { span, user_ty, literal } = constant;
379379 self . push ( "mir::Constant" ) ;
380- self . push ( & format ! ( "+ span: {:? }" , span) ) ;
380+ self . push ( & format ! ( "+ span: {}" , self . tcx . sess . source_map ( ) . span_to_string ( * span) ) ) ;
381381 if let Some ( user_ty) = user_ty {
382382 self . push ( & format ! ( "+ user_ty: {:?}" , user_ty) ) ;
383383 }
@@ -862,12 +862,22 @@ fn write_mir_sig(
862862 Ok ( ( ) )
863863}
864864
865- fn write_user_type_annotations ( body : & Body < ' _ > , w : & mut dyn Write ) -> io:: Result < ( ) > {
865+ fn write_user_type_annotations (
866+ tcx : TyCtxt < ' _ > ,
867+ body : & Body < ' _ > ,
868+ w : & mut dyn Write ,
869+ ) -> io:: Result < ( ) > {
866870 if !body. user_type_annotations . is_empty ( ) {
867871 writeln ! ( w, "| User Type Annotations" ) ?;
868872 }
869873 for ( index, annotation) in body. user_type_annotations . iter_enumerated ( ) {
870- writeln ! ( w, "| {:?}: {:?} at {:?}" , index. index( ) , annotation. user_ty, annotation. span) ?;
874+ writeln ! (
875+ w,
876+ "| {:?}: {:?} at {}" ,
877+ index. index( ) ,
878+ annotation. user_ty,
879+ tcx. sess. source_map( ) . span_to_string( annotation. span)
880+ ) ?;
871881 }
872882 if !body. user_type_annotations . is_empty ( ) {
873883 writeln ! ( w, "|" ) ?;
0 commit comments