]> git.lizzy.rs Git - rust.git/commitdiff
middle: resolve: fix inconsistencies around ExportMap and remove the 2 suffix.
authorEduard Burtescu <edy.burt@gmail.com>
Thu, 18 Dec 2014 18:27:17 +0000 (20:27 +0200)
committerEduard Burtescu <edy.burt@gmail.com>
Sat, 20 Dec 2014 05:11:03 +0000 (07:11 +0200)
src/librustc/metadata/encoder.rs
src/librustc/middle/privacy.rs
src/librustc/middle/resolve.rs
src/librustc/middle/ty.rs
src/librustc_driver/driver.rs
src/librustc_trans/trans/base.rs
src/librustc_trans/trans/context.rs

index cc383aa217a7b8ba459a0b2df375103176fdf3ae..e3657cf935a4419acd5e943c1f14cdbba04050ff 100644 (file)
@@ -66,7 +66,7 @@ pub enum InlinedItemRef<'a> {
 pub struct EncodeParams<'a, 'tcx: 'a> {
     pub diag: &'a SpanHandler,
     pub tcx: &'a ty::ctxt<'tcx>,
-    pub reexports2: &'a middle::resolve::ExportMap2,
+    pub reexports: &'a middle::resolve::ExportMap,
     pub item_symbols: &'a RefCell<NodeMap<String>>,
     pub link_meta: &'a LinkMeta,
     pub cstore: &'a cstore::CStore,
@@ -77,7 +77,7 @@ pub struct EncodeParams<'a, 'tcx: 'a> {
 pub struct EncodeContext<'a, 'tcx: 'a> {
     pub diag: &'a SpanHandler,
     pub tcx: &'a ty::ctxt<'tcx>,
-    pub reexports2: &'a middle::resolve::ExportMap2,
+    pub reexports: &'a middle::resolve::ExportMap,
     pub item_symbols: &'a RefCell<NodeMap<String>>,
     pub link_meta: &'a LinkMeta,
     pub cstore: &'a cstore::CStore,
