@@ -112,7 +112,7 @@ pub fn compile_input(sess: &Session,
112112 let expanded_crate = phase_2_configure_and_expand ( sess,
113113 & cstore,
114114 krate,
115- & id[ .. ] ,
115+ & id,
116116 addl_plugins) ?;
117117
118118 ( outputs, expanded_crate, id)
@@ -123,8 +123,10 @@ pub fn compile_input(sess: &Session,
123123 CompileState :: state_after_expand( input,
124124 sess,
125125 outdir,
126+ output,
127+ & cstore,
126128 & expanded_crate,
127- & id[ .. ] ) ,
129+ & id) ,
128130 Ok ( ( ) ) ) ;
129131
130132 let expanded_crate = assign_node_ids ( sess, expanded_crate) ;
@@ -169,10 +171,13 @@ pub fn compile_input(sess: &Session,
169171 CompileState :: state_after_write_deps( input,
170172 sess,
171173 outdir,
174+ output,
175+ & arenas,
176+ & cstore,
172177 & hir_map,
173178 & expanded_crate,
174179 & hir_map. krate( ) ,
175- & id[ .. ] ) ,
180+ & id) ,
176181 Ok ( ( ) ) ) ;
177182 }
178183
@@ -202,8 +207,9 @@ pub fn compile_input(sess: &Session,
202207 let _ignore = tcx. dep_graph . in_ignore ( ) ;
203208
204209 let mut state = CompileState :: state_after_analysis ( input,
205- & tcx . sess ,
210+ sess,
206211 outdir,
212+ output,
207213 opt_crate,
208214 tcx. map . krate ( ) ,
209215 & analysis,
@@ -243,7 +249,7 @@ pub fn compile_input(sess: &Session,
243249
244250 controller_entry_point ! ( after_llvm,
245251 sess,
246- CompileState :: state_after_llvm( input, sess, outdir, & trans) ,
252+ CompileState :: state_after_llvm( input, sess, outdir, output , & trans) ,
247253 phase5_result) ;
248254 phase5_result?;
249255
@@ -334,34 +340,36 @@ impl<'a> PhaseController<'a> {
334340/// State that is passed to a callback. What state is available depends on when
335341/// during compilation the callback is made. See the various constructor methods
336342/// (`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 {
338344 pub input : & ' a Input ,
339- pub session : & ' a Session ,
345+ pub session : & ' ast Session ,
340346 pub krate : Option < ast:: Crate > ,
341347 pub cstore : Option < & ' a CStore > ,
342348 pub crate_name : Option < & ' a str > ,
343349 pub output_filenames : Option < & ' a OutputFilenames > ,
344350 pub out_dir : Option < & ' a Path > ,
345351 pub out_file : Option < & ' a Path > ,
352+ pub arenas : Option < & ' ast ty:: CtxtArenas < ' ast > > ,
346353 pub expanded_crate : Option < & ' a ast:: Crate > ,
347354 pub hir_crate : Option < & ' a hir:: Crate > ,
348355 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 > > ,
350357 pub analysis : Option < & ' a ty:: CrateAnalysis < ' a > > ,
351- pub tcx : Option < & ' a TyCtxt < ' tcx > > ,
358+ pub tcx : Option < & ' b TyCtxt < ' tcx > > ,
352359 pub trans : Option < & ' a trans:: CrateTranslation > ,
353360}
354361
355- impl < ' a , ' ast , ' tcx > CompileState < ' a , ' ast , ' tcx > {
362+ impl < ' a , ' b , ' ast , ' tcx > CompileState < ' a , ' b , ' ast , ' tcx > {
356363 fn empty ( input : & ' a Input ,
357- session : & ' a Session ,
364+ session : & ' ast Session ,
358365 out_dir : & ' a Option < PathBuf > )
359- -> CompileState < ' a , ' ast , ' tcx > {
366+ -> CompileState < ' a , ' b , ' ast , ' tcx > {
360367 CompileState {
361368 input : input,
362369 session : session,
363370 out_dir : out_dir. as_ref ( ) . map ( |s| & * * s) ,
364371 out_file : None ,
372+ arenas : None ,
365373 krate : None ,
366374 cstore : None ,
367375 crate_name : None ,
@@ -377,12 +385,12 @@ impl<'a, 'ast, 'tcx> CompileState<'a, 'ast, 'tcx> {
377385 }
378386
379387 fn state_after_parse ( input : & ' a Input ,
380- session : & ' a Session ,
388+ session : & ' ast Session ,
381389 out_dir : & ' a Option < PathBuf > ,
382390 out_file : & ' a Option < PathBuf > ,
383391 krate : ast:: Crate ,
384392 cstore : & ' a CStore )
385- -> CompileState < ' a , ' ast , ' tcx > {
393+ -> CompileState < ' a , ' b , ' ast , ' tcx > {
386394 CompileState {
387395 krate : Some ( krate) ,
388396 cstore : Some ( cstore) ,
@@ -392,63 +400,80 @@ impl<'a, 'ast, 'tcx> CompileState<'a, 'ast, 'tcx> {
392400 }
393401
394402 fn state_after_expand ( input : & ' a Input ,
395- session : & ' a Session ,
403+ session : & ' ast Session ,
396404 out_dir : & ' a Option < PathBuf > ,
405+ out_file : & ' a Option < PathBuf > ,
406+ cstore : & ' a CStore ,
397407 expanded_crate : & ' a ast:: Crate ,
398408 crate_name : & ' a str )
399- -> CompileState < ' a , ' ast , ' tcx > {
409+ -> CompileState < ' a , ' b , ' ast , ' tcx > {
400410 CompileState {
401411 crate_name : Some ( crate_name) ,
412+ cstore : Some ( cstore) ,
402413 expanded_crate : Some ( expanded_crate) ,
414+ out_file : out_file. as_ref ( ) . map ( |s| & * * s) ,
403415 ..CompileState :: empty ( input, session, out_dir)
404416 }
405417 }
406418
407419 fn state_after_write_deps ( input : & ' a Input ,
408- session : & ' a Session ,
420+ session : & ' ast Session ,
409421 out_dir : & ' a Option < PathBuf > ,
422+ out_file : & ' a Option < PathBuf > ,
423+ arenas : & ' ast ty:: CtxtArenas < ' ast > ,
424+ cstore : & ' a CStore ,
410425 hir_map : & ' a hir_map:: Map < ' ast > ,
411426 krate : & ' a ast:: Crate ,
412427 hir_crate : & ' a hir:: Crate ,
413428 crate_name : & ' a str )
414- -> CompileState < ' a , ' ast , ' tcx > {
429+ -> CompileState < ' a , ' b , ' ast , ' tcx > {
415430 CompileState {
416431 crate_name : Some ( crate_name) ,
432+ arenas : Some ( arenas) ,
433+ cstore : Some ( cstore) ,
417434 ast_map : Some ( hir_map) ,
418435 expanded_crate : Some ( krate) ,
419436 hir_crate : Some ( hir_crate) ,
437+ out_file : out_file. as_ref ( ) . map ( |s| & * * s) ,
420438 ..CompileState :: empty ( input, session, out_dir)
421439 }
422440 }
423441
424442 fn state_after_analysis ( input : & ' a Input ,
425- session : & ' a Session ,
443+ session : & ' ast Session ,
426444 out_dir : & ' a Option < PathBuf > ,
445+ out_file : & ' a Option < PathBuf > ,
427446 krate : Option < & ' a ast:: Crate > ,
428447 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 > ,
432451 crate_name : & ' a str )
433- -> CompileState < ' a , ' ast , ' tcx > {
452+ -> CompileState < ' a , ' b , ' ast , ' tcx > {
434453 CompileState {
435454 analysis : Some ( analysis) ,
436455 mir_map : mir_map,
437456 tcx : Some ( tcx) ,
438457 expanded_crate : krate,
439458 hir_crate : Some ( hir_crate) ,
440459 crate_name : Some ( crate_name) ,
460+ out_file : out_file. as_ref ( ) . map ( |s| & * * s) ,
441461 ..CompileState :: empty ( input, session, out_dir)
442462 }
443463 }
444464
445465
446466 fn state_after_llvm ( input : & ' a Input ,
447- session : & ' a Session ,
467+ session : & ' ast Session ,
448468 out_dir : & ' a Option < PathBuf > ,
469+ out_file : & ' a Option < PathBuf > ,
449470 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+ }
452477 }
453478}
454479
@@ -814,16 +839,16 @@ pub fn phase_3_run_analysis_passes<'tcx, F, R>(sess: &'tcx Session,
814839 let index = stability:: Index :: new ( & hir_map) ;
815840
816841 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| {
827852 time ( time_passes,
828853 "load_dep_graph" ,
829854 || rustc_incremental:: load_dep_graph ( tcx) ) ;
0 commit comments