@@ -28,7 +28,7 @@ use rustc::util::common::{ErrorReported, time};
28
28
use rustc_allocator as allocator;
29
29
use rustc_borrowck as borrowck;
30
30
use rustc_incremental;
31
- use rustc_resolve:: { MakeGlobMap , Resolver } ;
31
+ use rustc_resolve:: { MakeGlobMap , Resolver , ResolverArenas } ;
32
32
use rustc_metadata:: creader:: CrateLoader ;
33
33
use rustc_metadata:: cstore:: { self , CStore } ;
34
34
use rustc_trans_utils:: trans_crate:: TransCrate ;
@@ -139,6 +139,14 @@ pub fn compile_input(trans: Box<TransCrate>,
139
139
140
140
let crate_name =
141
141
:: rustc_trans_utils:: link:: find_crate_name ( Some ( sess) , & krate. attrs , input) ;
142
+
143
+ // Currently, we ignore the name resolution data structures for the purposes of dependency
144
+ // tracking. Instead we will run name resolution and include its output in the hash of each
145
+ // item, much like we do for macro expansion. In other words, the hash reflects not just
146
+ // its contents but the results of name resolution on those contents. Hopefully we'll push
147
+ // this back at some point.
148
+ let mut crate_loader = CrateLoader :: new ( sess, & cstore, & crate_name) ;
149
+ let resolver_arenas = Resolver :: arenas ( ) ;
142
150
let ExpansionResult { expanded_crate, defs, analysis, resolutions, mut hir_forest } = {
143
151
phase_2_configure_and_expand (
144
152
sess,
@@ -148,6 +156,8 @@ pub fn compile_input(trans: Box<TransCrate>,
148
156
& crate_name,
149
157
addl_plugins,
150
158
control. make_glob_map ,
159
+ & resolver_arenas,
160
+ & mut crate_loader,
151
161
|expanded_crate| {
152
162
let mut state = CompileState :: state_after_expand (
153
163
input, sess, outdir, output, & cstore, expanded_crate, & crate_name,
@@ -569,13 +579,15 @@ pub struct ExpansionResult {
569
579
/// standard library and prelude, and name resolution.
570
580
///
571
581
/// Returns `None` if we're aborting after handling -W help.
572
- pub fn phase_2_configure_and_expand < F > ( sess : & Session ,
573
- cstore : & CStore ,
582
+ pub fn phase_2_configure_and_expand < ' a , F > ( sess : & ' a Session ,
583
+ cstore : & ' a CStore ,
574
584
krate : ast:: Crate ,
575
585
registry : Option < Registry > ,
576
586
crate_name : & str ,
577
587
addl_plugins : Option < Vec < String > > ,
578
588
make_glob_map : MakeGlobMap ,
589
+ resolver_arenas : & ' a ResolverArenas < ' a > ,
590
+ crate_loader : & ' a mut CrateLoader ,
579
591
after_expand : F )
580
592
-> Result < ExpansionResult , CompileIncomplete >
581
593
where F : FnOnce ( & ast:: Crate ) -> CompileResult ,
@@ -666,19 +678,12 @@ pub fn phase_2_configure_and_expand<F>(sess: &Session,
666
678
return Err ( CompileIncomplete :: Stopped ) ;
667
679
}
668
680
669
- // Currently, we ignore the name resolution data structures for the purposes of dependency
670
- // tracking. Instead we will run name resolution and include its output in the hash of each
671
- // item, much like we do for macro expansion. In other words, the hash reflects not just
672
- // its contents but the results of name resolution on those contents. Hopefully we'll push
673
- // this back at some point.
674
- let mut crate_loader = CrateLoader :: new ( sess, & cstore, crate_name) ;
675
- let resolver_arenas = Resolver :: arenas ( ) ;
676
681
let mut resolver = Resolver :: new ( sess,
677
682
cstore,
678
683
& krate,
679
684
crate_name,
680
685
make_glob_map,
681
- & mut crate_loader,
686
+ crate_loader,
682
687
& resolver_arenas) ;
683
688
resolver. whitelisted_legacy_custom_derives = whitelisted_legacy_custom_derives;
684
689
syntax_ext:: register_builtins ( & mut resolver, syntax_exts, sess. features . borrow ( ) . quote ) ;
0 commit comments