@@ -42,7 +42,7 @@ use std::ffi::{OsString, OsStr};
42
42
use std:: fs;
43
43
use std:: io:: { self , Write } ;
44
44
use std:: path:: { Path , PathBuf } ;
45
- use syntax:: ast;
45
+ use syntax:: ast:: { self , NodeIdAssigner } ;
46
46
use syntax:: attr;
47
47
use syntax:: attr:: AttrMetaMethods ;
48
48
use syntax:: diagnostics;
@@ -71,7 +71,7 @@ pub fn compile_input(sess: Session,
71
71
// We need nested scopes here, because the intermediate results can keep
72
72
// large chunks of memory alive and we want to free them as soon as
73
73
// possible to keep the peak memory usage low
74
- let ( sess , result) = {
74
+ let result = {
75
75
let ( outputs, expanded_crate, id) = {
76
76
let krate = phase_1_parse_input ( & sess, cfg, input) ;
77
77
@@ -113,7 +113,7 @@ pub fn compile_input(sess: Session,
113
113
let expanded_crate = assign_node_ids ( & sess, expanded_crate) ;
114
114
// Lower ast -> hir.
115
115
let foo = & 42 ;
116
- let lcx = LoweringContext :: new ( foo) ;
116
+ let lcx = LoweringContext :: new ( foo, & sess , & expanded_crate ) ;
117
117
let mut hir_forest = time ( sess. time_passes ( ) ,
118
118
"lowering ast -> hir" ,
119
119
|| hir_map:: Forest :: new ( lower_crate ( & lcx, & expanded_crate) ) ) ;
@@ -141,7 +141,7 @@ pub fn compile_input(sess: Session,
141
141
lint:: check_ast_crate ( & sess, & expanded_crate)
142
142
} ) ;
143
143
144
- phase_3_run_analysis_passes ( sess,
144
+ phase_3_run_analysis_passes ( & sess,
145
145
ast_map,
146
146
& arenas,
147
147
id,
@@ -282,7 +282,7 @@ pub struct CompileState<'a, 'ast: 'a, 'tcx: 'a> {
282
282
pub ast_map : Option < & ' a hir_map:: Map < ' ast > > ,
283
283
pub analysis : Option < & ' a ty:: CrateAnalysis > ,
284
284
pub tcx : Option < & ' a ty:: ctxt < ' tcx > > ,
285
- pub lcx : Option < & ' a LoweringContext < ' tcx > > ,
285
+ pub lcx : Option < & ' a LoweringContext < ' a , ' tcx > > ,
286
286
pub trans : Option < & ' a trans:: CrateTranslation > ,
287
287
}
288
288
@@ -340,7 +340,7 @@ impl<'a, 'ast, 'tcx> CompileState<'a, 'ast, 'tcx> {
340
340
krate : & ' a ast:: Crate ,
341
341
hir_crate : & ' a hir:: Crate ,
342
342
crate_name : & ' a str ,
343
- lcx : & ' a LoweringContext < ' tcx > )
343
+ lcx : & ' a LoweringContext < ' a , ' tcx > )
344
344
-> CompileState < ' a , ' ast , ' tcx > {
345
345
CompileState {
346
346
crate_name : Some ( crate_name) ,
@@ -359,7 +359,7 @@ impl<'a, 'ast, 'tcx> CompileState<'a, 'ast, 'tcx> {
359
359
hir_crate : & ' a hir:: Crate ,
360
360
analysis : & ' a ty:: CrateAnalysis ,
361
361
tcx : & ' a ty:: ctxt < ' tcx > ,
362
- lcx : & ' a LoweringContext < ' tcx > )
362
+ lcx : & ' a LoweringContext < ' a , ' tcx > )
363
363
-> CompileState < ' a , ' ast , ' tcx > {
364
364
CompileState {
365
365
analysis : Some ( analysis) ,
@@ -659,21 +659,21 @@ pub fn make_map<'ast>(sess: &Session,
659
659
/// Run the resolution, typechecking, region checking and other
660
660
/// miscellaneous analysis passes on the crate. Return various
661
661
/// structures carrying the results of the analysis.
662
- pub fn phase_3_run_analysis_passes < ' tcx , F , R > ( sess : Session ,
662
+ pub fn phase_3_run_analysis_passes < ' tcx , F , R > ( sess : & ' tcx Session ,
663
663
ast_map : front:: map:: Map < ' tcx > ,
664
664
arenas : & ' tcx ty:: CtxtArenas < ' tcx > ,
665
665
name : String ,
666
666
make_glob_map : resolve:: MakeGlobMap ,
667
667
f : F )
668
- -> ( Session , R )
668
+ -> R
669
669
where F : for < ' a > FnOnce ( & ' a ty:: ctxt < ' tcx > ,
670
670
ty:: CrateAnalysis ) -> R
671
671
{
672
672
let time_passes = sess. time_passes ( ) ;
673
673
let krate = ast_map. krate ( ) ;
674
674
675
675
time ( time_passes, "external crate/lib resolution" , ||
676
- LocalCrateReader :: new ( & sess, & ast_map) . read_crates ( krate) ) ;
676
+ LocalCrateReader :: new ( sess, & ast_map) . read_crates ( krate) ) ;
677
677
678
678
let lang_items = time ( time_passes, "language item collection" , ||
679
679
middle:: lang_items:: collect_language_items ( & sess, & ast_map) ) ;
@@ -687,32 +687,32 @@ pub fn phase_3_run_analysis_passes<'tcx, F, R>(sess: Session,
687
687
glob_map,
688
688
} =
689
689
time ( time_passes, "resolution" ,
690
- || resolve:: resolve_crate ( & sess, & ast_map, make_glob_map) ) ;
690
+ || resolve:: resolve_crate ( sess, & ast_map, make_glob_map) ) ;
691
691
692
692
// Discard MTWT tables that aren't required past resolution.
693
693
if !sess. opts . debugging_opts . keep_mtwt_tables {
694
694
syntax:: ext:: mtwt:: clear_tables ( ) ;
695
695
}
696
696
697
697
let named_region_map = time ( time_passes, "lifetime resolution" ,
698
- || middle:: resolve_lifetime:: krate ( & sess, krate, & def_map) ) ;
698
+ || middle:: resolve_lifetime:: krate ( sess, krate, & def_map) ) ;
699
699
700
700
time ( time_passes, "looking for entry point" ,
701
- || middle:: entry:: find_entry_point ( & sess, & ast_map) ) ;
701
+ || middle:: entry:: find_entry_point ( sess, & ast_map) ) ;
702
702
703
703
sess. plugin_registrar_fn . set (
704
704
time ( time_passes, "looking for plugin registrar" , ||
705
705
plugin:: build:: find_plugin_registrar (
706
706
sess. diagnostic ( ) , krate) ) ) ;
707
707
708
708
let region_map = time ( time_passes, "region resolution" , ||
709
- middle:: region:: resolve_crate ( & sess, krate) ) ;
709
+ middle:: region:: resolve_crate ( sess, krate) ) ;
710
710
711
711
time ( time_passes, "loop checking" , ||
712
- middle:: check_loop:: check_crate ( & sess, krate) ) ;
712
+ middle:: check_loop:: check_crate ( sess, krate) ) ;
713
713
714
714
time ( time_passes, "static item recursion checking" , ||
715
- middle:: check_static_recursion:: check_crate ( & sess, krate, & def_map, & ast_map) ) ;
715
+ middle:: check_static_recursion:: check_crate ( sess, krate, & def_map, & ast_map) ) ;
716
716
717
717
ty:: ctxt:: create_and_enter ( sess,
718
718
arenas,
0 commit comments