@@ -25,7 +25,7 @@ use rustc::middle::{self, dependency_format, stability, reachable};
2525use rustc:: middle:: privacy:: AccessLevels ;
2626use rustc:: ty:: { self , TyCtxt } ;
2727use rustc:: util:: common:: time;
28- use rustc:: util:: nodemap:: NodeSet ;
28+ use rustc:: util:: nodemap:: { NodeSet , NodeMap } ;
2929use rustc_borrowck as borrowck;
3030use rustc_incremental:: { self , IncrementalHashesMap } ;
3131use rustc_resolve:: { MakeGlobMap , Resolver } ;
@@ -332,31 +332,31 @@ impl<'a> PhaseController<'a> {
332332/// State that is passed to a callback. What state is available depends on when
333333/// during compilation the callback is made. See the various constructor methods
334334/// (`state_*`) in the impl to see which data is provided for any given entry point.
335- pub struct CompileState < ' a , ' b , ' ast : ' a , ' tcx : ' b > where ' ast : ' tcx {
335+ pub struct CompileState < ' a , ' tcx : ' a > {
336336 pub input : & ' a Input ,
337- pub session : & ' ast Session ,
337+ pub session : & ' tcx Session ,
338338 pub krate : Option < ast:: Crate > ,
339339 pub registry : Option < Registry < ' a > > ,
340340 pub cstore : Option < & ' a CStore > ,
341341 pub crate_name : Option < & ' a str > ,
342342 pub output_filenames : Option < & ' a OutputFilenames > ,
343343 pub out_dir : Option < & ' a Path > ,
344344 pub out_file : Option < & ' a Path > ,
345- pub arenas : Option < & ' ast ty:: CtxtArenas < ' ast > > ,
345+ pub arenas : Option < & ' tcx ty:: CtxtArenas < ' tcx > > ,
346346 pub expanded_crate : Option < & ' a ast:: Crate > ,
347347 pub hir_crate : Option < & ' a hir:: Crate > ,
348- pub ast_map : Option < & ' a hir_map:: Map < ' ast > > ,
348+ pub ast_map : Option < & ' a hir_map:: Map < ' tcx > > ,
349349 pub resolutions : Option < & ' a Resolutions > ,
350- pub analysis : Option < & ' a ty:: CrateAnalysis < ' a > > ,
351- pub tcx : Option < TyCtxt < ' b , ' tcx , ' tcx > > ,
350+ pub analysis : Option < & ' a ty:: CrateAnalysis < ' tcx > > ,
351+ pub tcx : Option < TyCtxt < ' a , ' tcx , ' tcx > > ,
352352 pub trans : Option < & ' a trans:: CrateTranslation > ,
353353}
354354
355- impl < ' a , ' b , ' ast , ' tcx > CompileState < ' a , ' b , ' ast , ' tcx > {
355+ impl < ' a , ' tcx > CompileState < ' a , ' tcx > {
356356 fn empty ( input : & ' a Input ,
357- session : & ' ast Session ,
357+ session : & ' tcx Session ,
358358 out_dir : & ' a Option < PathBuf > )
359- -> CompileState < ' a , ' b , ' ast , ' tcx > {
359+ -> Self {
360360 CompileState {
361361 input : input,
362362 session : session,
@@ -379,12 +379,12 @@ impl<'a, 'b, 'ast, 'tcx> CompileState<'a, 'b, 'ast, 'tcx> {
379379 }
380380
381381 fn state_after_parse ( input : & ' a Input ,
382- session : & ' ast Session ,
382+ session : & ' tcx Session ,
383383 out_dir : & ' a Option < PathBuf > ,
384384 out_file : & ' a Option < PathBuf > ,
385385 krate : ast:: Crate ,
386386 cstore : & ' a CStore )
387- -> CompileState < ' a , ' b , ' ast , ' tcx > {
387+ -> Self {
388388 CompileState {
389389 // Initialize the registry before moving `krate`
390390 registry : Some ( Registry :: new ( & session, krate. span ) ) ,
@@ -396,13 +396,13 @@ impl<'a, 'b, 'ast, 'tcx> CompileState<'a, 'b, 'ast, 'tcx> {
396396 }
397397
398398 fn state_after_expand ( input : & ' a Input ,
399- session : & ' ast Session ,
399+ session : & ' tcx Session ,
400400 out_dir : & ' a Option < PathBuf > ,
401401 out_file : & ' a Option < PathBuf > ,
402402 cstore : & ' a CStore ,
403403 expanded_crate : & ' a ast:: Crate ,
404404 crate_name : & ' a str )
405- -> CompileState < ' a , ' b , ' ast , ' tcx > {
405+ -> Self {
406406 CompileState {
407407 crate_name : Some ( crate_name) ,
408408 cstore : Some ( cstore) ,
@@ -413,18 +413,18 @@ impl<'a, 'b, 'ast, 'tcx> CompileState<'a, 'b, 'ast, 'tcx> {
413413 }
414414
415415 fn state_after_hir_lowering ( input : & ' a Input ,
416- session : & ' ast Session ,
416+ session : & ' tcx Session ,
417417 out_dir : & ' a Option < PathBuf > ,
418418 out_file : & ' a Option < PathBuf > ,
419- arenas : & ' ast ty:: CtxtArenas < ' ast > ,
419+ arenas : & ' tcx ty:: CtxtArenas < ' tcx > ,
420420 cstore : & ' a CStore ,
421- hir_map : & ' a hir_map:: Map < ' ast > ,
422- analysis : & ' a ty:: CrateAnalysis ,
421+ hir_map : & ' a hir_map:: Map < ' tcx > ,
422+ analysis : & ' a ty:: CrateAnalysis < ' static > ,
423423 resolutions : & ' a Resolutions ,
424424 krate : & ' a ast:: Crate ,
425425 hir_crate : & ' a hir:: Crate ,
426426 crate_name : & ' a str )
427- -> CompileState < ' a , ' b , ' ast , ' tcx > {
427+ -> Self {
428428 CompileState {
429429 crate_name : Some ( crate_name) ,
430430 arenas : Some ( arenas) ,
@@ -440,15 +440,15 @@ impl<'a, 'b, 'ast, 'tcx> CompileState<'a, 'b, 'ast, 'tcx> {
440440 }
441441
442442 fn state_after_analysis ( input : & ' a Input ,
443- session : & ' ast Session ,
443+ session : & ' tcx Session ,
444444 out_dir : & ' a Option < PathBuf > ,
445445 out_file : & ' a Option < PathBuf > ,
446446 krate : Option < & ' a ast:: Crate > ,
447447 hir_crate : & ' a hir:: Crate ,
448- analysis : & ' a ty:: CrateAnalysis < ' a > ,
449- tcx : TyCtxt < ' b , ' tcx , ' tcx > ,
448+ analysis : & ' a ty:: CrateAnalysis < ' tcx > ,
449+ tcx : TyCtxt < ' a , ' tcx , ' tcx > ,
450450 crate_name : & ' a str )
451- -> CompileState < ' a , ' b , ' ast , ' tcx > {
451+ -> Self {
452452 CompileState {
453453 analysis : Some ( analysis) ,
454454 tcx : Some ( tcx) ,
@@ -462,11 +462,11 @@ impl<'a, 'b, 'ast, 'tcx> CompileState<'a, 'b, 'ast, 'tcx> {
462462
463463
464464 fn state_after_llvm ( input : & ' a Input ,
465- session : & ' ast Session ,
465+ session : & ' tcx Session ,
466466 out_dir : & ' a Option < PathBuf > ,
467467 out_file : & ' a Option < PathBuf > ,
468468 trans : & ' a trans:: CrateTranslation )
469- -> CompileState < ' a , ' b , ' ast , ' tcx > {
469+ -> Self {
470470 CompileState {
471471 trans : Some ( trans) ,
472472 out_file : out_file. as_ref ( ) . map ( |s| & * * s) ,
@@ -475,10 +475,10 @@ impl<'a, 'b, 'ast, 'tcx> CompileState<'a, 'b, 'ast, 'tcx> {
475475 }
476476
477477 fn state_when_compilation_done ( input : & ' a Input ,
478- session : & ' ast Session ,
478+ session : & ' tcx Session ,
479479 out_dir : & ' a Option < PathBuf > ,
480480 out_file : & ' a Option < PathBuf > )
481- -> CompileState < ' a , ' b , ' ast , ' tcx > {
481+ -> Self {
482482 CompileState {
483483 out_file : out_file. as_ref ( ) . map ( |s| & * * s) ,
484484 ..CompileState :: empty ( input, session, out_dir)
@@ -532,10 +532,10 @@ fn count_nodes(krate: &ast::Crate) -> usize {
532532// For continuing compilation after a parsed crate has been
533533// modified
534534
535- pub struct ExpansionResult < ' a > {
535+ pub struct ExpansionResult {
536536 pub expanded_crate : ast:: Crate ,
537537 pub defs : hir_map:: Definitions ,
538- pub analysis : ty:: CrateAnalysis < ' a > ,
538+ pub analysis : ty:: CrateAnalysis < ' static > ,
539539 pub resolutions : Resolutions ,
540540 pub hir_forest : hir_map:: Forest ,
541541}
@@ -547,15 +547,15 @@ pub struct ExpansionResult<'a> {
547547/// standard library and prelude, and name resolution.
548548///
549549/// Returns `None` if we're aborting after handling -W help.
550- pub fn phase_2_configure_and_expand < ' a , F > ( sess : & Session ,
551- cstore : & CStore ,
552- krate : ast:: Crate ,
553- registry : Option < Registry > ,
554- crate_name : & ' a str ,
555- addl_plugins : Option < Vec < String > > ,
556- make_glob_map : MakeGlobMap ,
557- after_expand : F )
558- -> Result < ExpansionResult < ' a > , usize >
550+ pub fn phase_2_configure_and_expand < F > ( sess : & Session ,
551+ cstore : & CStore ,
552+ krate : ast:: Crate ,
553+ registry : Option < Registry > ,
554+ crate_name : & str ,
555+ addl_plugins : Option < Vec < String > > ,
556+ make_glob_map : MakeGlobMap ,
557+ after_expand : F )
558+ -> Result < ExpansionResult , usize >
559559 where F : FnOnce ( & ast:: Crate ) -> CompileResult ,
560560{
561561 let time_passes = sess. time_passes ( ) ;
@@ -789,8 +789,9 @@ pub fn phase_2_configure_and_expand<'a, F>(sess: &Session,
789789 export_map : resolver. export_map ,
790790 access_levels : AccessLevels :: default ( ) ,
791791 reachable : NodeSet ( ) ,
792- name : crate_name,
792+ name : crate_name. to_string ( ) ,
793793 glob_map : if resolver. make_glob_map { Some ( resolver. glob_map ) } else { None } ,
794+ hir_ty_to_ty : NodeMap ( ) ,
794795 } ,
795796 resolutions : Resolutions {
796797 def_map : resolver. def_map ,
@@ -807,14 +808,14 @@ pub fn phase_2_configure_and_expand<'a, F>(sess: &Session,
807808/// structures carrying the results of the analysis.
808809pub fn phase_3_run_analysis_passes < ' tcx , F , R > ( sess : & ' tcx Session ,
809810 hir_map : hir_map:: Map < ' tcx > ,
810- mut analysis : ty:: CrateAnalysis ,
811+ mut analysis : ty:: CrateAnalysis < ' tcx > ,
811812 resolutions : Resolutions ,
812813 arenas : & ' tcx ty:: CtxtArenas < ' tcx > ,
813814 name : & str ,
814815 f : F )
815816 -> Result < R , usize >
816817 where F : for < ' a > FnOnce ( TyCtxt < ' a , ' tcx , ' tcx > ,
817- ty:: CrateAnalysis ,
818+ ty:: CrateAnalysis < ' tcx > ,
818819 IncrementalHashesMap ,
819820 CompileResult ) -> R
820821{
@@ -886,7 +887,8 @@ pub fn phase_3_run_analysis_passes<'tcx, F, R>(sess: &'tcx Session,
886887 || rustc_incremental:: load_dep_graph ( tcx, & incremental_hashes_map) ) ;
887888
888889 // passes are timed inside typeck
889- try_with_f ! ( typeck:: check_crate( tcx) , ( tcx, analysis, incremental_hashes_map) ) ;
890+ analysis. hir_ty_to_ty =
891+ try_with_f ! ( typeck:: check_crate( tcx) , ( tcx, analysis, incremental_hashes_map) ) ;
890892
891893 time ( time_passes,
892894 "const checking" ,
0 commit comments