@@ -8,12 +8,11 @@ use rustc_data_structures::svh::Svh;
88use rustc_data_structures:: sync:: { Lrc , OnceCell , WorkerLocal } ;
99use rustc_errors:: ErrorReported ;
1010use rustc_hir:: def_id:: LOCAL_CRATE ;
11- use rustc_hir:: Crate ;
1211use rustc_incremental:: DepGraphFuture ;
1312use rustc_lint:: LintStore ;
1413use rustc_middle:: arena:: Arena ;
1514use rustc_middle:: dep_graph:: DepGraph ;
16- use rustc_middle:: ty:: { GlobalCtxt , ResolverOutputs , TyCtxt } ;
15+ use rustc_middle:: ty:: { GlobalCtxt , TyCtxt } ;
1716use rustc_query_impl:: Queries as TcxQueries ;
1817use rustc_serialize:: json;
1918use rustc_session:: config:: { self , OutputFilenames , OutputType } ;
@@ -83,7 +82,6 @@ pub struct Queries<'tcx> {
8382 register_plugins : Query < ( ast:: Crate , Lrc < LintStore > ) > ,
8483 expansion : Query < ( ast:: Crate , Steal < Rc < RefCell < BoxedResolver > > > , Lrc < LintStore > ) > ,
8584 dep_graph : Query < DepGraph > ,
86- lower_to_hir : Query < ( & ' tcx Crate < ' tcx > , Steal < ResolverOutputs > ) > ,
8785 prepare_outputs : Query < OutputFilenames > ,
8886 global_ctxt : Query < QueryContext < ' tcx > > ,
8987 ongoing_codegen : Query < Box < dyn Any > > ,
@@ -103,7 +101,6 @@ impl<'tcx> Queries<'tcx> {
103101 register_plugins : Default :: default ( ) ,
104102 expansion : Default :: default ( ) ,
105103 dep_graph : Default :: default ( ) ,
106- lower_to_hir : Default :: default ( ) ,
107104 prepare_outputs : Default :: default ( ) ,
108105 global_ctxt : Default :: default ( ) ,
109106 ongoing_codegen : Default :: default ( ) ,
@@ -117,7 +114,7 @@ impl<'tcx> Queries<'tcx> {
117114 & self . compiler . codegen_backend ( )
118115 }
119116
120- pub fn dep_graph_future ( & self ) -> Result < & Query < Option < DepGraphFuture > > > {
117+ fn dep_graph_future ( & self ) -> Result < & Query < Option < DepGraphFuture > > > {
121118 self . dep_graph_future . compute ( || {
122119 let sess = self . session ( ) ;
123120 Ok ( sess. opts . build_dep_graph ( ) . then ( || rustc_incremental:: load_dep_graph ( sess) ) )
@@ -191,7 +188,7 @@ impl<'tcx> Queries<'tcx> {
191188 } )
192189 }
193190
194- pub fn dep_graph ( & self ) -> Result < & Query < DepGraph > > {
191+ fn dep_graph ( & self ) -> Result < & Query < DepGraph > > {
195192 self . dep_graph . compute ( || {
196193 let sess = self . session ( ) ;
197194 let future_opt = self . dep_graph_future ( ) ?. take ( ) ;
@@ -207,28 +204,6 @@ impl<'tcx> Queries<'tcx> {
207204 } )
208205 }
209206
210- pub fn lower_to_hir ( & ' tcx self ) -> Result < & Query < ( & ' tcx Crate < ' tcx > , Steal < ResolverOutputs > ) > > {
211- self . lower_to_hir . compute ( || {
212- let expansion_result = self . expansion ( ) ?;
213- let peeked = expansion_result. peek ( ) ;
214- let krate = & peeked. 0 ;
215- let resolver = peeked. 1 . steal ( ) ;
216- let lint_store = & peeked. 2 ;
217- let hir = resolver. borrow_mut ( ) . access ( |resolver| {
218- Ok ( passes:: lower_to_hir (
219- self . session ( ) ,
220- lint_store,
221- resolver,
222- & * self . dep_graph ( ) ?. peek ( ) ,
223- & krate,
224- & self . hir_arena ,
225- ) )
226- } ) ?;
227- let hir = self . hir_arena . alloc ( hir) ;
228- Ok ( ( hir, Steal :: new ( BoxedResolver :: to_resolver_outputs ( resolver) ) ) )
229- } )
230- }
231-
232207 pub fn prepare_outputs ( & self ) -> Result < & Query < OutputFilenames > > {
233208 self . prepare_outputs . compute ( || {
234209 let expansion_result = self . expansion ( ) ?;
@@ -248,14 +223,24 @@ impl<'tcx> Queries<'tcx> {
248223 self . global_ctxt . compute ( || {
249224 let crate_name = self . crate_name ( ) ?. peek ( ) . clone ( ) ;
250225 let outputs = self . prepare_outputs ( ) ?. peek ( ) . clone ( ) ;
251- let lint_store = self . expansion ( ) ?. peek ( ) . 2 . clone ( ) ;
252- let hir = self . lower_to_hir ( ) ? . peek ( ) ;
226+ let ( ref krate , ref resolver , ref lint_store) = & * self . expansion ( ) ?. peek ( ) ;
227+ let resolver = resolver . steal ( ) ;
253228 let dep_graph = self . dep_graph ( ) ?. peek ( ) . clone ( ) ;
254- let ( ref krate, ref resolver_outputs) = & * hir;
255- let _timer = self . session ( ) . timer ( "create_global_ctxt" ) ;
229+ let krate = resolver. borrow_mut ( ) . access ( |resolver| {
230+ Ok ( passes:: lower_to_hir (
231+ self . session ( ) ,
232+ lint_store,
233+ resolver,
234+ & dep_graph,
235+ & krate,
236+ & self . hir_arena ,
237+ ) )
238+ } ) ?;
239+ let krate = self . hir_arena . alloc ( krate) ;
240+ let resolver_outputs = Steal :: new ( BoxedResolver :: to_resolver_outputs ( resolver) ) ;
256241 Ok ( passes:: create_global_ctxt (
257242 self . compiler ,
258- lint_store,
243+ lint_store. clone ( ) ,
259244 krate,
260245 dep_graph,
261246 resolver_outputs. steal ( ) ,
0 commit comments