Skip to content

Commit d9504d4

Browse files
committed
rustc: middle: move Export and ExportMap from resolve to def.
1 parent 10a862d commit d9504d4

File tree

6 files changed

+26
-26
lines changed

6 files changed

+26
-26
lines changed

src/librustc/metadata/encoder.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ use metadata::common::*;
2121
use metadata::cstore;
2222
use metadata::decoder;
2323
use metadata::tyencode;
24+
use middle::def;
2425
use middle::ty::{lookup_item_type};
2526
use middle::ty::{mod, Ty};
2627
use middle::stability;
27-
use middle;
2828
use util::nodemap::{FnvHashMap, NodeMap, NodeSet};
2929

3030
use serialize::Encodable;
@@ -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 reexports: &'a middle::resolve::ExportMap,
69+
pub reexports: &'a def::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 reexports: &'a middle::resolve::ExportMap,
80+
pub reexports: &'a def::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::Export,
382+
exp: &def::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::Export)
401+
exp: &def::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::Export)
431+
exp: &def::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::Export) {
452+
exp: &def::Export) {
453453
if let Some(ast_map::NodeItem(item)) = ecx.tcx.map.find(exp.def_id.node) {
454454
let path_differs = ecx.tcx.map.with_path(exp.def_id.node, |path| {
455455
let (mut a, mut b) = (path, mod_path.clone());

src/librustc/middle/def.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,15 @@ pub enum Def {
6161

6262
// Definition mapping
6363
pub type DefMap = RefCell<NodeMap<Def>>;
64+
// This is the replacement export map. It maps a module to all of the exports
65+
// within.
66+
pub type ExportMap = NodeMap<Vec<Export>>;
67+
68+
#[deriving(Copy)]
69+
pub struct Export {
70+
pub name: ast::Name, // The name of the target.
71+
pub def_id: ast::DefId, // The definition of the target.
72+
}
6473

6574
#[deriving(Clone, Copy, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
6675
pub enum MethodProvenance {

src/librustc/middle/privacy.rs

Lines changed: 3 additions & 3 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::ExportMap);
32+
type Context<'a, 'tcx> = (&'a MethodMap<'tcx>, &'a def::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-
export_map: &'a resolve::ExportMap,
139+
export_map: &'a def::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
@@ -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-
export_map: &resolve::ExportMap,
1523+
export_map: &def::ExportMap,
15241524
external_exports: resolve::ExternalExports,
15251525
last_private_map: resolve::LastPrivateMap)
15261526
-> (ExportedItems, PublicItems) {

src/librustc/middle/resolve.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -93,15 +93,6 @@ struct BindingInfo {
9393
// Map from the name in a pattern to its binding mode.
9494
type BindingMap = HashMap<Name, BindingInfo>;
9595

96-
// This is the replacement export map. It maps a module to all of the exports
97-
// within.
98-
pub type ExportMap = NodeMap<Vec<Export>>;
99-
100-
pub struct Export {
101-
pub name: Name, // The name of the target.
102-
pub def_id: DefId, // The definition of the target.
103-
}
104-
10596
// This set contains all exported definitions from external crates. The set does
10697
// not contain any entries from local crates.
10798
pub type ExternalExports = DefIdSet;

src/librustc/middle/ty.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ use lint;
4646
use metadata::csearch;
4747
use middle;
4848
use middle::const_eval;
49-
use middle::def::{mod, DefMap};
49+
use middle::def::{mod, DefMap, ExportMap};
5050
use middle::dependency_format;
5151
use middle::lang_items::{FnTraitLangItem, FnMutTraitLangItem};
5252
use middle::lang_items::{FnOnceTraitLangItem, TyDescStructLangItem};
@@ -98,7 +98,7 @@ pub const INITIAL_DISCRIMINANT_VALUE: Disr = 0;
9898
/// The complete set of all analyses described in this module. This is
9999
/// produced by the driver and fed to trans and later passes.
100100
pub struct CrateAnalysis<'tcx> {
101-
pub export_map: middle::resolve::ExportMap,
101+
pub export_map: ExportMap,
102102
pub exported_items: middle::privacy::ExportedItems,
103103
pub public_items: middle::privacy::PublicItems,
104104
pub ty_cx: ty::ctxt<'tcx>,

src/librustc_trans/trans/context.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use llvm::{ContextRef, ModuleRef, ValueRef, BuilderRef};
1313
use llvm::{TargetData};
1414
use llvm::mk_target_data;
1515
use metadata::common::LinkMeta;
16-
use middle::resolve;
16+
use middle::def::ExportMap;
1717
use middle::traits;
1818
use trans::adt;
1919
use trans::base;
@@ -61,7 +61,7 @@ pub struct SharedCrateContext<'tcx> {
6161
metadata_llmod: ModuleRef,
6262
metadata_llcx: ContextRef,
6363

64-
export_map: resolve::ExportMap,
64+
export_map: 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-
export_map: resolve::ExportMap,
241+
export_map: ExportMap,
242242
symbol_hasher: Sha256,
243243
link_meta: LinkMeta,
244244
reachable: NodeSet)
@@ -329,7 +329,7 @@ impl<'tcx> SharedCrateContext<'tcx> {
329329
self.metadata_llcx
330330
}
331331

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

@@ -553,7 +553,7 @@ impl<'b, 'tcx> CrateContext<'b, 'tcx> {
553553
&self.local.item_vals
554554
}
555555

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

0 commit comments

Comments
 (0)