@@ -25,7 +25,7 @@ use rustc::middle::{self, dependency_format, stability, reachable};
25
25
use rustc:: middle:: privacy:: AccessLevels ;
26
26
use rustc:: ty:: { self , TyCtxt } ;
27
27
use rustc:: util:: common:: time;
28
- use rustc:: util:: nodemap:: NodeSet ;
28
+ use rustc:: util:: nodemap:: { NodeSet , NodeMap } ;
29
29
use rustc_borrowck as borrowck;
30
30
use rustc_incremental:: { self , IncrementalHashesMap } ;
31
31
use rustc_resolve:: { MakeGlobMap , Resolver } ;
@@ -332,31 +332,31 @@ impl<'a> PhaseController<'a> {
332
332
/// State that is passed to a callback. What state is available depends on when
333
333
/// during compilation the callback is made. See the various constructor methods
334
334
/// (`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 > {
336
336
pub input : & ' a Input ,
337
- pub session : & ' ast Session ,
337
+ pub session : & ' tcx Session ,
338
338
pub krate : Option < ast:: Crate > ,
339
339
pub registry : Option < Registry < ' a > > ,
340
340
pub cstore : Option < & ' a CStore > ,
341
341
pub crate_name : Option < & ' a str > ,
342
342
pub output_filenames : Option < & ' a OutputFilenames > ,
343
343
pub out_dir : Option < & ' a Path > ,
344
344
pub out_file : Option < & ' a Path > ,
345
- pub arenas : Option < & ' ast ty:: CtxtArenas < ' ast > > ,
345
+ pub arenas : Option < & ' tcx ty:: CtxtArenas < ' tcx > > ,
346
346
pub expanded_crate : Option < & ' a ast:: Crate > ,
347
347
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 > > ,
349
349
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 > > ,
352
352
pub trans : Option < & ' a trans:: CrateTranslation > ,
353
353
}
354
354
355
- impl < ' a , ' b , ' ast , ' tcx > CompileState < ' a , ' b , ' ast , ' tcx > {
355
+ impl < ' a , ' tcx > CompileState < ' a , ' tcx > {
356
356
fn empty ( input : & ' a Input ,
357
- session : & ' ast Session ,
357
+ session : & ' tcx Session ,
358
358
out_dir : & ' a Option < PathBuf > )
359
- -> CompileState < ' a , ' b , ' ast , ' tcx > {
359
+ -> Self {
360
360
CompileState {
361
361
input : input,
362
362
session : session,
@@ -379,12 +379,12 @@ impl<'a, 'b, 'ast, 'tcx> CompileState<'a, 'b, 'ast, 'tcx> {
379
379
}
380
380
381
381
fn state_after_parse ( input : & ' a Input ,
382
- session : & ' ast Session ,
382
+ session : & ' tcx Session ,
383
383
out_dir : & ' a Option < PathBuf > ,
384
384
out_file : & ' a Option < PathBuf > ,
385
385
krate : ast:: Crate ,
386
386
cstore : & ' a CStore )
387
- -> CompileState < ' a , ' b , ' ast , ' tcx > {
387
+ -> Self {
388
388
CompileState {
389
389
// Initialize the registry before moving `krate`
390
390
registry : Some ( Registry :: new ( & session, krate. span ) ) ,
@@ -396,13 +396,13 @@ impl<'a, 'b, 'ast, 'tcx> CompileState<'a, 'b, 'ast, 'tcx> {
396
396
}
397
397
398
398
fn state_after_expand ( input : & ' a Input ,
399
- session : & ' ast Session ,
399
+ session : & ' tcx Session ,
400
400
out_dir : & ' a Option < PathBuf > ,
401
401
out_file : & ' a Option < PathBuf > ,
402
402
cstore : & ' a CStore ,
403
403
expanded_crate : & ' a ast:: Crate ,
404
404
crate_name : & ' a str )
405
- -> CompileState < ' a , ' b , ' ast , ' tcx > {
405
+ -> Self {
406
406
CompileState {
407
407
crate_name : Some ( crate_name) ,
408
408
cstore : Some ( cstore) ,
@@ -413,18 +413,18 @@ impl<'a, 'b, 'ast, 'tcx> CompileState<'a, 'b, 'ast, 'tcx> {
413
413
}
414
414
415
415
fn state_after_hir_lowering ( input : & ' a Input ,
416
- session : & ' ast Session ,
416
+ session : & ' tcx Session ,
417
417
out_dir : & ' a Option < PathBuf > ,
418
418
out_file : & ' a Option < PathBuf > ,
419
- arenas : & ' ast ty:: CtxtArenas < ' ast > ,
419
+ arenas : & ' tcx ty:: CtxtArenas < ' tcx > ,
420
420
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 > ,
423
423
resolutions : & ' a Resolutions ,
424
424
krate : & ' a ast:: Crate ,
425
425
hir_crate : & ' a hir:: Crate ,
426
426
crate_name : & ' a str )
427
- -> CompileState < ' a , ' b , ' ast , ' tcx > {
427
+ -> Self {
428
428
CompileState {
429
429
crate_name : Some ( crate_name) ,
430
430
arenas : Some ( arenas) ,
@@ -440,15 +440,15 @@ impl<'a, 'b, 'ast, 'tcx> CompileState<'a, 'b, 'ast, 'tcx> {
440
440
}
441
441
442
442
fn state_after_analysis ( input : & ' a Input ,
443
- session : & ' ast Session ,
443
+ session : & ' tcx Session ,
444
444
out_dir : & ' a Option < PathBuf > ,
445
445
out_file : & ' a Option < PathBuf > ,
446
446
krate : Option < & ' a ast:: Crate > ,
447
447
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 > ,
450
450
crate_name : & ' a str )
451
- -> CompileState < ' a , ' b , ' ast , ' tcx > {
451
+ -> Self {
452
452
CompileState {
453
453
analysis : Some ( analysis) ,
454
454
tcx : Some ( tcx) ,
@@ -462,11 +462,11 @@ impl<'a, 'b, 'ast, 'tcx> CompileState<'a, 'b, 'ast, 'tcx> {
462
462
463
463
464
464
fn state_after_llvm ( input : & ' a Input ,
465
- session : & ' ast Session ,
465
+ session : & ' tcx Session ,
466
466
out_dir : & ' a Option < PathBuf > ,
467
467
out_file : & ' a Option < PathBuf > ,
468
468
trans : & ' a trans:: CrateTranslation )
469
- -> CompileState < ' a , ' b , ' ast , ' tcx > {
469
+ -> Self {
470
470
CompileState {
471
471
trans : Some ( trans) ,
472
472
out_file : out_file. as_ref ( ) . map ( |s| & * * s) ,
@@ -475,10 +475,10 @@ impl<'a, 'b, 'ast, 'tcx> CompileState<'a, 'b, 'ast, 'tcx> {
475
475
}
476
476
477
477
fn state_when_compilation_done ( input : & ' a Input ,
478
- session : & ' ast Session ,
478
+ session : & ' tcx Session ,
479
479
out_dir : & ' a Option < PathBuf > ,
480
480
out_file : & ' a Option < PathBuf > )
481
- -> CompileState < ' a , ' b , ' ast , ' tcx > {
481
+ -> Self {
482
482
CompileState {
483
483
out_file : out_file. as_ref ( ) . map ( |s| & * * s) ,
484
484
..CompileState :: empty ( input, session, out_dir)
@@ -532,10 +532,10 @@ fn count_nodes(krate: &ast::Crate) -> usize {
532
532
// For continuing compilation after a parsed crate has been
533
533
// modified
534
534
535
- pub struct ExpansionResult < ' a > {
535
+ pub struct ExpansionResult {
536
536
pub expanded_crate : ast:: Crate ,
537
537
pub defs : hir_map:: Definitions ,
538
- pub analysis : ty:: CrateAnalysis < ' a > ,
538
+ pub analysis : ty:: CrateAnalysis < ' static > ,
539
539
pub resolutions : Resolutions ,
540
540
pub hir_forest : hir_map:: Forest ,
541
541
}
@@ -547,15 +547,15 @@ pub struct ExpansionResult<'a> {
547
547
/// standard library and prelude, and name resolution.
548
548
///
549
549
/// 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 >
559
559
where F : FnOnce ( & ast:: Crate ) -> CompileResult ,
560
560
{
561
561
let time_passes = sess. time_passes ( ) ;
@@ -789,8 +789,9 @@ pub fn phase_2_configure_and_expand<'a, F>(sess: &Session,
789
789
export_map : resolver. export_map ,
790
790
access_levels : AccessLevels :: default ( ) ,
791
791
reachable : NodeSet ( ) ,
792
- name : crate_name,
792
+ name : crate_name. to_string ( ) ,
793
793
glob_map : if resolver. make_glob_map { Some ( resolver. glob_map ) } else { None } ,
794
+ hir_ty_to_ty : NodeMap ( ) ,
794
795
} ,
795
796
resolutions : Resolutions {
796
797
def_map : resolver. def_map ,
@@ -807,14 +808,14 @@ pub fn phase_2_configure_and_expand<'a, F>(sess: &Session,
807
808
/// structures carrying the results of the analysis.
808
809
pub fn phase_3_run_analysis_passes < ' tcx , F , R > ( sess : & ' tcx Session ,
809
810
hir_map : hir_map:: Map < ' tcx > ,
810
- mut analysis : ty:: CrateAnalysis ,
811
+ mut analysis : ty:: CrateAnalysis < ' tcx > ,
811
812
resolutions : Resolutions ,
812
813
arenas : & ' tcx ty:: CtxtArenas < ' tcx > ,
813
814
name : & str ,
814
815
f : F )
815
816
-> Result < R , usize >
816
817
where F : for < ' a > FnOnce ( TyCtxt < ' a , ' tcx , ' tcx > ,
817
- ty:: CrateAnalysis ,
818
+ ty:: CrateAnalysis < ' tcx > ,
818
819
IncrementalHashesMap ,
819
820
CompileResult ) -> R
820
821
{
@@ -886,7 +887,8 @@ pub fn phase_3_run_analysis_passes<'tcx, F, R>(sess: &'tcx Session,
886
887
|| rustc_incremental:: load_dep_graph ( tcx, & incremental_hashes_map) ) ;
887
888
888
889
// 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) ) ;
890
892
891
893
time ( time_passes,
892
894
"const checking" ,
0 commit comments