88// option. This file may not be copied, modified, or distributed
99// except according to those terms.
1010
11+ use rustc:: dep_graph:: DepGraph ;
1112use rustc:: front;
1213use rustc:: front:: map as hir_map;
1314use rustc_mir as mir;
@@ -115,9 +116,11 @@ pub fn compile_input(sess: &Session,
115116 let expanded_crate = assign_node_ids ( sess, expanded_crate) ;
116117 // Lower ast -> hir.
117118 let lcx = LoweringContext :: new ( sess, Some ( & expanded_crate) ) ;
119+ let dep_graph = DepGraph :: new ( sess. opts . build_dep_graph ) ;
118120 let mut hir_forest = time ( sess. time_passes ( ) ,
119121 "lowering ast -> hir" ,
120- || hir_map:: Forest :: new ( lower_crate ( & lcx, & expanded_crate) ) ) ;
122+ || hir_map:: Forest :: new ( lower_crate ( & lcx, & expanded_crate) ,
123+ dep_graph) ) ;
121124
122125 // Discard MTWT tables that aren't required past lowering to HIR.
123126 if !sess. opts . debugging_opts . keep_mtwt_tables &&
@@ -130,17 +133,20 @@ pub fn compile_input(sess: &Session,
130133
131134 write_out_deps ( sess, & outputs, & id) ;
132135
133- controller_entry_point ! ( after_write_deps,
134- sess,
135- CompileState :: state_after_write_deps( input,
136- sess,
137- outdir,
138- & hir_map,
139- & expanded_crate,
140- & hir_map. krate( ) ,
141- & id[ ..] ,
142- & lcx) ,
143- Ok ( ( ) ) ) ;
136+ {
137+ let _ignore = hir_map. dep_graph . in_ignore ( ) ;
138+ controller_entry_point ! ( after_write_deps,
139+ sess,
140+ CompileState :: state_after_write_deps( input,
141+ sess,
142+ outdir,
143+ & hir_map,
144+ & expanded_crate,
145+ & hir_map. krate( ) ,
146+ & id[ ..] ,
147+ & lcx) ,
148+ Ok ( ( ) ) ) ;
149+ }
144150
145151 time ( sess. time_passes ( ) , "attribute checking" , || {
146152 front:: check_attr:: check_crate ( sess, & expanded_crate) ;
@@ -166,6 +172,9 @@ pub fn compile_input(sess: &Session,
166172 control. make_glob_map ,
167173 |tcx, mir_map, analysis, result| {
168174 {
175+ // Eventually, we will want to track plugins.
176+ let _ignore = tcx. dep_graph . in_ignore ( ) ;
177+
169178 let state = CompileState :: state_after_analysis ( input,
170179 & tcx. sess ,
171180 outdir,
@@ -735,11 +744,10 @@ pub fn phase_3_run_analysis_passes<'tcx, F, R>(sess: &'tcx Session,
735744 }
736745
737746 let time_passes = sess. time_passes ( ) ;
738- let krate = hir_map. krate ( ) ;
739747
740748 time ( time_passes,
741749 "external crate/lib resolution" ,
742- || LocalCrateReader :: new ( sess, cstore, & hir_map) . read_crates ( krate ) ) ;
750+ || LocalCrateReader :: new ( sess, cstore, & hir_map) . read_crates ( ) ) ;
743751
744752 let lang_items = try!( time ( time_passes, "language item collection" , || {
745753 sess. track_errors ( || {
@@ -769,28 +777,30 @@ pub fn phase_3_run_analysis_passes<'tcx, F, R>(sess: &'tcx Session,
769777 let named_region_map = try!( time ( time_passes,
770778 "lifetime resolution" ,
771779 || middle:: resolve_lifetime:: krate ( sess,
772- krate ,
780+ & hir_map ,
773781 & def_map. borrow ( ) ) ) ) ;
774782
775783 time ( time_passes,
776784 "looking for entry point" ,
777785 || middle:: entry:: find_entry_point ( sess, & hir_map) ) ;
778786
779787 sess. plugin_registrar_fn . set ( time ( time_passes, "looking for plugin registrar" , || {
780- plugin:: build:: find_plugin_registrar ( sess. diagnostic ( ) , krate )
788+ plugin:: build:: find_plugin_registrar ( sess. diagnostic ( ) , & hir_map )
781789 } ) ) ;
782790
783791 let region_map = time ( time_passes,
784792 "region resolution" ,
785- || middle:: region:: resolve_crate ( sess, krate ) ) ;
793+ || middle:: region:: resolve_crate ( sess, & hir_map ) ) ;
786794
787795 time ( time_passes,
788796 "loop checking" ,
789- || loops:: check_crate ( sess, krate ) ) ;
797+ || loops:: check_crate ( sess, & hir_map ) ) ;
790798
791799 try!( time ( time_passes,
792800 "static item recursion checking" ,
793- || static_recursion:: check_crate ( sess, krate, & def_map. borrow ( ) , & hir_map) ) ) ;
801+ || static_recursion:: check_crate ( sess, & def_map. borrow ( ) , & hir_map) ) ) ;
802+
803+ let index = stability:: Index :: new ( & hir_map) ;
794804
795805 ty:: ctxt:: create_and_enter ( sess,
796806 arenas,
@@ -800,7 +810,7 @@ pub fn phase_3_run_analysis_passes<'tcx, F, R>(sess: &'tcx Session,
800810 freevars,
801811 region_map,
802812 lang_items,
803- stability :: Index :: new ( krate ) ,
813+ index ,
804814 |tcx| {
805815 // passes are timed inside typeck
806816 try_with_f ! ( typeck:: check_crate( tcx, trait_map) , ( tcx, None , analysis) ) ;
@@ -818,7 +828,7 @@ pub fn phase_3_run_analysis_passes<'tcx, F, R>(sess: &'tcx Session,
818828
819829 // Do not move this check past lint
820830 time ( time_passes, "stability index" , || {
821- tcx. stability . borrow_mut ( ) . build ( tcx, krate , & analysis. access_levels )
831+ tcx. stability . borrow_mut ( ) . build ( tcx, & analysis. access_levels )
822832 } ) ;
823833
824834 time ( time_passes,
0 commit comments