@@ -8,12 +8,11 @@ use rustc_data_structures::svh::Svh;
8
8
use rustc_data_structures:: sync:: { Lrc , OnceCell , WorkerLocal } ;
9
9
use rustc_errors:: ErrorReported ;
10
10
use rustc_hir:: def_id:: LOCAL_CRATE ;
11
- use rustc_hir:: Crate ;
12
11
use rustc_incremental:: DepGraphFuture ;
13
12
use rustc_lint:: LintStore ;
14
13
use rustc_middle:: arena:: Arena ;
15
14
use rustc_middle:: dep_graph:: DepGraph ;
16
- use rustc_middle:: ty:: { GlobalCtxt , ResolverOutputs , TyCtxt } ;
15
+ use rustc_middle:: ty:: { GlobalCtxt , TyCtxt } ;
17
16
use rustc_query_impl:: Queries as TcxQueries ;
18
17
use rustc_serialize:: json;
19
18
use rustc_session:: config:: { self , OutputFilenames , OutputType } ;
@@ -83,7 +82,6 @@ pub struct Queries<'tcx> {
83
82
register_plugins : Query < ( ast:: Crate , Lrc < LintStore > ) > ,
84
83
expansion : Query < ( ast:: Crate , Steal < Rc < RefCell < BoxedResolver > > > , Lrc < LintStore > ) > ,
85
84
dep_graph : Query < DepGraph > ,
86
- lower_to_hir : Query < ( & ' tcx Crate < ' tcx > , Steal < ResolverOutputs > ) > ,
87
85
prepare_outputs : Query < OutputFilenames > ,
88
86
global_ctxt : Query < QueryContext < ' tcx > > ,
89
87
ongoing_codegen : Query < Box < dyn Any > > ,
@@ -103,7 +101,6 @@ impl<'tcx> Queries<'tcx> {
103
101
register_plugins : Default :: default ( ) ,
104
102
expansion : Default :: default ( ) ,
105
103
dep_graph : Default :: default ( ) ,
106
- lower_to_hir : Default :: default ( ) ,
107
104
prepare_outputs : Default :: default ( ) ,
108
105
global_ctxt : Default :: default ( ) ,
109
106
ongoing_codegen : Default :: default ( ) ,
@@ -117,7 +114,7 @@ impl<'tcx> Queries<'tcx> {
117
114
& self . compiler . codegen_backend ( )
118
115
}
119
116
120
- pub fn dep_graph_future ( & self ) -> Result < & Query < Option < DepGraphFuture > > > {
117
+ fn dep_graph_future ( & self ) -> Result < & Query < Option < DepGraphFuture > > > {
121
118
self . dep_graph_future . compute ( || {
122
119
let sess = self . session ( ) ;
123
120
Ok ( sess. opts . build_dep_graph ( ) . then ( || rustc_incremental:: load_dep_graph ( sess) ) )
@@ -191,7 +188,7 @@ impl<'tcx> Queries<'tcx> {
191
188
} )
192
189
}
193
190
194
- pub fn dep_graph ( & self ) -> Result < & Query < DepGraph > > {
191
+ fn dep_graph ( & self ) -> Result < & Query < DepGraph > > {
195
192
self . dep_graph . compute ( || {
196
193
let sess = self . session ( ) ;
197
194
let future_opt = self . dep_graph_future ( ) ?. take ( ) ;
@@ -207,28 +204,6 @@ impl<'tcx> Queries<'tcx> {
207
204
} )
208
205
}
209
206
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
-
232
207
pub fn prepare_outputs ( & self ) -> Result < & Query < OutputFilenames > > {
233
208
self . prepare_outputs . compute ( || {
234
209
let expansion_result = self . expansion ( ) ?;
@@ -248,14 +223,24 @@ impl<'tcx> Queries<'tcx> {
248
223
self . global_ctxt . compute ( || {
249
224
let crate_name = self . crate_name ( ) ?. peek ( ) . clone ( ) ;
250
225
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 ( ) ;
253
228
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) ) ;
256
241
Ok ( passes:: create_global_ctxt (
257
242
self . compiler ,
258
- lint_store,
243
+ lint_store. clone ( ) ,
259
244
krate,
260
245
dep_graph,
261
246
resolver_outputs. steal ( ) ,
0 commit comments