@@ -728,11 +728,11 @@ pub fn print_after_parsing(sess: &Session,
728728 let ( src, src_name) = get_source ( input, sess) ;
729729
730730 let mut rdr = & * src;
731- let mut out = Vec :: new ( ) ;
731+ let mut out = String :: new ( ) ;
732732
733733 if let PpmSource ( s) = ppm {
734734 // Silently ignores an identified node.
735- let out: & mut dyn Write = & mut out;
735+ let out = & mut out;
736736 s. call_with_pp_support ( sess, None , move |annotation| {
737737 debug ! ( "pretty printing source code {:?}" , s) ;
738738 let sess = annotation. sess ( ) ;
@@ -741,15 +741,15 @@ pub fn print_after_parsing(sess: &Session,
741741 krate,
742742 src_name,
743743 & mut rdr,
744- box out,
744+ out,
745745 annotation. pp_ann ( ) ,
746746 false )
747747 } ) . unwrap ( )
748748 } else {
749749 unreachable ! ( ) ;
750750 } ;
751751
752- write_output ( out, ofile) ;
752+ write_output ( out. into_bytes ( ) , ofile) ;
753753}
754754
755755pub fn print_after_hir_lowering < ' tcx > (
@@ -773,12 +773,12 @@ pub fn print_after_hir_lowering<'tcx>(
773773 let ( src, src_name) = get_source ( input, tcx. sess ) ;
774774
775775 let mut rdr = & src[ ..] ;
776- let mut out = Vec :: new ( ) ;
776+ let mut out = String :: new ( ) ;
777777
778778 match ( ppm, opt_uii) {
779779 ( PpmSource ( s) , _) => {
780780 // Silently ignores an identified node.
781- let out: & mut dyn Write = & mut out;
781+ let out = & mut out;
782782 s. call_with_pp_support ( tcx. sess , Some ( tcx) , move |annotation| {
783783 debug ! ( "pretty printing source code {:?}" , s) ;
784784 let sess = annotation. sess ( ) ;
@@ -787,14 +787,14 @@ pub fn print_after_hir_lowering<'tcx>(
787787 krate,
788788 src_name,
789789 & mut rdr,
790- box out,
790+ out,
791791 annotation. pp_ann ( ) ,
792792 true )
793793 } )
794794 }
795795
796796 ( PpmHir ( s) , None ) => {
797- let out: & mut dyn Write = & mut out;
797+ let out = & mut out;
798798 s. call_with_pp_support_hir ( tcx, move |annotation, krate| {
799799 debug ! ( "pretty printing source code {:?}" , s) ;
800800 let sess = annotation. sess ( ) ;
@@ -803,21 +803,21 @@ pub fn print_after_hir_lowering<'tcx>(
803803 krate,
804804 src_name,
805805 & mut rdr,
806- box out,
806+ out,
807807 annotation. pp_ann ( ) )
808808 } )
809809 }
810810
811811 ( PpmHirTree ( s) , None ) => {
812- let out: & mut dyn Write = & mut out;
812+ let out = & mut out;
813813 s. call_with_pp_support_hir ( tcx, move |_annotation, krate| {
814814 debug ! ( "pretty printing source code {:?}" , s) ;
815- write ! ( out, "{:#?}" , krate)
816- } )
815+ * out = format ! ( "{:#?}" , krate) ;
816+ } ) ;
817817 }
818818
819819 ( PpmHir ( s) , Some ( uii) ) => {
820- let out: & mut dyn Write = & mut out;
820+ let out = & mut out;
821821 s. call_with_pp_support_hir ( tcx, move |annotation, _| {
822822 debug ! ( "pretty printing source code {:?}" , s) ;
823823 let sess = annotation. sess ( ) ;
@@ -826,7 +826,7 @@ pub fn print_after_hir_lowering<'tcx>(
826826 & sess. parse_sess ,
827827 src_name,
828828 & mut rdr,
829- box out,
829+ out,
830830 annotation. pp_ann ( ) ) ;
831831 for node_id in uii. all_matching_node_ids ( hir_map) {
832832 let hir_id = tcx. hir ( ) . node_to_hir_id ( node_id) ;
@@ -843,13 +843,13 @@ pub fn print_after_hir_lowering<'tcx>(
843843 }
844844
845845 ( PpmHirTree ( s) , Some ( uii) ) => {
846- let out: & mut dyn Write = & mut out;
846+ let out = & mut out;
847847 s. call_with_pp_support_hir ( tcx, move |_annotation, _krate| {
848848 debug ! ( "pretty printing source code {:?}" , s) ;
849849 for node_id in uii. all_matching_node_ids ( tcx. hir ( ) ) {
850850 let hir_id = tcx. hir ( ) . node_to_hir_id ( node_id) ;
851851 let node = tcx. hir ( ) . get ( hir_id) ;
852- write ! ( out , "{:#?}" , node) ? ;
852+ out . push_str ( & format ! ( "{:#?}" , node) ) ;
853853 }
854854 Ok ( ( ) )
855855 } )
@@ -859,7 +859,7 @@ pub fn print_after_hir_lowering<'tcx>(
859859 }
860860 . unwrap ( ) ;
861861
862- write_output ( out, ofile) ;
862+ write_output ( out. into_bytes ( ) , ofile) ;
863863}
864864
865865// In an ideal world, this would be a public function called by the driver after
0 commit comments