@@ -379,7 +379,7 @@ fn encode_path<PI: Iterator<PathElem>>(rbml_w: &mut Encoder, path: PI) {
 }
 
 fn encode_reexported_static_method(rbml_w: &mut Encoder,
-                                   exp: &middle::resolve::Export2,
+                                   exp: &middle::resolve::Export,
                                    method_def_id: DefId,
                                    method_name: ast::Name) {
     debug!("(encode reexported static method) {}::{}",
@@ -398,7 +398,7 @@ fn encode_reexported_static_method(rbml_w: &mut Encoder,
 
 fn encode_reexported_static_base_methods(ecx: &EncodeContext,
                                          rbml_w: &mut Encoder,
-                                         exp: &middle::resolve::Export2)
+                                         exp: &middle::resolve::Export)
                                          -> bool {
     let impl_items = ecx.tcx.impl_items.borrow();
     match ecx.tcx.inherent_impls.borrow().get(&exp.def_id) {
@@ -428,7 +428,7 @@ fn encode_reexported_static_base_methods(ecx: &EncodeContext,
 
 fn encode_reexported_static_trait_methods(ecx: &EncodeContext,
                                           rbml_w: &mut Encoder,
-                                          exp: &middle::resolve::Export2)
+                                          exp: &middle::resolve::Export)
                                           -> bool {
     match ecx.tcx.trait_items_cache.borrow().get(&exp.def_id) {
         Some(trait_items) => {
@@ -449,7 +449,7 @@ fn encode_reexported_static_trait_methods(ecx: &EncodeContext,
 fn encode_reexported_static_methods(ecx: &EncodeContext,
                                     rbml_w: &mut Encoder,
                                     mod_path: PathElems,
-                                    exp: &middle::resolve::Export2) {
+                                    exp: &middle::resolve::Export) {
     if let Some(ast_map::NodeItem(item)) = ecx.tcx.map.find(exp.def_id.node) {
         let original_name = token::get_ident(item.ident);
 
@@ -519,7 +519,7 @@ fn encode_reexports(ecx: &EncodeContext,
                     id: NodeId,
                     path: PathElems) {
     debug!("(encoding info for module) encoding reexports for {}", id);
-    match ecx.reexports2.get(&id) {
+    match ecx.reexports.get(&id) {
         Some(ref exports) => {
             debug!("(encoding info for module) found reexports for {}", id);
             for exp in exports.iter() {
@@ -2071,7 +2071,7 @@ struct Stats {
         item_symbols,
         diag,
         tcx,
-        reexports2,
+        reexports,
         cstore,
         encode_inlined_item,
         link_meta,
@@ -2081,7 +2081,7 @@ struct Stats {
     let ecx = EncodeContext {
         diag: diag,
         tcx: tcx,
-        reexports2: reexports2,
+        reexports: reexports,
         item_symbols: item_symbols,
         link_meta: link_meta,
         cstore: cstore,
index 8cce1321d728bdc7b9ae770f35cd219b01aaf0c9..fd5248392a0959e22e45f274f985b790016cf0aa 100644 (file)
@@ -29,7 +29,7 @@
 use syntax::parse::token;
 use syntax::visit::{mod, Visitor};
 
-type Context<'a, 'tcx> = (&'a MethodMap<'tcx>, &'a resolve::ExportMap2);
+type Context<'a, 'tcx> = (&'a MethodMap<'tcx>, &'a resolve::ExportMap);
 
 /// A set of AST nodes exported by the crate.
 pub type ExportedItems = NodeSet;
@@ -136,7 +136,7 @@ fn visit_struct_def(&mut self, s: &ast::StructDef, _: ast::Ident,
 
 struct EmbargoVisitor<'a, 'tcx: 'a> {
     tcx: &'a ty::ctxt<'tcx>,
-    exp_map2: &'a resolve::ExportMap2,
+    export_map: &'a resolve::ExportMap,
 
     // This flag is an indicator of whether the previous item in the
     // hierarchical chain was exported or not. This is the indicator of whether
@@ -342,8 +342,8 @@ fn visit_mod(&mut self, m: &ast::Mod, _sp: Span, id: ast::NodeId) {
         // This code is here instead of in visit_item so that the
         // crate module gets processed as well.
         if self.prev_exported {
-            assert!(self.exp_map2.contains_key(&id), "wut {}", id);
-            for export in self.exp_map2[id].iter() {
+            assert!(self.export_map.contains_key(&id), "wut {}", id);
+            for export in self.export_map[id].iter() {
                 if is_local(export.def_id) {
                     self.reexports.insert(export.def_id.node);
                 }
@@ -1520,7 +1520,7 @@ fn visit_expr(&mut self, _: &ast::Expr) {}
 }
 
 pub fn check_crate(tcx: &ty::ctxt,
-                   exp_map2: &resolve::ExportMap2,
+                   export_map: &resolve::ExportMap,
                    external_exports: resolve::ExternalExports,
                    last_private_map: resolve::LastPrivateMap)
                    -> (ExportedItems, PublicItems) {
@@ -1561,7 +1561,7 @@ pub fn check_crate(tcx: &ty::ctxt,
         exported_items: NodeSet::new(),
         public_items: NodeSet::new(),
         reexports: NodeSet::new(),
-        exp_map2: exp_map2,
+        export_map: export_map,
         prev_exported: true,
         prev_public: true,
     };
index 49a8facffd26a802c24b095f5a09ba788cee88f6..d72ecb7cd8d96e2f9cdbd120b6072e036549ecdf 100644 (file)
@@ -97,13 +97,13 @@ struct BindingInfo {
 type BindingMap = HashMap<Name, BindingInfo>;
 
 // Trait method resolution
-pub type TraitMap = NodeMap<Vec<DefId> >;
+pub type TraitMap = NodeMap<Vec<DefId>>;
 
 // This is the replacement export map. It maps a module to all of the exports
 // within.
-pub type ExportMap2 = NodeMap<Vec<Export2>>;
+pub type ExportMap = NodeMap<Vec<Export>>;
 
-pub struct Export2 {
+pub struct Export {
     pub name: String,        // The name of the target.
     pub def_id: DefId,       // The definition of the target.
 }
@@ -946,7 +946,7 @@ struct Resolver<'a> {
     freevars: RefCell<FreevarMap>,
     freevars_seen: RefCell<NodeMap<NodeSet>>,
     capture_mode_map: CaptureModeMap,
-    export_map2: ExportMap2,
+    export_map: ExportMap,
     trait_map: TraitMap,
     external_exports: ExternalExports,
     last_private: LastPrivateMap,
@@ -1061,7 +1061,7 @@ fn new(session: &'a Session, crate_span: Span) -> Resolver<'a> {
             freevars: RefCell::new(NodeMap::new()),
             freevars_seen: RefCell::new(NodeMap::new()),
             capture_mode_map: NodeMap::new(),
-            export_map2: NodeMap::new(),
+            export_map: NodeMap::new(),
             trait_map: NodeMap::new(),
             used_imports: HashSet::new(),
             used_crates: HashSet::new(),
@@ -3859,12 +3859,12 @@ fn record_exports_for_module_subtree(&mut self,
     }
 
     fn record_exports_for_module(&mut self, module_: &Module) {
-        let mut exports2 = Vec::new();
+        let mut exports = Vec::new();
 
-        self.add_exports_for_module(&mut exports2, module_);
+        self.add_exports_for_module(&mut exports, module_);
         match module_.def_id.get() {
             Some(def_id) => {
-                self.export_map2.insert(def_id.node, exports2);
+                self.export_map.insert(def_id.node, exports);
                 debug!("(computing exports) writing exports for {} (some)",
                        def_id.node);
             }
@@ -3873,7 +3873,7 @@ fn record_exports_for_module(&mut self, module_: &Module) {
     }
 
     fn add_exports_of_namebindings(&mut self,
-                                   exports2: &mut Vec<Export2> ,
+                                   exports: &mut Vec<Export>,
                                    name: Name,
                                    namebindings: &NameBindings,
                                    ns: Namespace) {
@@ -3882,7 +3882,7 @@ fn add_exports_of_namebindings(&mut self,
                 let name = token::get_name(name);
                 debug!("(computing exports) YES: export '{}' => {}",
                        name, d.def_id());
-                exports2.push(Export2 {
+                exports.push(Export {
                     name: name.get().to_string(),
                     def_id: d.def_id()
                 });
@@ -3894,7 +3894,7 @@ fn add_exports_of_namebindings(&mut self,
     }
 
     fn add_exports_for_module(&mut self,
-                              exports2: &mut Vec<Export2> ,
+                              exports: &mut Vec<Export>,
                               module_: &Module) {
         for (name, importresolution) in module_.import_resolutions.borrow().iter() {
             if !importresolution.is_public {
@@ -3906,7 +3906,7 @@ fn add_exports_for_module(&mut self,
                     Some(target) => {
                         debug!("(computing exports) maybe export '{}'",
                                token::get_name(*name));
-                        self.add_exports_of_namebindings(exports2,
+                        self.add_exports_of_namebindings(exports,
                                                          *name,
                                                          &*target.bindings,
                                                          ns)
@@ -6322,7 +6322,7 @@ pub struct CrateMap {
     pub def_map: DefMap,
     pub freevars: RefCell<FreevarMap>,
     pub capture_mode_map: RefCell<CaptureModeMap>,
-    pub exp_map2: ExportMap2,
+    pub export_map: ExportMap,
     pub trait_map: TraitMap,
     pub external_exports: ExternalExports,
     pub last_private_map: LastPrivateMap,
@@ -6339,7 +6339,7 @@ pub fn resolve_crate(session: &Session,
         def_map: resolver.def_map,
         freevars: resolver.freevars,
         capture_mode_map: RefCell::new(resolver.capture_mode_map),
-        exp_map2: resolver.export_map2,
+        export_map: resolver.export_map,
         trait_map: resolver.trait_map,
         external_exports: resolver.external_exports,
         last_private_map: resolver.last_private,
index acf1fced72cae233f12e528eaf19b77cdce495cf..0efe4a1a569ecfeb9b85bde91c8287f8b20ffeeb 100644 (file)
@@ -99,7 +99,7 @@
 /// The complete set of all analyses described in this module. This is
 /// produced by the driver and fed to trans and later passes.
 pub struct CrateAnalysis<'tcx> {
-    pub exp_map2: middle::resolve::ExportMap2,
+    pub export_map: middle::resolve::ExportMap,
     pub exported_items: middle::privacy::ExportedItems,
     pub public_items: middle::privacy::PublicItems,
     pub ty_cx: ty::ctxt<'tcx>,
index 9ed4f46c16884ae08e439c6211b127d69a632909..787b869a18f210640fc1effc847b49dbd7388e44 100644 (file)
@@ -345,7 +345,7 @@ pub fn phase_3_run_analysis_passes<'tcx>(sess: Session,
         def_map,
         freevars,
         capture_mode_map,
-        exp_map2,
+        export_map,
         trait_map,
         external_exports,
         last_private_map
@@ -406,7 +406,7 @@ pub fn phase_3_run_analysis_passes<'tcx>(sess: Session,
     let maps = (external_exports, last_private_map);
     let (exported_items, public_items) =
             time(time_passes, "privacy checking", maps, |(a, b)|
-                 middle::privacy::check_crate(&ty_cx, &exp_map2, a, b));
+                 middle::privacy::check_crate(&ty_cx, &export_map, a, b));
 
     time(time_passes, "intrinsic checking", (), |_|
          middle::intrinsicck::check_crate(&ty_cx));
@@ -447,7 +447,7 @@ pub fn phase_3_run_analysis_passes<'tcx>(sess: Session,
          lint::check_crate(&ty_cx, &exported_items));
 
     ty::CrateAnalysis {
-        exp_map2: exp_map2,
+        export_map: export_map,
         ty_cx: ty_cx,
         exported_items: exported_items,
         public_items: public_items,
index 25fbaa6677684af6496ec59333c61721ebe8f071..b0ef2257a0a15739f3e88820d923230bb69d1867 100644 (file)
@@ -2938,7 +2938,7 @@ pub fn crate_ctxt_to_encode_parms<'a, 'tcx>(cx: &'a SharedCrateContext<'tcx>,
     encoder::EncodeParams {
         diag: cx.sess().diagnostic(),
         tcx: cx.tcx(),
-        reexports2: cx.exp_map2(),
+        reexports: cx.export_map(),
         item_symbols: cx.item_symbols(),
         link_meta: cx.link_meta(),
         cstore: &cx.sess().cstore,
@@ -3071,7 +3071,7 @@ fn next(&mut self) -> Option<ValueRef> {
 
 pub fn trans_crate<'tcx>(analysis: ty::CrateAnalysis<'tcx>)
                          -> (ty::ctxt<'tcx>, CrateTranslation) {
-    let ty::CrateAnalysis { ty_cx: tcx, exp_map2, reachable, name, .. } = analysis;
+    let ty::CrateAnalysis { ty_cx: tcx, export_map, reachable, name, .. } = analysis;
     let krate = tcx.map.krate();
 
     // Before we touch LLVM, make sure that multithreading is enabled.
@@ -3098,7 +3098,7 @@ pub fn trans_crate<'tcx>(analysis: ty::CrateAnalysis<'tcx>)
     let shared_ccx = SharedCrateContext::new(link_meta.crate_name.as_slice(),
                                              codegen_units,
                                              tcx,
-                                             exp_map2,
+                                             export_map,
                                              Sha256::new(),
                                              link_meta.clone(),
                                              reachable);
index af003b011579f2687e56897f14f841517dd24970..74f906edee5a535a13fd56a9902aabeaca96a479 100644 (file)
@@ -61,7 +61,7 @@ pub struct SharedCrateContext<'tcx> {
     metadata_llmod: ModuleRef,
     metadata_llcx: ContextRef,
 
-    exp_map2: resolve::ExportMap2,
+    export_map: resolve::ExportMap,
     reachable: NodeSet,
     item_symbols: RefCell<NodeMap<String>>,
     link_meta: LinkMeta,
@@ -238,7 +238,7 @@ impl<'tcx> SharedCrateContext<'tcx> {
     pub fn new(crate_name: &str,
                local_count: uint,
                tcx: ty::ctxt<'tcx>,
-               emap2: resolve::ExportMap2,
+               export_map: resolve::ExportMap,
                symbol_hasher: Sha256,
                link_meta: LinkMeta,
                reachable: NodeSet)
@@ -251,7 +251,7 @@ pub fn new(crate_name: &str,
             local_ccxs: Vec::with_capacity(local_count),
             metadata_llmod: metadata_llmod,
             metadata_llcx: metadata_llcx,
-            exp_map2: emap2,
+            export_map: export_map,
             reachable: reachable,
             item_symbols: RefCell::new(NodeMap::new()),
             link_meta: link_meta,
@@ -329,8 +329,8 @@ pub fn metadata_llcx(&self) -> ContextRef {
         self.metadata_llcx
     }
 
-    pub fn exp_map2<'a>(&'a self) -> &'a resolve::ExportMap2 {
-        &self.exp_map2
+    pub fn export_map<'a>(&'a self) -> &'a resolve::ExportMap {
+        &self.export_map
     }
 
     pub fn reachable<'a>(&'a self) -> &'a NodeSet {
@@ -553,8 +553,8 @@ pub fn item_vals<'a>(&'a self) -> &'a RefCell<NodeMap<ValueRef>> {
         &self.local.item_vals
     }
 
-    pub fn exp_map2<'a>(&'a self) -> &'a resolve::ExportMap2 {
-        &self.shared.exp_map2
+    pub fn export_map<'a>(&'a self) -> &'a resolve::ExportMap {
+        &self.shared.export_map
     }
 
     pub fn reachable<'a>(&'a self) -> &'a NodeSet {