@@ -135,7 +135,7 @@ fn dump_matched_mir_node<'tcx, F>(
135
135
}
136
136
writeln ! ( file) ?;
137
137
extra_data ( PassWhere :: BeforeCFG , & mut file) ?;
138
- write_user_type_annotations ( body, & mut file) ?;
138
+ write_user_type_annotations ( tcx , body, & mut file) ?;
139
139
write_mir_fn ( tcx, source, body, & mut extra_data, & mut file) ?;
140
140
extra_data ( PassWhere :: AfterCFG , & mut file) ?;
141
141
} ;
@@ -351,7 +351,7 @@ fn write_extra<'tcx, F>(tcx: TyCtxt<'tcx>, write: &mut dyn Write, mut visit_op:
351
351
where
352
352
F : FnMut ( & mut ExtraComments < ' tcx > ) ,
353
353
{
354
- let mut extra_comments = ExtraComments { _tcx : tcx, comments : vec ! [ ] } ;
354
+ let mut extra_comments = ExtraComments { tcx, comments : vec ! [ ] } ;
355
355
visit_op ( & mut extra_comments) ;
356
356
for comment in extra_comments. comments {
357
357
writeln ! ( write, "{:A$} // {}" , "" , comment, A = ALIGN ) ?;
@@ -360,7 +360,7 @@ where
360
360
}
361
361
362
362
struct ExtraComments < ' tcx > {
363
- _tcx : TyCtxt < ' tcx > , // don't need it now, but bet we will soon
363
+ tcx : TyCtxt < ' tcx > ,
364
364
comments : Vec < String > ,
365
365
}
366
366
@@ -377,7 +377,7 @@ impl Visitor<'tcx> for ExtraComments<'tcx> {
377
377
self . super_constant ( constant, location) ;
378
378
let Constant { span, user_ty, literal } = constant;
379
379
self . push ( "mir::Constant" ) ;
380
- self . push ( & format ! ( "+ span: {:? }" , span) ) ;
380
+ self . push ( & format ! ( "+ span: {}" , self . tcx . sess . source_map ( ) . span_to_string ( * span) ) ) ;
381
381
if let Some ( user_ty) = user_ty {
382
382
self . push ( & format ! ( "+ user_ty: {:?}" , user_ty) ) ;
383
383
}
@@ -862,12 +862,22 @@ fn write_mir_sig(
862
862
Ok ( ( ) )
863
863
}
864
864
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 < ( ) > {
866
870
if !body. user_type_annotations . is_empty ( ) {
867
871
writeln ! ( w, "| User Type Annotations" ) ?;
868
872
}
869
873
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
+ ) ?;
871
881
}
872
882
if !body. user_type_annotations . is_empty ( ) {
873
883
writeln ! ( w, "|" ) ?;
0 commit comments