Skip to content

Commit fb1d6f2

Browse files
committed
middle: resolve: fix inconsistencies around ExportMap and remove the 2 suffix.
1 parent 5338222 commit fb1d6f2

File tree

7 files changed

+43
-43
lines changed

7 files changed

+43
-43
lines changed

src/librustc/metadata/encoder.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ pub type EncodeInlinedItem<'a> = |ecx: &EncodeContext,
6666
pub struct EncodeParams<'a, 'tcx: 'a> {
6767
pub diag: &'a SpanHandler,
6868
pub tcx: &'a ty::ctxt<'tcx>,
69-
pub reexports2: &'a middle::resolve::ExportMap2,
69+
pub reexports: &'a middle::resolve::ExportMap,
7070
pub item_symbols: &'a RefCell<NodeMap<String>>,
7171
pub link_meta: &'a LinkMeta,
7272
pub cstore: &'a cstore::CStore,
@@ -77,7 +77,7 @@ pub struct EncodeParams<'a, 'tcx: 'a> {
7777
pub struct EncodeContext<'a, 'tcx: 'a> {
7878
pub diag: &'a SpanHandler,
7979
pub tcx: &'a ty::ctxt<'tcx>,
80-
pub reexports2: &'a middle::resolve::ExportMap2,
80+
pub reexports: &'a middle::resolve::ExportMap,
8181
pub item_symbols: &'a RefCell<NodeMap<String>>,
8282
pub link_meta: &'a LinkMeta,
8383
pub cstore: &'a cstore::CStore,
@@ -379,7 +379,7 @@ fn encode_path<PI: Iterator<PathElem>>(rbml_w: &mut Encoder, path: PI) {
379379
}
380380

