@@ -112,7 +112,7 @@ pub fn compile_input(sess: &Session,
112
112
let expanded_crate = phase_2_configure_and_expand ( sess,
113
113
& cstore,
114
114
krate,
115
- & id[ .. ] ,
115
+ & id,
116
116
addl_plugins) ?;
117
117
118
118
( outputs, expanded_crate, id)
@@ -123,8 +123,10 @@ pub fn compile_input(sess: &Session,
123
123
CompileState :: state_after_expand( input,
124
124
sess,
125
125
outdir,
126
+ output,
127
+ & cstore,
126
128
& expanded_crate,
127
- & id[ .. ] ) ,
129
+ & id) ,
128
130
Ok ( ( ) ) ) ;
129
131
130
132
let expanded_crate = assign_node_ids ( sess, expanded_crate) ;
@@ -169,10 +171,13 @@ pub fn compile_input(sess: &Session,
169
171
CompileState :: state_after_write_deps( input,
170
172
sess,
171
173
outdir,
174
+ output,
175
+ & arenas,
176
+ & cstore,
172
177
& hir_map,
173
178
& expanded_crate,
174
179
& hir_map. krate( ) ,
175
- & id[ .. ] ) ,
180
+ & id) ,
176
181
Ok ( ( ) ) ) ;
177
182
}
178
183
@@ -202,8 +207,9 @@ pub fn compile_input(sess: &Session,
202
207
let _ignore = tcx. dep_graph . in_ignore ( ) ;
203
208
204
209
let mut state = CompileState :: state_after_analysis ( input,
205
- & tcx . sess ,
210
+ sess,
206
211
outdir,
212
+ output,
207
213
opt_crate,
208
214
tcx. map . krate ( ) ,
209
215
& analysis,
@@ -243,7 +249,7 @@ pub fn compile_input(sess: &Session,
243
249
244
250
controller_entry_point ! ( after_llvm,
245
251
sess,
246
- CompileState :: state_after_llvm( input, sess, outdir, & trans) ,
252
+ CompileState :: state_after_llvm( input, sess, outdir, output , & trans) ,
247
253
phase5_result) ;
248
254
phase5_result?;
249
255
@@ -334,34 +340,36 @@ impl<'a> PhaseController<'a> {
334
340
/// State that is passed to a callback. What state is available depends on when
335
341
/// during compilation the callback is made. See the various constructor methods
336
342
/// (`state_*`) in the impl to see which data is provided for any given entry point.
337
- pub struct CompileState < ' a , ' ast : ' a , ' tcx : ' a > {
343
+ pub struct CompileState < ' a , ' b , ' ast : ' a , ' tcx : ' b > where ' ast : ' tcx {
338
344
pub input : & ' a Input ,
339
- pub session : & ' a Session ,
345
+ pub session : & ' ast Session ,
340
346
pub krate : Option < ast:: Crate > ,
341
347
pub cstore : Option < & ' a CStore > ,
342
348
pub crate_name : Option < & ' a str > ,
343
349
pub output_filenames : Option < & ' a OutputFilenames > ,
344
350
pub out_dir : Option < & ' a Path > ,
345
351
pub out_file : Option < & ' a Path > ,
352
+ pub arenas : Option < & ' ast ty:: CtxtArenas < ' ast > > ,
346
353
pub expanded_crate : Option < & ' a ast:: Crate > ,
347
354
pub hir_crate : Option < & ' a hir:: Crate > ,
348
355
pub ast_map : Option < & ' a hir_map:: Map < ' ast > > ,
349
- pub mir_map : Option < & ' a MirMap < ' tcx > > ,
356
+ pub mir_map : Option < & ' b MirMap < ' tcx > > ,
350
357
pub analysis : Option < & ' a ty:: CrateAnalysis < ' a > > ,
351
- pub tcx : Option < & ' a TyCtxt < ' tcx > > ,
358
+ pub tcx : Option < & ' b TyCtxt < ' tcx > > ,
352
359
pub trans : Option < & ' a trans:: CrateTranslation > ,
353
360
}
354
361
355
- impl < ' a , ' ast , ' tcx > CompileState < ' a , ' ast , ' tcx > {
362
+ impl < ' a , ' b , ' ast , ' tcx > CompileState < ' a , ' b , ' ast , ' tcx > {
356
363
fn empty ( input : & ' a Input ,
357
- session : & ' a Session ,
364
+ session : & ' ast Session ,
358
365
out_dir : & ' a Option < PathBuf > )
359
- -> CompileState < ' a , ' ast , ' tcx > {
366
+ -> CompileState < ' a , ' b , ' ast , ' tcx > {
360
367
CompileState {
361
368
input : input,
362
369
session : session,
363
370
out_dir : out_dir. as_ref ( ) . map ( |s| & * * s) ,
364
371
out_file : None ,
372
+ arenas : None ,
365
373
krate : None ,
366
374
cstore : None ,
367
375
crate_name : None ,
@@ -377,12 +385,12 @@ impl<'a, 'ast, 'tcx> CompileState<'a, 'ast, 'tcx> {
377
385
}
378
386
379
387
fn state_after_parse ( input : & ' a Input ,
380
- session : & ' a Session ,
388
+ session : & ' ast Session ,
381
389
out_dir : & ' a Option < PathBuf > ,
382
390
out_file : & ' a Option < PathBuf > ,
383
391
krate : ast:: Crate ,
384
392
cstore : & ' a CStore )
385
- -> CompileState < ' a , ' ast , ' tcx > {
393
+ -> CompileState < ' a , ' b , ' ast , ' tcx > {
386
394
CompileState {
387
395
krate : Some ( krate) ,
388
396
cstore : Some ( cstore) ,
@@ -392,63 +400,80 @@ impl<'a, 'ast, 'tcx> CompileState<'a, 'ast, 'tcx> {
392
400
}
393
401
394
402
fn state_after_expand ( input : & ' a Input ,
395
- session : & ' a Session ,
403
+ session : & ' ast Session ,
396
404
out_dir : & ' a Option < PathBuf > ,
405
+ out_file : & ' a Option < PathBuf > ,
406
+ cstore : & ' a CStore ,
397
407
expanded_crate : & ' a ast:: Crate ,
398
408
crate_name : & ' a str )
399
- -> CompileState < ' a , ' ast , ' tcx > {
409
+ -> CompileState < ' a , ' b , ' ast , ' tcx > {
400
410
CompileState {
401
411
crate_name : Some ( crate_name) ,
412
+ cstore : Some ( cstore) ,
402
413
expanded_crate : Some ( expanded_crate) ,
414
+ out_file : out_file. as_ref ( ) . map ( |s| & * * s) ,
403
415
..CompileState :: empty ( input, session, out_dir)
404
416
}
405
417
}
406
418
407
419
fn state_after_write_deps ( input : & ' a Input ,
408
- session : & ' a Session ,
420
+ session : & ' ast Session ,
409
421
out_dir : & ' a Option < PathBuf > ,
422
+ out_file : & ' a Option < PathBuf > ,
423
+ arenas : & ' ast ty:: CtxtArenas < ' ast > ,
424
+ cstore : & ' a CStore ,
410
425
hir_map : & ' a hir_map:: Map < ' ast > ,
411
426
krate : & ' a ast:: Crate ,
412
427
hir_crate : & ' a hir:: Crate ,
413
428
crate_name : & ' a str )
414
- -> CompileState < ' a , ' ast , ' tcx > {
429
+ -> CompileState < ' a , ' b , ' ast , ' tcx > {
415
430
CompileState {
416
431
crate_name : Some ( crate_name) ,
432
+ arenas : Some ( arenas) ,
433
+ cstore : Some ( cstore) ,
417
434
ast_map : Some ( hir_map) ,
418
435
expanded_crate : Some ( krate) ,
419
436
hir_crate : Some ( hir_crate) ,
437
+ out_file : out_file. as_ref ( ) . map ( |s| & * * s) ,
420
438
..CompileState :: empty ( input, session, out_dir)
421
439
}
422
440
}
423
441
424
442
fn state_after_analysis ( input : & ' a Input ,
425
- session : & ' a Session ,
443
+ session : & ' ast Session ,
426
444
out_dir : & ' a Option < PathBuf > ,
445
+ out_file : & ' a Option < PathBuf > ,
427
446
krate : Option < & ' a ast:: Crate > ,
428
447
hir_crate : & ' a hir:: Crate ,
429
- analysis : & ' a ty:: CrateAnalysis ,
430
- mir_map : Option < & ' a MirMap < ' tcx > > ,
431
- tcx : & ' a TyCtxt < ' tcx > ,
448
+ analysis : & ' a ty:: CrateAnalysis < ' a > ,
449
+ mir_map : Option < & ' b MirMap < ' tcx > > ,
450
+ tcx : & ' b TyCtxt < ' tcx > ,
432
451
crate_name : & ' a str )
433
- -> CompileState < ' a , ' ast , ' tcx > {
452
+ -> CompileState < ' a , ' b , ' ast , ' tcx > {
434
453
CompileState {
435
454
analysis : Some ( analysis) ,
436
455
mir_map : mir_map,
437
456
tcx : Some ( tcx) ,
438
457
expanded_crate : krate,
439
458
hir_crate : Some ( hir_crate) ,
440
459
crate_name : Some ( crate_name) ,
460
+ out_file : out_file. as_ref ( ) . map ( |s| & * * s) ,
441
461
..CompileState :: empty ( input, session, out_dir)
442
462
}
443
463
}
444
464
445
465
446
466
fn state_after_llvm ( input : & ' a Input ,
447
- session : & ' a Session ,
467
+ session : & ' ast Session ,
448
468
out_dir : & ' a Option < PathBuf > ,
469
+ out_file : & ' a Option < PathBuf > ,
449
470
trans : & ' a trans:: CrateTranslation )
450
- -> CompileState < ' a , ' ast , ' tcx > {
451
- CompileState { trans : Some ( trans) , ..CompileState :: empty ( input, session, out_dir) }
471
+ -> CompileState < ' a , ' b , ' ast , ' tcx > {
472
+ CompileState {
473
+ trans : Some ( trans) ,
474
+ out_file : out_file. as_ref ( ) . map ( |s| & * * s) ,
475
+ ..CompileState :: empty ( input, session, out_dir)
476
+ }
452
477
}
453
478
}
454
479
@@ -814,16 +839,16 @@ pub fn phase_3_run_analysis_passes<'tcx, F, R>(sess: &'tcx Session,
814
839
let index = stability:: Index :: new ( & hir_map) ;
815
840
816
841
TyCtxt :: create_and_enter ( sess,
817
- arenas,
818
- def_map,
819
- named_region_map,
820
- hir_map,
821
- freevars,
822
- region_map,
823
- lang_items,
824
- index,
825
- name,
826
- |tcx| {
842
+ arenas,
843
+ def_map,
844
+ named_region_map,
845
+ hir_map,
846
+ freevars,
847
+ region_map,
848
+ lang_items,
849
+ index,
850
+ name,
851
+ |tcx| {
827
852
time ( time_passes,
828
853
"load_dep_graph" ,
829
854
|| rustc_incremental:: load_dep_graph ( tcx) ) ;
0 commit comments