@@ -700,14 +700,14 @@ impl fold::Folder for ReplaceBodyWithLoop {
700700 }
701701}
702702
703- pub fn pretty_print_input ( sess : Session ,
703+ pub fn pretty_print_input ( sess : & Session ,
704704 cstore : & CStore ,
705705 cfg : ast:: CrateConfig ,
706706 input : & Input ,
707707 ppm : PpMode ,
708708 opt_uii : Option < UserIdentifiedItem > ,
709709 ofile : Option < PathBuf > ) {
710- let krate = panictry ! ( driver:: phase_1_parse_input( & sess, cfg, input) ) ;
710+ let krate = panictry ! ( driver:: phase_1_parse_input( sess, cfg, input) ) ;
711711
712712 let krate = if let PpmSource ( PpmEveryBodyLoops ) = ppm {
713713 let mut fold = ReplaceBodyWithLoop :: new ( ) ;
@@ -716,14 +716,14 @@ pub fn pretty_print_input(sess: Session,
716716 krate
717717 } ;
718718
719- let id = link:: find_crate_name ( Some ( & sess) , & krate. attrs , input) ;
719+ let id = link:: find_crate_name ( Some ( sess) , & krate. attrs , input) ;
720720
721721 let is_expanded = needs_expansion ( & ppm) ;
722722 let compute_ast_map = needs_ast_map ( & ppm, & opt_uii) ;
723723 let krate = if compute_ast_map {
724- match driver:: phase_2_configure_and_expand ( & sess, & cstore, krate, & id, None ) {
724+ match driver:: phase_2_configure_and_expand ( sess, & cstore, krate, & id, None ) {
725725 Err ( _) => return ,
726- Ok ( k) => driver:: assign_node_ids ( & sess, k) ,
726+ Ok ( k) => driver:: assign_node_ids ( sess, k) ,
727727 }
728728 } else {
729729 krate
@@ -739,11 +739,12 @@ pub fn pretty_print_input(sess: Session,
739739 let ast_map = if compute_ast_map {
740740 _defs = Some ( RefCell :: new ( hir_map:: collect_definitions ( & krate) ) ) ;
741741 let defs = _defs. as_ref ( ) . unwrap ( ) ;
742- LocalCrateReader :: new ( & sess, & cstore, defs, & krate, & id) . read_crates ( & dep_graph) ;
743- let lcx = LoweringContext :: new ( & sess, Some ( & krate) , defs) ;
742+ LocalCrateReader :: new ( sess, & cstore, defs, & krate, & id) . read_crates ( & dep_graph) ;
743+ let lcx = LoweringContext :: new ( sess, Some ( & krate) , defs) ;
744744
745745 hir_forest = hir_map:: Forest :: new ( lower_crate ( & lcx, & krate) , dep_graph. clone ( ) ) ;
746- Some ( hir_map:: map_crate ( & mut hir_forest, defs) )
746+ let map = hir_map:: map_crate ( & mut hir_forest, defs) ;
747+ Some ( map)
747748 } else {
748749 None
749750 } ;
@@ -764,7 +765,7 @@ pub fn pretty_print_input(sess: Session,
764765 ( PpmSource ( s) , _) => {
765766 // Silently ignores an identified node.
766767 let out: & mut Write = & mut out;
767- s. call_with_pp_support ( & sess, ast_map, box out, |annotation, out| {
768+ s. call_with_pp_support ( sess, ast_map, box out, |annotation, out| {
768769 debug ! ( "pretty printing source code {:?}" , s) ;
769770 let sess = annotation. sess ( ) ;
770771 pprust:: print_crate ( sess. codemap ( ) ,
@@ -780,7 +781,7 @@ pub fn pretty_print_input(sess: Session,
780781
781782 ( PpmHir ( s) , None ) => {
782783 let out: & mut Write = & mut out;
783- s. call_with_pp_support_hir ( & sess,
784+ s. call_with_pp_support_hir ( sess,
784785 & ast_map. unwrap ( ) ,
785786 & arenas,
786787 & id,
@@ -801,7 +802,7 @@ pub fn pretty_print_input(sess: Session,
801802
802803 ( PpmHir ( s) , Some ( uii) ) => {
803804 let out: & mut Write = & mut out;
804- s. call_with_pp_support_hir ( & sess,
805+ s. call_with_pp_support_hir ( sess,
805806 & ast_map. unwrap ( ) ,
806807 & arenas,
807808 & id,
@@ -836,12 +837,12 @@ pub fn pretty_print_input(sess: Session,
836837 let ast_map = ast_map. expect ( "--unpretty missing ast_map" ) ;
837838 let nodeid = if let Some ( uii) = uii {
838839 debug ! ( "pretty printing MIR for {:?}" , uii) ;
839- Some ( uii. to_one_node_id ( "--unpretty" , & sess, & ast_map) )
840+ Some ( uii. to_one_node_id ( "--unpretty" , sess, & ast_map) )
840841 } else {
841842 debug ! ( "pretty printing MIR for whole crate" ) ;
842843 None
843844 } ;
844- abort_on_err ( driver:: phase_3_run_analysis_passes ( & sess,
845+ abort_on_err ( driver:: phase_3_run_analysis_passes ( sess,
845846 ast_map,
846847 & arenas,
847848 & id,
@@ -864,7 +865,7 @@ pub fn pretty_print_input(sess: Session,
864865 }
865866 }
866867 Ok ( ( ) )
867- } ) , & sess)
868+ } ) , sess)
868869 }
869870
870871 ( PpmFlowGraph ( mode) , opt_uii) => {
@@ -876,7 +877,7 @@ pub fn pretty_print_input(sess: Session,
876877
877878 } ) ;
878879 let ast_map = ast_map. expect ( "--pretty flowgraph missing ast_map" ) ;
879- let nodeid = uii. to_one_node_id ( "--pretty" , & sess, & ast_map) ;
880+ let nodeid = uii. to_one_node_id ( "--pretty" , sess, & ast_map) ;
880881
881882 let node = ast_map. find ( nodeid) . unwrap_or_else ( || {
882883 sess. fatal ( & format ! ( "--pretty flowgraph couldn't find id: {}" , nodeid) )
@@ -886,8 +887,8 @@ pub fn pretty_print_input(sess: Session,
886887 let out: & mut Write = & mut out;
887888 match code {
888889 Some ( code) => {
889- let variants = gather_flowgraph_variants ( & sess) ;
890- abort_on_err ( driver:: phase_3_run_analysis_passes ( & sess,
890+ let variants = gather_flowgraph_variants ( sess) ;
891+ abort_on_err ( driver:: phase_3_run_analysis_passes ( sess,
891892 ast_map,
892893 & arenas,
893894 & id,
@@ -899,7 +900,7 @@ pub fn pretty_print_input(sess: Session,
899900 code,
900901 mode,
901902 out)
902- } ) , & sess)
903+ } ) , sess)
903904 }
904905 None => {
905906 let message = format ! ( "--pretty=flowgraph needs block, fn, or method; got \
0 commit comments