@@ -700,14 +700,14 @@ impl fold::Folder for ReplaceBodyWithLoop {
700
700
}
701
701
}
702
702
703
- pub fn pretty_print_input ( sess : Session ,
703
+ pub fn pretty_print_input ( sess : & Session ,
704
704
cstore : & CStore ,
705
705
cfg : ast:: CrateConfig ,
706
706
input : & Input ,
707
707
ppm : PpMode ,
708
708
opt_uii : Option < UserIdentifiedItem > ,
709
709
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) ) ;
711
711
712
712
let krate = if let PpmSource ( PpmEveryBodyLoops ) = ppm {
713
713
let mut fold = ReplaceBodyWithLoop :: new ( ) ;
@@ -716,14 +716,14 @@ pub fn pretty_print_input(sess: Session,
716
716
krate
717
717
} ;
718
718
719
- let id = link:: find_crate_name ( Some ( & sess) , & krate. attrs , input) ;
719
+ let id = link:: find_crate_name ( Some ( sess) , & krate. attrs , input) ;
720
720
721
721
let is_expanded = needs_expansion ( & ppm) ;
722
722
let compute_ast_map = needs_ast_map ( & ppm, & opt_uii) ;
723
723
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 ) {
725
725
Err ( _) => return ,
726
- Ok ( k) => driver:: assign_node_ids ( & sess, k) ,
726
+ Ok ( k) => driver:: assign_node_ids ( sess, k) ,
727
727
}
728
728
} else {
729
729
krate
@@ -739,11 +739,12 @@ pub fn pretty_print_input(sess: Session,
739
739
let ast_map = if compute_ast_map {
740
740
_defs = Some ( RefCell :: new ( hir_map:: collect_definitions ( & krate) ) ) ;
741
741
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) ;
744
744
745
745
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)
747
748
} else {
748
749
None
749
750
} ;
@@ -764,7 +765,7 @@ pub fn pretty_print_input(sess: Session,
764
765
( PpmSource ( s) , _) => {
765
766
// Silently ignores an identified node.
766
767
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| {
768
769
debug ! ( "pretty printing source code {:?}" , s) ;
769
770
let sess = annotation. sess ( ) ;
770
771
pprust:: print_crate ( sess. codemap ( ) ,
@@ -780,7 +781,7 @@ pub fn pretty_print_input(sess: Session,
780
781
781
782
( PpmHir ( s) , None ) => {
782
783
let out: & mut Write = & mut out;
783
- s. call_with_pp_support_hir ( & sess,
784
+ s. call_with_pp_support_hir ( sess,
784
785
& ast_map. unwrap ( ) ,
785
786
& arenas,
786
787
& id,
@@ -801,7 +802,7 @@ pub fn pretty_print_input(sess: Session,
801
802
802
803
( PpmHir ( s) , Some ( uii) ) => {
803
804
let out: & mut Write = & mut out;
804
- s. call_with_pp_support_hir ( & sess,
805
+ s. call_with_pp_support_hir ( sess,
805
806
& ast_map. unwrap ( ) ,
806
807
& arenas,
807
808
& id,
@@ -836,12 +837,12 @@ pub fn pretty_print_input(sess: Session,
836
837
let ast_map = ast_map. expect ( "--unpretty missing ast_map" ) ;
837
838
let nodeid = if let Some ( uii) = uii {
838
839
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) )
840
841
} else {
841
842
debug ! ( "pretty printing MIR for whole crate" ) ;
842
843
None
843
844
} ;
844
- abort_on_err ( driver:: phase_3_run_analysis_passes ( & sess,
845
+ abort_on_err ( driver:: phase_3_run_analysis_passes ( sess,
845
846
ast_map,
846
847
& arenas,
847
848
& id,
@@ -864,7 +865,7 @@ pub fn pretty_print_input(sess: Session,
864
865
}
865
866
}
866
867
Ok ( ( ) )
867
- } ) , & sess)
868
+ } ) , sess)
868
869
}
869
870
870
871
( PpmFlowGraph ( mode) , opt_uii) => {
@@ -876,7 +877,7 @@ pub fn pretty_print_input(sess: Session,
876
877
877
878
} ) ;
878
879
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) ;
880
881
881
882
let node = ast_map. find ( nodeid) . unwrap_or_else ( || {
882
883
sess. fatal ( & format ! ( "--pretty flowgraph couldn't find id: {}" , nodeid) )
@@ -886,8 +887,8 @@ pub fn pretty_print_input(sess: Session,
886
887
let out: & mut Write = & mut out;
887
888
match code {
888
889
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,
891
892
ast_map,
892
893
& arenas,
893
894
& id,
@@ -899,7 +900,7 @@ pub fn pretty_print_input(sess: Session,
899
900
code,
900
901
mode,
901
902
out)
902
- } ) , & sess)
903
+ } ) , sess)
903
904
}
904
905
None => {
905
906
let message = format ! ( "--pretty=flowgraph needs block, fn, or method; got \
0 commit comments