381381
fn encode_reexported_static_method(rbml_w: &mut Encoder,
382-
exp: &middle::resolve::Export2,
382+
exp: &middle::resolve::Export,
383383
method_def_id: DefId,
384384
method_name: ast::Name) {
385385
debug!("(encode reexported static method) {}::{}",
@@ -398,7 +398,7 @@ fn encode_reexported_static_method(rbml_w: &mut Encoder,
398398

399399
fn encode_reexported_static_base_methods(ecx: &EncodeContext,
400400
rbml_w: &mut Encoder,
401-
exp: &middle::resolve::Export2)
401+
exp: &middle::resolve::Export)
402402
-> bool {
403403
let impl_items = ecx.tcx.impl_items.borrow();
404404
match ecx.tcx.inherent_impls.borrow().get(&exp.def_id) {
@@ -428,7 +428,7 @@ fn encode_reexported_static_base_methods(ecx: &EncodeContext,
428428

429429
fn encode_reexported_static_trait_methods(ecx: &EncodeContext,
430430
rbml_w: &mut Encoder,
431-
exp: &middle::resolve::Export2)
431+
exp: &middle::resolve::Export)
432432
-> bool {
433433
match ecx.tcx.trait_items_cache.borrow().get(&exp.def_id) {
434434
Some(trait_items) => {
@@ -449,7 +449,7 @@ fn encode_reexported_static_trait_methods(ecx: &EncodeContext,
449449
fn encode_reexported_static_methods(ecx: &EncodeContext,
450450
rbml_w: &mut Encoder,
451451
mod_path: PathElems,
452-
exp: &middle::resolve::Export2) {
452+
exp: &middle::resolve::Export) {
453453
if let Some(ast_map::NodeItem(item)) = ecx.tcx.map.find(exp.def_id.node) {
454454
let original_name = token::get_ident(item.ident);
455455

@@ -519,7 +519,7 @@ fn encode_reexports(ecx: &EncodeContext,
519519
id: NodeId,
520520
path: PathElems) {
521521
debug!("(encoding info for module) encoding reexports for {}", id);
522-
match ecx.reexports2.get(&id) {
522+
match ecx.reexports.get(&id) {
523523
Some(ref exports) => {
524524
debug!("(encoding info for module) found reexports for {}", id);
525525
for exp in exports.iter() {
@@ -2071,7 +2071,7 @@ fn encode_metadata_inner(wr: &mut SeekableMemWriter,
20712071
item_symbols,
20722072
diag,
20732073
tcx,
2074-
reexports2,
2074+
reexports,
20752075
cstore,
20762076
encode_inlined_item,
20772077
link_meta,
@@ -2081,7 +2081,7 @@ fn encode_metadata_inner(wr: &mut SeekableMemWriter,
20812081
let ecx = EncodeContext {
20822082
diag: diag,
20832083
tcx: tcx,
2084-
reexports2: reexports2,
2084+
reexports: reexports,
20852085
item_symbols: item_symbols,
20862086
link_meta: link_meta,
20872087
cstore: cstore,

src/librustc/middle/privacy.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ use syntax::codemap::Span;
2929
use syntax::parse::token;
3030
use syntax::visit::{mod, Visitor};
3131

32-
type Context<'a, 'tcx> = (&'a MethodMap<'tcx>, &'a resolve::ExportMap2);
32+
type Context<'a, 'tcx> = (&'a MethodMap<'tcx>, &'a resolve::ExportMap);
3333

3434
/// A set of AST nodes exported by the crate.
3535
pub type ExportedItems = NodeSet;
@@ -136,7 +136,7 @@ impl<'v> Visitor<'v> for ParentVisitor {
136136

137137
struct EmbargoVisitor<'a, 'tcx: 'a> {
138138
tcx: &'a ty::ctxt<'tcx>,
139-
exp_map2: &'a resolve::ExportMap2,
139+
export_map: &'a resolve::ExportMap,
140140

141141
// This flag is an indicator of whether the previous item in the
142142
// hierarchical chain was exported or not. This is the indicator of whether
@@ -342,8 +342,8 @@ impl<'a, 'tcx, 'v> Visitor<'v> for EmbargoVisitor<'a, 'tcx> {
342342
// This code is here instead of in visit_item so that the
343343
// crate module gets processed as well.
344344
if self.prev_exported {
345-
assert!(self.exp_map2.contains_key(&id), "wut {}", id);
346-
for export in self.exp_map2[id].iter() {
345+
assert!(self.export_map.contains_key(&id), "wut {}", id);
346+
for export in self.export_map[id].iter() {
347347
if is_local(export.def_id) {
348348
self.reexports.insert(export.def_id.node);
349349
}
@@ -1520,7 +1520,7 @@ impl<'a, 'tcx, 'v> Visitor<'v> for VisiblePrivateTypesVisitor<'a, 'tcx> {
15201520
}
15211521

15221522
pub fn check_crate(tcx: &ty::ctxt,
1523-
exp_map2: &resolve::ExportMap2,
1523+
export_map: &resolve::ExportMap,
15241524
external_exports: resolve::ExternalExports,
15251525
last_private_map: resolve::LastPrivateMap)
15261526
-> (ExportedItems, PublicItems) {
@@ -1561,7 +1561,7 @@ pub fn check_crate(tcx: &ty::ctxt,
15611561
exported_items: NodeSet::new(),
15621562
public_items: NodeSet::new(),
15631563
reexports: NodeSet::new(),
1564-
exp_map2: exp_map2,
1564+
export_map: export_map,
15651565
prev_exported: true,
15661566
prev_public: true,
15671567
};

src/librustc/middle/resolve.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -97,13 +97,13 @@ struct BindingInfo {
9797
type BindingMap = HashMap<Name, BindingInfo>;
9898

9999
// Trait method resolution
100-
pub type TraitMap = NodeMap<Vec<DefId> >;
100+
pub type TraitMap = NodeMap<Vec<DefId>>;
101101

102102
// This is the replacement export map. It maps a module to all of the exports
103103
// within.
104-
pub type ExportMap2 = NodeMap<Vec<Export2>>;
104+
pub type ExportMap = NodeMap<Vec<Export>>;
105105

106-
pub struct Export2 {
106+
pub struct Export {
107107
pub name: String, // The name of the target.
108108
pub def_id: DefId, // The definition of the target.
109109
}
@@ -946,7 +946,7 @@ struct Resolver<'a> {
946946
freevars: RefCell<FreevarMap>,
947947
freevars_seen: RefCell<NodeMap<NodeSet>>,
948948
capture_mode_map: CaptureModeMap,
949-
export_map2: ExportMap2,
949+
export_map: ExportMap,
950950
trait_map: TraitMap,
951951
external_exports: ExternalExports,
952952
last_private: LastPrivateMap,
@@ -1061,7 +1061,7 @@ impl<'a> Resolver<'a> {
10611061
freevars: RefCell::new(NodeMap::new()),
10621062
freevars_seen: RefCell::new(NodeMap::new()),
10631063
capture_mode_map: NodeMap::new(),
1064-
export_map2: NodeMap::new(),
1064+
export_map: NodeMap::new(),
10651065
trait_map: NodeMap::new(),
10661066
used_imports: HashSet::new(),
10671067
used_crates: HashSet::new(),
@@ -3859,12 +3859,12 @@ impl<'a> Resolver<'a> {
38593859
}
38603860

38613861
fn record_exports_for_module(&mut self, module_: &Module) {
3862-
let mut exports2 = Vec::new();
3862+
let mut exports = Vec::new();
38633863

3864-
self.add_exports_for_module(&mut exports2, module_);
3864+
self.add_exports_for_module(&mut exports, module_);
38653865
match module_.def_id.get() {
38663866
Some(def_id) => {
3867-
self.export_map2.insert(def_id.node, exports2);
3867+
self.export_map.insert(def_id.node, exports);
38683868
debug!("(computing exports) writing exports for {} (some)",
38693869
def_id.node);
38703870
}
@@ -3873,7 +3873,7 @@ impl<'a> Resolver<'a> {
38733873
}
38743874

38753875
fn add_exports_of_namebindings(&mut self,
3876-
exports2: &mut Vec<Export2> ,
3876+
exports: &mut Vec<Export>,
38773877
name: Name,
38783878
namebindings: &NameBindings,
38793879
ns: Namespace) {
@@ -3882,7 +3882,7 @@ impl<'a> Resolver<'a> {
38823882
let name = token::get_name(name);
38833883
debug!("(computing exports) YES: export '{}' => {}",
38843884
name, d.def_id());
3885-
exports2.push(Export2 {
3885+
exports.push(Export {
38863886
name: name.get().to_string(),
38873887
def_id: d.def_id()
38883888
});
@@ -3894,7 +3894,7 @@ impl<'a> Resolver<'a> {
38943894
}
38953895

38963896
fn add_exports_for_module(&mut self,
3897-
exports2: &mut Vec<Export2> ,
3897+
exports: &mut Vec<Export>,
38983898
module_: &Module) {
38993899
for (name, importresolution) in module_.import_resolutions.borrow().iter() {
39003900
if !importresolution.is_public {
@@ -3906,7 +3906,7 @@ impl<'a> Resolver<'a> {
39063906
Some(target) => {
39073907
debug!("(computing exports) maybe export '{}'",
39083908
token::get_name(*name));
3909-
self.add_exports_of_namebindings(exports2,
3909+
self.add_exports_of_namebindings(exports,
39103910
*name,
39113911
&*target.bindings,
39123912
ns)
@@ -6322,7 +6322,7 @@ pub struct CrateMap {
63226322
pub def_map: DefMap,
63236323
pub freevars: RefCell<FreevarMap>,
63246324
pub capture_mode_map: RefCell<CaptureModeMap>,
6325-
pub exp_map2: ExportMap2,
6325+
pub export_map: ExportMap,
63266326
pub trait_map: TraitMap,
63276327
pub external_exports: ExternalExports,
63286328
pub last_private_map: LastPrivateMap,
@@ -6339,7 +6339,7 @@ pub fn resolve_crate(session: &Session,
63396339
def_map: resolver.def_map,
63406340
freevars: resolver.freevars,
63416341
capture_mode_map: RefCell::new(resolver.capture_mode_map),
6342-
exp_map2: resolver.export_map2,
6342+
export_map: resolver.export_map,
63436343
trait_map: resolver.trait_map,
63446344
external_exports: resolver.external_exports,
63456345
last_private_map: resolver.last_private,

src/librustc/middle/ty.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ pub const INITIAL_DISCRIMINANT_VALUE: Disr = 0;
9999
/// The complete set of all analyses described in this module. This is
100100
/// produced by the driver and fed to trans and later passes.
101101
pub struct CrateAnalysis<'tcx> {
102-
pub exp_map2: middle::resolve::ExportMap2,
102+
pub export_map: middle::resolve::ExportMap,
103103
pub exported_items: middle::privacy::ExportedItems,
104104
pub public_items: middle::privacy::PublicItems,
105105
pub ty_cx: ty::ctxt<'tcx>,

src/librustc_driver/driver.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ pub fn phase_3_run_analysis_passes<'tcx>(sess: Session,
345345
def_map,
346346
freevars,
347347
capture_mode_map,
348-
exp_map2,
348+
export_map,
349349
trait_map,
350350
external_exports,
351351
last_private_map
@@ -406,7 +406,7 @@ pub fn phase_3_run_analysis_passes<'tcx>(sess: Session,
406406
let maps = (external_exports, last_private_map);
407407
let (exported_items, public_items) =
408408
time(time_passes, "privacy checking", maps, |(a, b)|
409-
middle::privacy::check_crate(&ty_cx, &exp_map2, a, b));
409+
middle::privacy::check_crate(&ty_cx, &export_map, a, b));
410410

411411
time(time_passes, "intrinsic checking", (), |_|
412412
middle::intrinsicck::check_crate(&ty_cx));
@@ -447,7 +447,7 @@ pub fn phase_3_run_analysis_passes<'tcx>(sess: Session,
447447
lint::check_crate(&ty_cx, &exported_items));
448448

449449
ty::CrateAnalysis {
450-
exp_map2: exp_map2,
450+
export_map: export_map,
451451
ty_cx: ty_cx,
452452
exported_items: exported_items,
453453
public_items: public_items,

src/librustc_trans/trans/base.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2938,7 +2938,7 @@ pub fn crate_ctxt_to_encode_parms<'a, 'tcx>(cx: &'a SharedCrateContext<'tcx>,
29382938
encoder::EncodeParams {
29392939
diag: cx.sess().diagnostic(),
29402940
tcx: cx.tcx(),
2941-
reexports2: cx.exp_map2(),
2941+
reexports: cx.export_map(),
29422942
item_symbols: cx.item_symbols(),
29432943
link_meta: cx.link_meta(),
29442944
cstore: &cx.sess().cstore,
@@ -3071,7 +3071,7 @@ fn internalize_symbols(cx: &SharedCrateContext, reachable: &HashSet<String>) {
30713071

30723072
pub fn trans_crate<'tcx>(analysis: ty::CrateAnalysis<'tcx>)
30733073
-> (ty::ctxt<'tcx>, CrateTranslation) {
3074-
let ty::CrateAnalysis { ty_cx: tcx, exp_map2, reachable, name, .. } = analysis;
3074+
let ty::CrateAnalysis { ty_cx: tcx, export_map, reachable, name, .. } = analysis;
30753075
let krate = tcx.map.krate();
30763076

30773077
// Before we touch LLVM, make sure that multithreading is enabled.
@@ -3098,7 +3098,7 @@ pub fn trans_crate<'tcx>(analysis: ty::CrateAnalysis<'tcx>)
30983098
let shared_ccx = SharedCrateContext::new(link_meta.crate_name.as_slice(),
30993099
codegen_units,
31003100
tcx,
3101-
exp_map2,
3101+
export_map,
31023102
Sha256::new(),
31033103
link_meta.clone(),
31043104
reachable);

src/librustc_trans/trans/context.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ pub struct SharedCrateContext<'tcx> {
6161
metadata_llmod: ModuleRef,
6262
metadata_llcx: ContextRef,
6363

64-
exp_map2: resolve::ExportMap2,
64+
export_map: resolve::ExportMap,
6565
reachable: NodeSet,
6666
item_symbols: RefCell<NodeMap<String>>,
6767
link_meta: LinkMeta,
@@ -238,7 +238,7 @@ impl<'tcx> SharedCrateContext<'tcx> {
238238
pub fn new(crate_name: &str,
239239
local_count: uint,
240240
tcx: ty::ctxt<'tcx>,
241-
emap2: resolve::ExportMap2,
241+
export_map: resolve::ExportMap,
242242
symbol_hasher: Sha256,
243243
link_meta: LinkMeta,
244244
reachable: NodeSet)
@@ -251,7 +251,7 @@ impl<'tcx> SharedCrateContext<'tcx> {
251251
local_ccxs: Vec::with_capacity(local_count),
252252
metadata_llmod: metadata_llmod,
253253
metadata_llcx: metadata_llcx,
254-
exp_map2: emap2,
254+
export_map: export_map,
255255
reachable: reachable,
256256
item_symbols: RefCell::new(NodeMap::new()),
257257
link_meta: link_meta,
@@ -329,8 +329,8 @@ impl<'tcx> SharedCrateContext<'tcx> {
329329
self.metadata_llcx
330330
}
331331

332-
pub fn exp_map2<'a>(&'a self) -> &'a resolve::ExportMap2 {
333-
&self.exp_map2
332+
pub fn export_map<'a>(&'a self) -> &'a resolve::ExportMap {
333+
&self.export_map
334334
}
335335

336336
pub fn reachable<'a>(&'a self) -> &'a NodeSet {
@@ -553,8 +553,8 @@ impl<'b, 'tcx> CrateContext<'b, 'tcx> {
553553
&self.local.item_vals
554554
}
555555

556-
pub fn exp_map2<'a>(&'a self) -> &'a resolve::ExportMap2 {
557-
&self.shared.exp_map2
556+
pub fn export_map<'a>(&'a self) -> &'a resolve::ExportMap {
557+
&self.shared.export_map
558558
}
559559

560560
pub fn reachable<'a>(&'a self) -> &'a NodeSet {

0 commit comments

Comments
 (0)