]> git.lizzy.rs Git - rust.git/commitdiff
Remove the `cstore` reference from Session in order to prepare encapsulating CrateSto...
authorMichael Woerister <michaelwoerister@posteo>
Tue, 5 Sep 2017 14:48:24 +0000 (16:48 +0200)
committerAlex Crichton <alex@alexcrichton.com>
Tue, 12 Sep 2017 14:19:06 +0000 (07:19 -0700)
22 files changed:
src/librustc/hir/lowering.rs
src/librustc/middle/resolve_lifetime.rs
src/librustc/session/config.rs
src/librustc/session/mod.rs
src/librustc/ty/context.rs
src/librustc/ty/item_path.rs
src/librustc/ty/mod.rs
src/librustc_driver/driver.rs
src/librustc_driver/lib.rs
src/librustc_driver/pretty.rs
src/librustc_driver/test.rs
src/librustc_metadata/cstore_impl.rs
src/librustc_resolve/build_reduced_graph.rs
src/librustc_resolve/lib.rs
src/librustc_resolve/macros.rs
src/librustc_resolve/resolve_imports.rs
src/librustc_trans/back/link.rs
src/librustc_trans/base.rs
src/librustdoc/core.rs
src/librustdoc/test.rs
src/test/run-make/issue-19371/foo.rs
src/test/run-pass-fulldeps/compiler-calls.rs

index fe122fef28a1908a9c4e3158c96c1379f150d024..bae419da26c58839e44bf087cf222ba563806c6f 100644 (file)
@@ -45,6 +45,7 @@
 use hir::def_id::{DefIndex, DefId, CRATE_DEF_INDEX};
 use hir::def::{Def, PathResolution};
 use lint::builtin::PARENTHESIZED_PARAMS_IN_TYPES_AND_MODULES;
+use middle::cstore::CrateStore;
 use rustc_data_structures::indexed_vec::IndexVec;
 use session::Session;
 use util::common::FN_OUTPUT_NAME;
@@ -74,6 +75,8 @@ pub struct LoweringContext<'a> {
     // Use to assign ids to hir nodes that do not directly correspond to an ast node
     sess: &'a Session,
 
+    cstore: &'a CrateStore,
+
     // As we walk the AST we must keep track of the current 'parent' def id (in
     // the form of a DefIndex) so that if we create a new node which introduces
     // a definition, then we can properly create the def id.
@@ -118,6 +121,7 @@ pub trait Resolver {
 }
 
 pub fn lower_crate(sess: &Session,
+                   cstore: &CrateStore,
                    krate: &Crate,
                    resolver: &mut Resolver)
                    -> hir::Crate {
@@ -129,6 +133,7 @@ pub fn lower_crate(sess: &Session,
     LoweringContext {
         crate_root: std_inject::injected_crate_name(krate),
         sess,
+        cstore,
         parent_def: None,
         resolver,
         name_map: FxHashMap(),
@@ -534,7 +539,7 @@ fn def_key(&mut self, id: DefId) -> DefKey {
         if id.is_local() {
             self.resolver.definitions().def_key(id.index)
         } else {
-            self.sess.cstore.def_key(id)
+            self.cstore.def_key(id)
         }
     }
 
@@ -786,7 +791,7 @@ fn lower_qpath(&mut self,
                         return n;
                     }
                     assert!(!def_id.is_local());
-                    let n = self.sess.cstore.item_generics_cloned_untracked(def_id).regions.len();
+                    let n = self.cstore.item_generics_cloned_untracked(def_id).regions.len();
                     self.type_def_lifetime_params.insert(def_id, n);
                     n
                 });
index c53e255f0cdab5e5b3fa6ee27dbb77fa585f3197..657c30289ebb5906ed85605c5177007e64e855d1 100644 (file)
 //! way. Therefore we break lifetime name resolution into a separate pass.
 
 use hir::map::Map;
-use session::Session;
 use hir::def::Def;
 use hir::def_id::DefId;
+use middle::cstore::CrateStore;
+use session::Session;
 use ty;
 
 use std::cell::Cell;
@@ -160,6 +161,7 @@ pub struct NamedRegionMap {
 
 struct LifetimeContext<'a, 'tcx: 'a> {
     sess: &'a Session,
+    cstore: &'a CrateStore,
     hir_map: &'a Map<'tcx>,
     map: &'a mut NamedRegionMap,
     scope: ScopeRef<'a>,
@@ -251,6 +253,7 @@ struct ElisionFailureInfo {
 const ROOT_SCOPE: ScopeRef<'static> = &Scope::Root;
 
 pub fn krate(sess: &Session,
+             cstore: &CrateStore,
              hir_map: &Map)
              -> Result<NamedRegionMap, ErrorReported> {
     let krate = hir_map.krate();
@@ -262,6 +265,7 @@ pub fn krate(sess: &Session,
     sess.track_errors(|| {
         let mut visitor = LifetimeContext {
             sess,
+            cstore,
             hir_map,
             map: &mut map,
             scope: ROOT_SCOPE,
@@ -765,12 +769,13 @@ fn hack<F>(&mut self, f: F) where
     fn with<F>(&mut self, wrap_scope: Scope, f: F) where
         F: for<'b> FnOnce(ScopeRef, &mut LifetimeContext<'b, 'tcx>),
     {
-        let LifetimeContext {sess, hir_map, ref mut map, ..} = *self;
+        let LifetimeContext {sess, cstore, hir_map, ref mut map, ..} = *self;
         let labels_in_fn = replace(&mut self.labels_in_fn, vec![]);
         let xcrate_object_lifetime_defaults =
             replace(&mut self.xcrate_object_lifetime_defaults, DefIdMap());
         let mut this = LifetimeContext {
             sess,
+            cstore,
             hir_map,
             map: *map,
             scope: &wrap_scope,
@@ -932,7 +937,7 @@ fn visit_segment_parameters(&mut self,
             let def_key = if def_id.is_local() {
                 this.hir_map.def_key(def_id)
             } else {
-                this.sess.cstore.def_key(def_id)
+                this.cstore.def_key(def_id)
             };
             DefId {
                 krate: def_id.krate,
@@ -976,7 +981,7 @@ fn visit_segment_parameters(&mut self,
             let unsubst = if let Some(id) = self.hir_map.as_local_node_id(def_id) {
                 &map.object_lifetime_defaults[&id]
             } else {
-                let cstore = &self.sess.cstore;
+                let cstore = self.cstore;
                 self.xcrate_object_lifetime_defaults.entry(def_id).or_insert_with(|| {
                     cstore.item_generics_cloned_untracked(def_id).types.into_iter().map(|def| {
                         def.object_lifetime_default
index b7e07f94f3df14b3ca57ae850146322da403ba97..59f600f39077c33e53cdad551b39b5d5bc8b4afd 100644 (file)
@@ -1953,13 +1953,12 @@ mod tests {
     use errors;
     use getopts;
     use lint;
-    use middle::cstore::{self, DummyCrateStore};
+    use middle::cstore;
     use session::config::{build_configuration, build_session_options_and_crate_config};
     use session::build_session;
     use std::collections::{BTreeMap, BTreeSet};
     use std::iter::FromIterator;
     use std::path::PathBuf;
-    use std::rc::Rc;
     use super::{OutputType, OutputTypes, Externs};
     use rustc_back::{PanicStrategy, RelroLevel};
     use syntax::symbol::Symbol;
@@ -1991,7 +1990,7 @@ fn test_switch_implies_cfg_test() {
             };
         let registry = errors::registry::Registry::new(&[]);
         let (sessopts, cfg) = build_session_options_and_crate_config(matches);
-        let sess = build_session(sessopts, &dep_graph, None, registry, Rc::new(DummyCrateStore));
+        let sess = build_session(sessopts, &dep_graph, None, registry);
         let cfg = build_configuration(&sess, cfg);
         assert!(cfg.contains(&(Symbol::intern("test"), None)));
     }
@@ -2010,8 +2009,7 @@ fn test_switch_implies_cfg_test_unless_cfg_test() {
             };
         let registry = errors::registry::Registry::new(&[]);
         let (sessopts, cfg) = build_session_options_and_crate_config(matches);
-        let sess = build_session(sessopts, &dep_graph, None, registry,
-                                 Rc::new(DummyCrateStore));
+        let sess = build_session(sessopts, &dep_graph, None, registry);
         let cfg = build_configuration(&sess, cfg);
         let mut test_items = cfg.iter().filter(|&&(name, _)| name == "test");
         assert!(test_items.next().is_some());
@@ -2027,8 +2025,7 @@ fn test_can_print_warnings() {
             ]).unwrap();
             let registry = errors::registry::Registry::new(&[]);
             let (sessopts, _) = build_session_options_and_crate_config(&matches);
-            let sess = build_session(sessopts, &dep_graph, None, registry,
-                                     Rc::new(DummyCrateStore));
+            let sess = build_session(sessopts, &dep_graph, None, registry);
             assert!(!sess.diagnostic().can_emit_warnings);
         }
 
@@ -2039,8 +2036,7 @@ fn test_can_print_warnings() {
             ]).unwrap();
             let registry = errors::registry::Registry::new(&[]);
             let (sessopts, _) = build_session_options_and_crate_config(&matches);
-            let sess = build_session(sessopts, &dep_graph, None, registry,
-                                     Rc::new(DummyCrateStore));
+            let sess = build_session(sessopts, &dep_graph, None, registry);
             assert!(sess.diagnostic().can_emit_warnings);
         }
 
@@ -2050,8 +2046,7 @@ fn test_can_print_warnings() {
             ]).unwrap();
             let registry = errors::registry::Registry::new(&[]);
             let (sessopts, _) = build_session_options_and_crate_config(&matches);
-            let sess = build_session(sessopts, &dep_graph, None, registry,
-                                     Rc::new(DummyCrateStore));
+            let sess = build_session(sessopts, &dep_graph, None, registry);
             assert!(sess.diagnostic().can_emit_warnings);
         }
     }
index 129a9f55750083da96e64009f3e4449351f96116..1f9cb2b03100fba2fec8d091d2c3b554e2bed528 100644 (file)
@@ -15,7 +15,6 @@
 use hir::def_id::{CrateNum, DefIndex};
 
 use lint;
-use middle::cstore::CrateStore;
 use middle::allocator::AllocatorKind;
 use middle::dependency_format;
 use session::search_paths::PathKind;
@@ -63,7 +62,6 @@ pub struct Session {
     pub target: config::Config,
     pub host: Target,
     pub opts: config::Options,
-    pub cstore: Rc<CrateStore>,
     pub parse_sess: ParseSess,
     // For a library crate, this is always none
     pub entry_fn: RefCell<Option<(NodeId, Span)>>,
@@ -621,8 +619,7 @@ pub fn consider_optimizing<T: Fn() -> String>(&self, crate_name: &str, msg: T) -
 pub fn build_session(sopts: config::Options,
                      dep_graph: &DepGraph,
                      local_crate_source_file: Option<PathBuf>,
-                     registry: errors::registry::Registry,
-                     cstore: Rc<CrateStore>)
+                     registry: errors::registry::Registry)
                      -> Session {
     let file_path_mapping = sopts.file_path_mapping();
 
@@ -630,7 +627,6 @@ pub fn build_session(sopts: config::Options,
                                dep_graph,
                                local_crate_source_file,
                                registry,
-                               cstore,
                                Rc::new(codemap::CodeMap::new(file_path_mapping)),
                                None)
 }
@@ -639,7 +635,6 @@ pub fn build_session_with_codemap(sopts: config::Options,
                                   dep_graph: &DepGraph,
                                   local_crate_source_file: Option<PathBuf>,
                                   registry: errors::registry::Registry,
-                                  cstore: Rc<CrateStore>,
                                   codemap: Rc<codemap::CodeMap>,
                                   emitter_dest: Option<Box<Write + Send>>)
                                   -> Session {
@@ -680,16 +675,14 @@ pub fn build_session_with_codemap(sopts: config::Options,
                    dep_graph,
                    local_crate_source_file,
                    diagnostic_handler,
-                   codemap,
-                   cstore)
+                   codemap)
 }
 
 pub fn build_session_(sopts: config::Options,
                       dep_graph: &DepGraph,
                       local_crate_source_file: Option<PathBuf>,
                       span_diagnostic: errors::Handler,
-                      codemap: Rc<codemap::CodeMap>,
-                      cstore: Rc<CrateStore>)
+                      codemap: Rc<codemap::CodeMap>)
                       -> Session {
     let host = match Target::search(config::host_triple()) {
         Ok(t) => t,
@@ -726,7 +719,6 @@ pub fn build_session_(sopts: config::Options,
         target: target_cfg,
         host,
         opts: sopts,
-        cstore,
         parse_sess: p_s,
         // For a library crate, this is always none
         entry_fn: RefCell::new(None),
index b6b602c0a4dc6536c6d4e916b5c9e3965ea97ace..88fcbc1707ed92897f726a5eecfb0630b79282e3 100644 (file)
 use hir::map::DefPathHash;
 use lint::{self, Lint};
 use ich::{self, StableHashingContext, NodeIdHashingMode};
+<<<<<<< 817e1b81e230d599585f860cdcad96c5ed83b93e
 use middle::const_val::ConstVal;
+=======
+use middle::cstore::CrateStore;
+>>>>>>> Remove the `cstore` reference from Session in order to prepare encapsulating CrateStore access in tcx.
 use middle::free_region::FreeRegionMap;
 use middle::lang_items;
 use middle::resolve_lifetime::{self, ObjectLifetimeDefault};
@@ -810,8 +814,11 @@ pub struct GlobalCtxt<'tcx> {
     global_arenas: &'tcx GlobalArenas<'tcx>,
     global_interners: CtxtInterners<'tcx>,
 
+    cstore: &'tcx CrateStore,
+
     pub sess: &'tcx Session,
 
+
     pub trans_trait_caches: traits::trans::TransTraitCaches<'tcx>,
 
     pub dep_graph: DepGraph,
@@ -908,6 +915,10 @@ pub fn global_tcx<'a>(&'a self) -> TyCtxt<'a, 'tcx, 'tcx> {
 }
 
 impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
+    pub fn cstore_untracked(&self) -> &CrateStore {
+        &*self.cstore
+    }
+
     pub fn alloc_generics(self, generics: ty::Generics) -> &'gcx ty::Generics {
         self.global_arenas.generics.alloc(generics)
     }
@@ -1009,6 +1020,7 @@ fn is_global(self) -> bool {
     /// value (types, substs, etc.) can only be used while `ty::tls` has a valid
     /// reference to the context, to allow formatting values that need it.
     pub fn create_and_enter<F, R>(s: &'tcx Session,
+                                  cstore: &'tcx CrateStore,
                                   local_providers: ty::maps::Providers<'tcx>,
                                   extern_providers: ty::maps::Providers<'tcx>,
                                   mir_passes: Rc<Passes>,
@@ -1025,16 +1037,15 @@ pub fn create_and_enter<F, R>(s: &'tcx Session,
         let interners = CtxtInterners::new(arena);
         let common_types = CommonTypes::new(&interners);
         let dep_graph = hir.dep_graph.clone();
-        let max_cnum = s.cstore.crates_untracked().iter().map(|c| c.as_usize()).max().unwrap_or(0);
+        let max_cnum = cstore.crates_untracked().iter().map(|c| c.as_usize()).max().unwrap_or(0);
         let mut providers = IndexVec::from_elem_n(extern_providers, max_cnum + 1);
         providers[LOCAL_CRATE] = local_providers;
 
         let def_path_hash_to_def_id = if s.opts.build_dep_graph() {
-            let upstream_def_path_tables: Vec<(CrateNum, Rc<_>)> = s
-                .cstore
+            let upstream_def_path_tables: Vec<(CrateNum, Rc<_>)> = cstore
                 .crates_untracked()
                 .iter()
-                .map(|&cnum| (cnum, s.cstore.def_path_table(cnum)))
+                .map(|&cnum| (cnum, cstore.def_path_table(cnum)))
                 .collect();
 
             let def_path_tables = || {
@@ -1093,6 +1104,7 @@ pub fn create_and_enter<F, R>(s: &'tcx Session,
 
         tls::enter_global(GlobalCtxt {
             sess: s,
+            cstore,
             trans_trait_caches: traits::trans::TransTraitCaches::new(dep_graph.clone()),
             global_arenas: arenas,
             global_interners: interners,
index da64c73f8d078bacaff237fcf597ecf8c96b3252..64b231b11fc852a263243a6772529684cd5a55a3 100644 (file)
@@ -151,7 +151,7 @@ pub fn try_push_visible_item_path<T>(self, buffer: &mut T, external_def_id: DefI
                 }
             }
 
-            cur_path.push(self.sess.cstore.def_key(cur_def)
+            cur_path.push(self.cstore_untracked().def_key(cur_def)
                               .disambiguated_data.data.get_opt_name().unwrap_or_else(||
                 Symbol::intern("<unnamed>").as_str()));
             match visible_parent_map.get(&cur_def) {
index 586d8607e89a195683d1377283658a44fb76b22f..59c42c701295478a619afd083ddc33a9591dce4a 100644 (file)
@@ -2174,7 +2174,7 @@ pub fn def_key(self, id: DefId) -> hir_map::DefKey {
         if id.is_local() {
             self.hir.def_key(id)
         } else {
-            self.sess.cstore.def_key(id)
+            self.cstore_untracked().def_key(id)
         }
     }
 
@@ -2187,7 +2187,7 @@ pub fn def_path(self, id: DefId) -> hir_map::DefPath {
         if id.is_local() {
             self.hir.def_path(id)
         } else {
-            self.sess.cstore.def_path(id)
+            self.cstore_untracked().def_path(id)
         }
     }
 
@@ -2196,7 +2196,7 @@ pub fn def_path_hash(self, def_id: DefId) -> hir_map::DefPathHash {
         if def_id.is_local() {
             self.hir.definitions().def_path_hash(def_id.index)
         } else {
-            self.sess.cstore.def_path_hash(def_id)
+            self.cstore_untracked().def_path_hash(def_id)
         }
     }
 
@@ -2206,7 +2206,7 @@ pub fn item_name(self, id: DefId) -> InternedString {
         } else if id.index == CRATE_DEF_INDEX {
             self.original_crate_name(id.krate).as_str()
         } else {
-            let def_key = self.sess.cstore.def_key(id);
+            let def_key = self.cstore_untracked().def_key(id);
             // The name of a StructCtor is that of its struct parent.
             if let hir_map::DefPathData::StructCtor = def_key.disambiguated_data.data {
                 self.item_name(DefId {
index b4dde2120a840bcad56ef8146be35f133397982e..5a35de7b6aa2b6009fcaebe50189661cabed491e 100644 (file)
@@ -21,6 +21,7 @@
 use rustc::session::search_paths::PathKind;
 use rustc::lint;
 use rustc::middle::{self, stability, reachable};
+use rustc::middle::cstore::CrateStore;
 use rustc::middle::privacy::AccessLevels;
 use rustc::mir::transform::{MIR_CONST, MIR_VALIDATED, MIR_OPTIMIZED, Passes};
 use rustc::ty::{self, TyCtxt, Resolutions, GlobalArenas};
@@ -200,6 +201,7 @@ macro_rules! controller_entry_point {
         };
 
         phase_3_run_analysis_passes(sess,
+                                    cstore,
                                     hir_map,
                                     analysis,
                                     resolutions,
@@ -272,7 +274,7 @@ macro_rules! controller_entry_point {
                                 phase5_result);
         phase5_result?;
 
-        phase_6_link_output(sess, &trans, &outputs);
+        phase_6_link_output(sess, cstore, &trans, &outputs);
 
         // Now that we won't touch anything in the incremental compilation directory
         // any more, we can finalize it (which involves renaming it)
@@ -385,7 +387,7 @@ pub struct CompileState<'a, 'tcx: 'a> {
     pub session: &'tcx Session,
     pub krate: Option<ast::Crate>,
     pub registry: Option<Registry<'a>>,
-    pub cstore: Option<&'a CStore>,
+    pub cstore: Option<&'tcx CStore>,
     pub crate_name: Option<&'a str>,
     pub output_filenames: Option<&'a OutputFilenames>,
     pub out_dir: Option<&'a Path>,
@@ -433,7 +435,7 @@ fn state_after_parse(input: &'a Input,
                          out_dir: &'a Option<PathBuf>,
                          out_file: &'a Option<PathBuf>,
                          krate: ast::Crate,
-                         cstore: &'a CStore)
+                         cstore: &'tcx CStore)
                          -> Self {
         CompileState {
             // Initialize the registry before moving `krate`
@@ -449,7 +451,7 @@ fn state_after_expand(input: &'a Input,
                           session: &'tcx Session,
                           out_dir: &'a Option<PathBuf>,
                           out_file: &'a Option<PathBuf>,
-                          cstore: &'a CStore,
+                          cstore: &'tcx CStore,
                           expanded_crate: &'a ast::Crate,
                           crate_name: &'a str)
                           -> Self {
@@ -468,7 +470,7 @@ fn state_after_hir_lowering(input: &'a Input,
                                 out_file: &'a Option<PathBuf>,
                                 arena: &'tcx DroplessArena,
                                 arenas: &'tcx GlobalArenas<'tcx>,
-                                cstore: &'a CStore,
+                                cstore: &'tcx CStore,
                                 hir_map: &'a hir_map::Map<'tcx>,
                                 analysis: &'a ty::CrateAnalysis,
                                 resolutions: &'a Resolutions,
@@ -696,6 +698,7 @@ pub fn phase_2_configure_and_expand<F>(sess: &Session,
     let mut crate_loader = CrateLoader::new(sess, &cstore, crate_name);
     let resolver_arenas = Resolver::arenas();
     let mut resolver = Resolver::new(sess,
+                                     cstore,
                                      &krate,
                                      crate_name,
                                      make_glob_map,
@@ -844,7 +847,7 @@ pub fn phase_2_configure_and_expand<F>(sess: &Session,
 
     // Lower ast -> hir.
     let hir_forest = time(time_passes, "lowering ast -> hir", || {
-        let hir_crate = lower_crate(sess, &krate, &mut resolver);
+        let hir_crate = lower_crate(sess, cstore, &krate, &mut resolver);
 
         if sess.opts.debugging_opts.hir_stats {
             hir_stats::print_hir_stats(&hir_crate);
@@ -886,6 +889,7 @@ pub fn phase_2_configure_and_expand<F>(sess: &Session,
 /// miscellaneous analysis passes on the crate. Return various
 /// structures carrying the results of the analysis.
 pub fn phase_3_run_analysis_passes<'tcx, F, R>(sess: &'tcx Session,
+                                               cstore: &'tcx CrateStore,
                                                hir_map: hir_map::Map<'tcx>,
                                                mut analysis: ty::CrateAnalysis,
                                                resolutions: Resolutions,
@@ -915,7 +919,7 @@ macro_rules! try_with_f {
 
     let named_region_map = time(time_passes,
                                 "lifetime resolution",
-                                || middle::resolve_lifetime::krate(sess, &hir_map))?;
+                                || middle::resolve_lifetime::krate(sess, cstore, &hir_map))?;
 
     time(time_passes,
          "looking for entry point",
@@ -1012,6 +1016,7 @@ macro_rules! try_with_f {
     passes.push_pass(MIR_OPTIMIZED, mir::transform::dump_mir::Marker("PreTrans"));
 
     TyCtxt::create_and_enter(sess,
+                             cstore,
                              local_providers,
                              extern_providers,
                              Rc::new(passes),
@@ -1148,10 +1153,15 @@ pub fn phase_5_run_llvm_passes(sess: &Session,
 /// This should produce either a finished executable or library.
 #[cfg(feature="llvm")]
 pub fn phase_6_link_output(sess: &Session,
+                           cstore: &CrateStore,
                            trans: &trans::CrateTranslation,
                            outputs: &OutputFilenames) {
     time(sess.time_passes(), "linking", || {
-        ::rustc_trans::back::link::link_binary(sess, trans, outputs, &trans.crate_name.as_str())
+        ::rustc_trans::back::link::link_binary(sess,
+                                               cstore,
+                                               trans,
+                                               outputs,
+                                               &trans.crate_name.as_str())
     });
 }
 
index 78b20a73b83c31107d09bf4592f920039c8d1197..099dda17823e67f864b112e437ae8ba72c65ec77 100644 (file)
@@ -72,6 +72,7 @@
 use rustc::session::{early_error, early_warn};
 use rustc::lint::Lint;
 use rustc::lint;
+use rustc::middle::cstore::CrateStore;
 use rustc_metadata::locator;
 use rustc_metadata::cstore::CStore;
 use rustc::util::common::{time, ErrorReported};
@@ -299,7 +300,7 @@ macro_rules! do_or_return {($expr: expr, $sess: expr) => {
     let loader = file_loader.unwrap_or(box RealFileLoader);
     let codemap = Rc::new(CodeMap::with_file_loader(loader, sopts.file_path_mapping()));
     let mut sess = session::build_session_with_codemap(
-        sopts, &dep_graph, input_file_path, descriptions, cstore.clone(), codemap, emitter_dest,
+        sopts, &dep_graph, input_file_path, descriptions, codemap, emitter_dest,
     );
     rustc_trans::init(&sess);
     rustc_lint::register_builtins(&mut sess.lint_store.borrow_mut(), Some(&sess));
@@ -308,7 +309,12 @@ macro_rules! do_or_return {($expr: expr, $sess: expr) => {
     target_features::add_configuration(&mut cfg, &sess);
     sess.parse_sess.config = cfg;
 
-    do_or_return!(callbacks.late_callback(&matches, &sess, &input, &odir, &ofile), Some(sess));
+    do_or_return!(callbacks.late_callback(&matches,
+                                          &sess,
+                                          &*cstore,
+                                          &input,
+                                          &odir,
+                                          &ofile), Some(sess));
 
     let plugins = sess.opts.debugging_opts.extra_plugins.clone();
     let control = callbacks.build_controller(&sess, &matches);
@@ -400,6 +406,7 @@ fn early_callback(&mut self,
     fn late_callback(&mut self,
                      _: &getopts::Matches,
                      _: &Session,
+                     _: &CrateStore,
                      _: &Input,
                      _: &Option<PathBuf>,
                      _: &Option<PathBuf>)
@@ -574,12 +581,10 @@ fn no_input(&mut self,
                     return None;
                 }
                 let dep_graph = DepGraph::new(sopts.build_dep_graph());
-                let cstore = Rc::new(CStore::new(box ::MetadataLoader));
                 let mut sess = build_session(sopts.clone(),
                     &dep_graph,
                     None,
-                    descriptions.clone(),
-                    cstore.clone());
+                    descriptions.clone());
                 rustc_trans::init(&sess);
                 rustc_lint::register_builtins(&mut sess.lint_store.borrow_mut(), Some(&sess));
                 let mut cfg = config::build_configuration(&sess, cfg.clone());
@@ -601,12 +606,13 @@ fn no_input(&mut self,
     fn late_callback(&mut self,
                      matches: &getopts::Matches,
                      sess: &Session,
+                     cstore: &CrateStore,
                      input: &Input,
                      odir: &Option<PathBuf>,
                      ofile: &Option<PathBuf>)
                      -> Compilation {
         RustcDefaultCalls::print_crate_info(sess, Some(input), odir, ofile)
-            .and_then(|| RustcDefaultCalls::list_metadata(sess, matches, input))
+            .and_then(|| RustcDefaultCalls::list_metadata(sess, cstore, matches, input))
     }
 
     fn build_controller(&mut self,
@@ -627,6 +633,7 @@ fn build_controller(&mut self,
                 };
                 control.after_hir_lowering.callback = box move |state| {
                     pretty::print_after_hir_lowering(state.session,
+                                                     state.cstore.unwrap(),
                                                      state.hir_map.unwrap(),
                                                      state.analysis.unwrap(),
                                                      state.resolutions.unwrap(),
@@ -711,7 +718,11 @@ fn save_analysis(sess: &Session) -> bool {
 }
 
 impl RustcDefaultCalls {
-    pub fn list_metadata(sess: &Session, matches: &getopts::Matches, input: &Input) -> Compilation {
+    pub fn list_metadata(sess: &Session,
+                         cstore: &CrateStore,
+                         matches: &getopts::Matches,
+                         input: &Input)
+                         -> Compilation {
         let r = matches.opt_strs("Z");
         if r.contains(&("ls".to_string())) {
             match input {
@@ -720,7 +731,7 @@ pub fn list_metadata(sess: &Session, matches: &getopts::Matches, input: &Input)
                     let mut v = Vec::new();
                     locator::list_file_metadata(&sess.target.target,
                                                 path,
-                                                sess.cstore.metadata_loader(),
+                                                cstore.metadata_loader(),
                                                 &mut v)
                             .unwrap();
                     println!("{}", String::from_utf8(v).unwrap());
index 6a58b7fb75360ba040058d142624c99bce0168e0..82dda2d2aa16278dfa6804132ac83d6df4780ff2 100644 (file)
@@ -21,6 +21,7 @@
 use rustc::cfg;
 use rustc::cfg::graphviz::LabelledCFG;
 use rustc::dep_graph::DepGraph;
+use rustc::middle::cstore::CrateStore;
 use rustc::session::Session;
 use rustc::session::config::Input;
 use rustc_borrowck as borrowck;
@@ -198,6 +199,7 @@ fn call_with_pp_support<'tcx, A, F>(&self,
     }
     fn call_with_pp_support_hir<'tcx, A, F>(&self,
                                                sess: &'tcx Session,
+                                               cstore: &'tcx CrateStore,
                                                hir_map: &hir_map::Map<'tcx>,
                                                analysis: &ty::CrateAnalysis,
                                                resolutions: &Resolutions,
@@ -226,6 +228,7 @@ fn call_with_pp_support_hir<'tcx, A, F>(&self,
             }
             PpmTyped => {
                 abort_on_err(driver::phase_3_run_analysis_passes(sess,
+                                                                 cstore,
                                                                  hir_map.clone(),
                                                                  analysis.clone(),
                                                                  resolutions.clone(),
@@ -875,6 +878,7 @@ pub fn print_after_parsing(sess: &Session,
 }
 
 pub fn print_after_hir_lowering<'tcx, 'a: 'tcx>(sess: &'a Session,
+                                                cstore: &'tcx CrateStore,
                                                 hir_map: &hir_map::Map<'tcx>,
                                                 analysis: &ty::CrateAnalysis,
                                                 resolutions: &Resolutions,
@@ -891,6 +895,7 @@ pub fn print_after_hir_lowering<'tcx, 'a: 'tcx>(sess: &'a Session,
 
     if ppm.needs_analysis() {
         print_with_analysis(sess,
+                            cstore,
                             hir_map,
                             analysis,
                             resolutions,
@@ -929,6 +934,7 @@ pub fn print_after_hir_lowering<'tcx, 'a: 'tcx>(sess: &'a Session,
             (PpmHir(s), None) => {
                 let out: &mut Write = &mut out;
                 s.call_with_pp_support_hir(sess,
+                                           cstore,
                                            hir_map,
                                            analysis,
                                            resolutions,
@@ -952,6 +958,7 @@ pub fn print_after_hir_lowering<'tcx, 'a: 'tcx>(sess: &'a Session,
             (PpmHir(s), Some(uii)) => {
                 let out: &mut Write = &mut out;
                 s.call_with_pp_support_hir(sess,
+                                           cstore,
                                            hir_map,
                                            analysis,
                                            resolutions,
@@ -993,6 +1000,7 @@ pub fn print_after_hir_lowering<'tcx, 'a: 'tcx>(sess: &'a Session,
 // with a different callback than the standard driver, so that isn't easy.
 // Instead, we call that function ourselves.
 fn print_with_analysis<'tcx, 'a: 'tcx>(sess: &'a Session,
+                                       cstore: &'a CrateStore,
                                        hir_map: &hir_map::Map<'tcx>,
                                        analysis: &ty::CrateAnalysis,
                                        resolutions: &Resolutions,
@@ -1013,6 +1021,7 @@ fn print_with_analysis<'tcx, 'a: 'tcx>(sess: &'a Session,
     let mut out = Vec::new();
 
     abort_on_err(driver::phase_3_run_analysis_passes(sess,
+                                                     cstore,
                                                      hir_map.clone(),
                                                      analysis.clone(),
                                                      resolutions.clone(),
index 9259474ee27c47752c37aa04013bd35835585c5b..d2fb9903683676a5e6b853183108de3d203166c0 100644 (file)
@@ -109,8 +109,7 @@ fn test_env<F>(source_string: &str,
                                        &dep_graph,
                                        None,
                                        diagnostic_handler,
-                                       Rc::new(CodeMap::new(FilePathMapping::empty())),
-                                       cstore.clone());
+                                       Rc::new(CodeMap::new(FilePathMapping::empty())));
     rustc_trans::init(&sess);
     rustc_lint::register_builtins(&mut sess.lint_store.borrow_mut(), Some(&sess));
     let input = config::Input::Str {
@@ -138,8 +137,9 @@ fn test_env<F>(source_string: &str,
     let hir_map = hir_map::map_crate(&mut hir_forest, defs);
 
     // run just enough stuff to build a tcx:
-    let named_region_map = resolve_lifetime::krate(&sess, &hir_map);
+    let named_region_map = resolve_lifetime::krate(&sess, &*cstore, &hir_map);
     TyCtxt::create_and_enter(&sess,
+                             &*cstore,
                              ty::maps::Providers::default(),
                              ty::maps::Providers::default(),
                              Rc::new(Passes::new()),
index b1a5029a735a5c317f4ee6e1e456d20acc036354..3a47ee1a36b8f5819d4617f639d04abbacf9afca 100644 (file)
@@ -60,7 +60,7 @@ pub fn provide<$lt>(providers: &mut Providers<$lt>) {
 
                 $tcx.dep_graph.read(dep_node);
 
-                let $cdata = $tcx.sess.cstore.crate_data_as_rc_any($def_id.krate);
+                let $cdata = $tcx.cstore_untracked().crate_data_as_rc_any($def_id.krate);
                 let $cdata = $cdata.downcast_ref::<cstore::CrateMetadata>()
                     .expect("CrateStore crated ata is not a CrateMetadata");
                 $compute
@@ -277,12 +277,12 @@ fn is_const_fn<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> bool {
         },
         extern_mod_stmt_cnum: |tcx, id| {
             let id = tcx.hir.as_local_node_id(id).unwrap();
-            tcx.sess.cstore.extern_mod_stmt_cnum_untracked(id)
+            tcx.cstore_untracked().extern_mod_stmt_cnum_untracked(id)
         },
 
         all_crate_nums: |tcx, cnum| {
             assert_eq!(cnum, LOCAL_CRATE);
-            Rc::new(tcx.sess.cstore.crates_untracked())
+            Rc::new(tcx.cstore_untracked().crates_untracked())
         },
 
         // Returns a map from a sufficiently visible external item (i.e. an
@@ -344,7 +344,7 @@ fn is_const_fn<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> bool {
 
         postorder_cnums: |tcx, cnum| {
             assert_eq!(cnum, LOCAL_CRATE);
-            Rc::new(tcx.sess.cstore.postorder_cnums_untracked())
+            Rc::new(tcx.cstore_untracked().postorder_cnums_untracked())
         },
 
         ..*providers
index 35e7522db0184435b6a2aedc1ca408d765add146..a4d1ae162157180509ec3a380146e278a3b8785c 100644 (file)
@@ -254,7 +254,7 @@ fn build_reduced_graph_for_item(&mut self, item: &Item, expansion: Mark) {
                 self.crate_loader.process_item(item, &self.definitions);
 
                 // n.b. we don't need to look at the path option here, because cstore already did
-                let crate_id = self.session.cstore.extern_mod_stmt_cnum_untracked(item.id).unwrap();
+                let crate_id = self.cstore.extern_mod_stmt_cnum_untracked(item.id).unwrap();
                 let module =
                     self.get_module(DefId { krate: crate_id, index: CRATE_DEF_INDEX });
                 self.populate_module_if_necessary(module);
@@ -450,7 +450,7 @@ fn build_reduced_graph_for_external_crate_def(&mut self, parent: Module<'a>, chi
         let ident = child.ident;
         let def = child.def;
         let def_id = def.def_id();
-        let vis = self.session.cstore.visibility_untracked(def_id);
+        let vis = self.cstore.visibility_untracked(def_id);
         let span = child.span;
         let expansion = Mark::root(); // FIXME(jseyfried) intercrate hygiene
         match def {
@@ -472,7 +472,7 @@ fn build_reduced_graph_for_external_crate_def(&mut self, parent: Module<'a>, chi
                 self.define(parent, ident, ValueNS, (def, vis, DUMMY_SP, expansion));
 
                 if let Some(struct_def_id) =
-                        self.session.cstore.def_key(def_id).parent
+                        self.cstore.def_key(def_id).parent
                             .map(|index| DefId { krate: def_id.krate, index: index }) {
                     self.struct_constructors.insert(struct_def_id, (def, vis));
                 }
@@ -486,12 +486,12 @@ fn build_reduced_graph_for_external_crate_def(&mut self, parent: Module<'a>, chi
                                              span);
                 self.define(parent, ident, TypeNS, (module, vis, DUMMY_SP, expansion));
 
-                for child in self.session.cstore.item_children_untracked(def_id, self.session) {
+                for child in self.cstore.item_children_untracked(def_id, self.session) {
                     let ns = if let Def::AssociatedTy(..) = child.def { TypeNS } else { ValueNS };
                     self.define(module, child.ident, ns,
                                 (child.def, ty::Visibility::Public, DUMMY_SP, expansion));
 
-                    if self.session.cstore.associated_item_cloned_untracked(child.def.def_id())
+                    if self.cstore.associated_item_cloned_untracked(child.def.def_id())
                            .method_has_self_argument {
                         self.has_self.insert(child.def.def_id());
                     }
@@ -502,7 +502,7 @@ fn build_reduced_graph_for_external_crate_def(&mut self, parent: Module<'a>, chi
                 self.define(parent, ident, TypeNS, (def, vis, DUMMY_SP, expansion));
 
                 // Record field names for error reporting.
-                let field_names = self.session.cstore.struct_field_names_untracked(def_id);
+                let field_names = self.cstore.struct_field_names_untracked(def_id);
                 self.insert_field_names(def_id, field_names);
             }
             Def::Macro(..) => {
@@ -517,15 +517,15 @@ pub fn get_module(&mut self, def_id: DefId) -> Module<'a> {
             return self.module_map[&def_id]
         }
 
-        let macros_only = self.session.cstore.dep_kind_untracked(def_id.krate).macros_only();
+        let macros_only = self.cstore.dep_kind_untracked(def_id.krate).macros_only();
         if let Some(&module) = self.extern_module_map.get(&(def_id, macros_only)) {
             return module;
         }
 
         let (name, parent) = if def_id.index == CRATE_DEF_INDEX {
-            (self.session.cstore.crate_name_untracked(def_id.krate).as_str(), None)
+            (self.cstore.crate_name_untracked(def_id.krate).as_str(), None)
         } else {
-            let def_key = self.session.cstore.def_key(def_id);
+            let def_key = self.cstore.def_key(def_id);
             (def_key.disambiguated_data.data.get_opt_name().unwrap(),
              Some(self.get_module(DefId { index: def_key.parent.unwrap(), ..def_id })))
         };
@@ -559,7 +559,7 @@ pub fn get_macro(&mut self, def: Def) -> Rc<SyntaxExtension> {
             return ext.clone();
         }
 
-        let macro_def = match self.session.cstore.load_macro_untracked(def_id, &self.session) {
+        let macro_def = match self.cstore.load_macro_untracked(def_id, &self.session) {
             LoadedMacro::MacroDef(macro_def) => macro_def,
             LoadedMacro::ProcMacro(ext) => return ext,
         };
@@ -576,7 +576,7 @@ pub fn get_macro(&mut self, def: Def) -> Rc<SyntaxExtension> {
     pub fn populate_module_if_necessary(&mut self, module: Module<'a>) {
         if module.populated.get() { return }
         let def_id = module.def_id().unwrap();
-        for child in self.session.cstore.item_children_untracked(def_id, self.session) {
+        for child in self.cstore.item_children_untracked(def_id, self.session) {
             self.build_reduced_graph_for_external_crate_def(module, child);
         }
         module.populated.set(true)
@@ -607,7 +607,7 @@ fn process_legacy_macro_imports(&mut self, item: &Item, module: Module<'a>, expa
             span_err!(self.session, item.span, E0468,
                       "an `extern crate` loading macros must be at the crate root");
         } else if !self.use_extern_macros && !used &&
-                  self.session.cstore.dep_kind_untracked(module.def_id().unwrap().krate)
+                  self.cstore.dep_kind_untracked(module.def_id().unwrap().krate)
                       .macros_only() {
             let msg = "proc macro crates and `#[no_link]` crates have no effect without \
                        `#[macro_use]`";
@@ -651,7 +651,7 @@ fn process_legacy_macro_imports(&mut self, item: &Item, module: Module<'a>, expa
             }
         }
         for (name, span) in legacy_imports.reexports {
-            self.session.cstore.export_macros_untracked(module.def_id().unwrap().krate);
+            self.cstore.export_macros_untracked(module.def_id().unwrap().krate);
             let ident = Ident::with_empty_ctxt(name);
             let result = self.resolve_ident_in_module(module, ident, MacroNS, false, false, span);
             if let Ok(binding) = result {
index 8f920e792b33c9e42aca873c7d4bb9fd4a0155ff..691329c608c978a78f98731c7d1d6ba48cd06ce4 100644 (file)
@@ -31,7 +31,7 @@
 
 use rustc::hir::map::{Definitions, DefCollector};
 use rustc::hir::{self, PrimTy, TyBool, TyChar, TyFloat, TyInt, TyUint, TyStr};
-use rustc::middle::cstore::CrateLoader;
+use rustc::middle::cstore::{CrateStore, CrateLoader};
 use rustc::session::Session;
 use rustc::lint;
 use rustc::hir::def::*;
@@ -1176,6 +1176,7 @@ fn intern(&mut self, string: &str, primitive_type: PrimTy) {
 /// The main resolver class.
 pub struct Resolver<'a> {
     session: &'a Session,
+    cstore: &'a CrateStore,
 
     pub definitions: Definitions,
 
@@ -1343,7 +1344,7 @@ impl<'a, 'b: 'a> ty::DefIdTree for &'a Resolver<'b> {
     fn parent(self, id: DefId) -> Option<DefId> {
         match id.krate {
             LOCAL_CRATE => self.definitions.def_key(id.index).parent,
-            _ => self.session.cstore.def_key(id).parent,
+            _ => self.cstore.def_key(id).parent,
         }.map(|index| DefId { index: index, ..id })
     }
 }
@@ -1383,6 +1384,7 @@ fn definitions(&mut self) -> &mut Definitions {
 
 impl<'a> Resolver<'a> {
     pub fn new(session: &'a Session,
+               cstore: &'a CrateStore,
                krate: &Crate,
                crate_name: &str,
                make_glob_map: MakeGlobMap,
@@ -1414,6 +1416,8 @@ pub fn new(session: &'a Session,
         Resolver {
             session,
 
+            cstore,
+
             definitions,
 
             // The outermost module has def ID 0; this is not reflected in the
index c083a0ff58855a51eaddc86d508a0300ee087ffb..064032b888499abb77d13451e8c2c4967dee59c8 100644 (file)
@@ -778,7 +778,7 @@ fn err_if_macro_use_proc_macro(&mut self, name: Name, use_span: Span,
             _ => return,
         };
 
-        let crate_name = self.session.cstore.crate_name_untracked(krate);
+        let crate_name = self.cstore.crate_name_untracked(krate);
 
         self.session.struct_span_err(use_span, warn_msg)
             .help(&format!("instead, import the procedural macro like any other item: \
index 18f8370c1b3f5ed1590a58e7dbe9544cceb8a454..b85bf18ea800c4fec42d0a7947aa566c4d49d3e6 100644 (file)
@@ -844,7 +844,7 @@ fn finalize_resolutions_in(&mut self, module: Module<'b>) {
                 let def = binding.def();
                 if def != Def::Err {
                     if !def.def_id().is_local() {
-                        self.session.cstore.export_macros_untracked(def.def_id().krate);
+                        self.cstore.export_macros_untracked(def.def_id().krate);
                     }
                     if let Def::Macro(..) = def {
                         if let Some(&span) = exported_macro_names.get(&ident.modern()) {
index 5d45aafe78d2510ddd63c342a3a1e078ba9e56c7..efb56ab5a6cac64231d53b5b5915d0629a33c280 100644 (file)
@@ -185,7 +185,11 @@ pub fn link_binary(sess: &Session,
            bug!("invalid output type `{:?}` for target os `{}`",
                 crate_type, sess.opts.target_triple);
         }
-        let mut out_files = link_binary_output(sess, trans, crate_type, outputs, crate_name);
+        let mut out_files = link_binary_output(sess,
+                                               trans,
+                                               crate_type,
+                                               outputs,
+                                               crate_name);
         out_filenames.append(&mut out_files);
     }
 
@@ -346,8 +350,8 @@ fn link_binary_output(sess: &Session,
                                tmpdir.path());
             }
             _ => {
-                link_natively(sess, crate_type, &objects, &out_filename, trans,
-                              outputs, tmpdir.path());
+                link_natively(sess, crate_type, &objects, &out_filename,
+                              trans, outputs, tmpdir.path());
             }
         }
         out_filenames.push(out_filename);
index 73209affe994b4462f51e08c2c079203ea054f7e..ade05003ef84c9495c18a01aa6d1830cd1a227f5 100644 (file)
@@ -777,7 +777,7 @@ enum MetadataKind {
                 EncodedMetadataHashes::new());
     }
 
-    let cstore = &tcx.sess.cstore;
+    let cstore = tcx.cstore_untracked();
     let (metadata, hashes) = cstore.encode_metadata(tcx,
                                                     &link_meta,
                                                     exported_symbols);
index 742d4bf197ee25d9aa601f008156495739058ff6..81396d41606a8e11450b7461d504e57cbdbe5191 100644 (file)
@@ -148,7 +148,7 @@ pub fn run_core(search_paths: SearchPaths,
     let _ignore = dep_graph.in_ignore();
     let cstore = Rc::new(CStore::new(box rustc_trans::LlvmMetadataLoader));
     let mut sess = session::build_session_(
-        sessopts, &dep_graph, cpath, diagnostic_handler, codemap, cstore.clone()
+        sessopts, &dep_graph, cpath, diagnostic_handler, codemap
     );
     rustc_trans::init(&sess);
     rustc_lint::register_builtins(&mut sess.lint_store.borrow_mut(), Some(&sess));
@@ -181,6 +181,7 @@ pub fn run_core(search_paths: SearchPaths,
     let hir_map = hir_map::map_crate(&mut hir_forest, defs);
 
     abort_on_err(driver::phase_3_run_analysis_passes(&sess,
+                                                     &*cstore,
                                                      hir_map,
                                                      analysis,
                                                      resolutions,
index 700bbe23bab72d5454d5e58be73dc89f3ddd8166..9b76a713b1769541561b0727fd74b2d3c463b6b9 100644 (file)
@@ -87,7 +87,7 @@ pub fn run(input: &str,
     let _ignore = dep_graph.in_ignore();
     let cstore = Rc::new(CStore::new(box rustc_trans::LlvmMetadataLoader));
     let mut sess = session::build_session_(
-        sessopts, &dep_graph, Some(input_path.clone()), handler, codemap.clone(), cstore.clone(),
+        sessopts, &dep_graph, Some(input_path.clone()), handler, codemap.clone()
     );
     rustc_trans::init(&sess);
     rustc_lint::register_builtins(&mut sess.lint_store.borrow_mut(), Some(&sess));
@@ -240,7 +240,7 @@ fn drop(&mut self) {
     let dep_graph = DepGraph::new(false);
     let cstore = Rc::new(CStore::new(box rustc_trans::LlvmMetadataLoader));
     let mut sess = session::build_session_(
-        sessopts, &dep_graph, None, diagnostic_handler, codemap, cstore.clone(),
+        sessopts, &dep_graph, None, diagnostic_handler, codemap
     );
     rustc_trans::init(&sess);
     rustc_lint::register_builtins(&mut sess.lint_store.borrow_mut(), Some(&sess));
index 9caf83d995444aa81c20502c785f2f54b365387e..2e3fb785748f3f5345aa01515a11f17b1272fc44 100644 (file)
@@ -60,7 +60,7 @@ fn basic_sess(sysroot: PathBuf) -> (Session, Rc<CStore>) {
     let descriptions = Registry::new(&rustc::DIAGNOSTICS);
     let dep_graph = DepGraph::new(opts.build_dep_graph());
     let cstore = Rc::new(CStore::new(Box::new(rustc_trans::LlvmMetadataLoader)));
-    let sess = build_session(opts, &dep_graph, None, descriptions, cstore.clone());
+    let sess = build_session(opts, &dep_graph, None, descriptions);
     rustc_trans::init(&sess);
     rustc_lint::register_builtins(&mut sess.lint_store.borrow_mut(), Some(&sess));
     (sess, cstore)
index 4a397621ceb53ebfc5bb31723a4eb8f9a5ee2077..b5c1ee099037cac9ea64d425cd5b8d710906f6f2 100644 (file)
@@ -21,6 +21,7 @@
 extern crate syntax;
 extern crate rustc_errors as errors;
 
+use rustc::middle::cstore::CrateStore;
 use rustc::session::Session;
 use rustc::session::config::{self, Input};
 use rustc_driver::{driver, CompilerCalls, Compilation};
@@ -47,6 +48,7 @@ fn early_callback(&mut self,
     fn late_callback(&mut self,
                      _: &getopts::Matches,
                      _: &Session,
+                     _: &CrateStore,
                      _: &Input,
                      _: &Option<PathBuf>,
                      _: &Option<PathBuf>)