Skip to content

Commit 92114c6

Browse files
committed
---
yaml --- r: 81074 b: refs/heads/snap-stage3 c: 10a583c h: refs/heads/master v: v3
1 parent d83441b commit 92114c6

28 files changed

+495
-162
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 4c6bf4872012c010f84dc7fa2cdfe87522533f89
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 753547963340cb973210ad2df5590c29bf46ddf1
4+
refs/heads/snap-stage3: 10a583ce1ac28a8cbf34b0f4274285f33bdfce29
55
refs/heads/try: 70152ff55722878cde684ee6462c14c65f2c4729
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/src/libextra/arc.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ struct MutexArcInner<T> { priv lock: Mutex, priv failed: bool, priv data: T }
162162

163163
/// An Arc with mutable data protected by a blocking mutex.
164164
#[no_freeze]
165-
struct MutexArc<T> { priv x: UnsafeArc<MutexArcInner<T>> }
165+
pub struct MutexArc<T> { priv x: UnsafeArc<MutexArcInner<T>> }
166166

167167

168168
impl<T:Send> Clone for MutexArc<T> {
@@ -343,7 +343,7 @@ struct RWArcInner<T> { priv lock: RWLock, priv failed: bool, priv data: T }
343343
* Unlike mutex_arcs, rw_arcs are safe, because they cannot be nested.
344344
*/
345345
#[no_freeze]
346-
struct RWArc<T> {
346+
pub struct RWArc<T> {
347347
priv x: UnsafeArc<RWArcInner<T>>,
348348
}
349349

branches/snap-stage3/src/libextra/workcache.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ impl WorkMap {
127127
}
128128
}
129129

130-
struct Database {
130+
pub struct Database {
131131
db_filename: Path,
132132
db_cache: TreeMap<~str, ~str>,
133133
db_dirty: bool
@@ -207,7 +207,7 @@ impl Drop for Database {
207207
}
208208
}
209209

210-
struct Logger {
210+
pub struct Logger {
211211
// FIXME #4432: Fill in
212212
a: ()
213213
}
@@ -223,10 +223,10 @@ impl Logger {
223223
}
224224
}
225225
226-
type FreshnessMap = TreeMap<~str,extern fn(&str,&str)->bool>;
226+
pub type FreshnessMap = TreeMap<~str,extern fn(&str,&str)->bool>;
227227
228228
#[deriving(Clone)]
229-
struct Context {
229+
pub struct Context {
230230
db: RWArc<Database>,
231231
logger: RWArc<Logger>,
232232
cfg: Arc<json::Object>,
@@ -239,13 +239,13 @@ struct Context {
239239
freshness: Arc<FreshnessMap>
240240
}
241241
242-
struct Prep<'self> {
242+
pub struct Prep<'self> {
243243
ctxt: &'self Context,
244244
fn_name: &'self str,
245245
declared_inputs: WorkMap,
246246
}
247247
248-
struct Exec {
248+
pub struct Exec {
249249
discovered_inputs: WorkMap,
250250
discovered_outputs: WorkMap
251251
}

branches/snap-stage3/src/librustc/driver/driver.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ pub fn phase_2_configure_and_expand(sess: Session,
197197

198198
pub struct CrateAnalysis {
199199
exp_map2: middle::resolve::ExportMap2,
200+
exported_items: @middle::privacy::ExportedItems,
200201
ty_cx: ty::ctxt,
201202
maps: astencode::Maps,
202203
reachable: @mut HashSet<ast::NodeId>
@@ -258,8 +259,9 @@ pub fn phase_3_run_analysis_passes(sess: Session,
258259
middle::check_const::check_crate(sess, crate, ast_map, def_map,
259260
method_map, ty_cx));
260261

261-
time(time_passes, ~"privacy checking", ||
262-
middle::privacy::check_crate(ty_cx, &method_map, crate));
262+
let exported_items =
263+
time(time_passes, ~"privacy checking", ||
264+
middle::privacy::check_crate(ty_cx, &method_map, &exp_map2, crate));
263265

264266
time(time_passes, ~"effect checking", ||
265267
middle::effect::check_crate(ty_cx, method_map, crate));
@@ -301,6 +303,7 @@ pub fn phase_3_run_analysis_passes(sess: Session,
301303

302304
CrateAnalysis {
303305
exp_map2: exp_map2,
306+
exported_items: @exported_items,
304307
ty_cx: ty_cx,
305308
maps: astencode::Maps {
306309
root_map: root_map,

branches/snap-stage3/src/librustc/metadata/csearch.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ use syntax::diagnostic::expect;
2727
pub struct StaticMethodInfo {
2828
ident: ast::Ident,
2929
def_id: ast::DefId,
30-
purity: ast::purity
30+
purity: ast::purity,
31+
vis: ast::visibility,
3132
}
3233

3334
pub fn get_symbol(cstore: @mut cstore::CStore, def: ast::DefId) -> ~str {
@@ -52,7 +53,8 @@ pub fn each_lang_item(cstore: @mut cstore::CStore,
5253
/// Iterates over each child of the given item.
5354
pub fn each_child_of_item(cstore: @mut cstore::CStore,
5455
def_id: ast::DefId,
55-
callback: &fn(decoder::DefLike, ast::Ident)) {
56+
callback: &fn(decoder::DefLike, ast::Ident,
57+
ast::visibility)) {
5658
let crate_data = cstore::get_crate_data(cstore, def_id.crate);
5759
let get_crate_data: decoder::GetCrateDataCb = |cnum| {
5860
cstore::get_crate_data(cstore, cnum)
@@ -68,7 +70,8 @@ pub fn each_child_of_item(cstore: @mut cstore::CStore,
6870
pub fn each_top_level_item_of_crate(cstore: @mut cstore::CStore,
6971
cnum: ast::CrateNum,
7072
callback: &fn(decoder::DefLike,
71-
ast::Ident)) {
73+
ast::Ident,
74+
ast::visibility)) {
7275
let crate_data = cstore::get_crate_data(cstore, cnum);
7376
let get_crate_data: decoder::GetCrateDataCb = |cnum| {
7477
cstore::get_crate_data(cstore, cnum)

branches/snap-stage3/src/librustc/metadata/decoder.rs

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ fn find_item(item_id: int, items: ebml::Doc) -> ebml::Doc {
9696

9797
// Looks up an item in the given metadata and returns an ebml doc pointing
9898
// to the item data.
99-
fn lookup_item(item_id: int, data: @~[u8]) -> ebml::Doc {
99+
pub fn lookup_item(item_id: int, data: @~[u8]) -> ebml::Doc {
100100
let items = reader::get_doc(reader::Doc(data), tag_items);
101101
find_item(item_id, items)
102102
}
@@ -291,7 +291,7 @@ fn enum_variant_ids(item: ebml::Doc, cdata: Cmd) -> ~[ast::DefId] {
291291
return ids;
292292
}
293293

294-
fn item_path(item_doc: ebml::Doc) -> ast_map::path {
294+
pub fn item_path(item_doc: ebml::Doc) -> ast_map::path {
295295
let path_doc = reader::get_doc(item_doc, tag_path);
296296

297297
let len_doc = reader::get_doc(path_doc, tag_path_len);
@@ -332,7 +332,7 @@ fn item_name(intr: @ident_interner, item: ebml::Doc) -> ast::Ident {
332332
}
333333
}
334334

335-
fn item_to_def_like(item: ebml::Doc, did: ast::DefId, cnum: ast::CrateNum)
335+
pub fn item_to_def_like(item: ebml::Doc, did: ast::DefId, cnum: ast::CrateNum)
336336
-> DefLike {
337337
let fam = item_family(item);
338338
match fam {
@@ -491,7 +491,7 @@ pub enum DefLike {
491491
DlField
492492
}
493493

494-
fn def_like_to_def(def_like: DefLike) -> ast::Def {
494+
pub fn def_like_to_def(def_like: DefLike) -> ast::Def {
495495
match def_like {
496496
DlDef(def) => return def,
497497
DlImpl(*) => fail!("found impl in def_like_to_def"),
@@ -544,7 +544,8 @@ impl<'self> EachItemContext<'self> {
544544
fn process_item_and_pop_name(&mut self,
545545
doc: ebml::Doc,
546546
def_id: ast::DefId,
547-
old_len: uint)
547+
old_len: uint,
548+
vis: ast::visibility)
548549
-> bool {
549550
let def_like = item_to_def_like(doc, def_id, self.cdata.cnum);
550551
match def_like {
@@ -563,8 +564,6 @@ impl<'self> EachItemContext<'self> {
563564
}
564565
}
565566

566-
let vis = item_visibility(doc);
567-
568567
let mut continue = (self.callback)(*self.path_builder, def_like, vis);
569568

570569
let family = item_family(doc);
@@ -653,9 +652,12 @@ impl<'self> EachItemContext<'self> {
653652
self.push_name(token::ident_to_str(&child_name));
654653

655654
// Process this item.
655+
656+
let vis = item_visibility(child_item_doc);
656657
continue = self.process_item_and_pop_name(child_item_doc,
657658
child_def_id,
658-
old_len);
659+
old_len,
660+
vis);
659661
}
660662
}
661663
continue
@@ -701,12 +703,13 @@ impl<'self> EachItemContext<'self> {
701703

702704
// Get the item.
703705
match maybe_find_item(def_id.node, other_crates_items) {
704-
None => {}
706+
None => { self.pop_name(old_len); }
705707
Some(reexported_item_doc) => {
706708
continue = self.process_item_and_pop_name(
707709
reexported_item_doc,
708710
def_id,
709-
old_len);
711+
old_len,
712+
ast::public);
710713
}
711714
}
712715

@@ -721,7 +724,8 @@ fn each_child_of_item_or_crate(intr: @ident_interner,
721724
cdata: Cmd,
722725
item_doc: ebml::Doc,
723726
get_crate_data: GetCrateDataCb,
724-
callback: &fn(DefLike, ast::Ident)) {
727+
callback: &fn(DefLike, ast::Ident,
728+
ast::visibility)) {
725729
// Iterate over all children.
726730
let _ = do reader::tagged_docs(item_doc, tag_mod_child) |child_info_doc| {
727731
let child_def_id = reader::with_doc_data(child_info_doc,
@@ -746,7 +750,8 @@ fn each_child_of_item_or_crate(intr: @ident_interner,
746750
let def_like = item_to_def_like(child_item_doc,
747751
child_def_id,
748752
cdata.cnum);
749-
callback(def_like, child_name);
753+
let visibility = item_visibility(child_item_doc);
754+
callback(def_like, child_name, visibility);
750755

751756
}
752757
}
@@ -788,7 +793,8 @@ fn each_child_of_item_or_crate(intr: @ident_interner,
788793
impl_method_def_id,
789794
cdata.cnum);
790795
callback(static_method_def_like,
791-
static_method_name);
796+
static_method_name,
797+
item_visibility(impl_method_doc));
792798
}
793799
_ => {}
794800
}
@@ -831,7 +837,8 @@ fn each_child_of_item_or_crate(intr: @ident_interner,
831837
let def_like = item_to_def_like(child_item_doc,
832838
child_def_id,
833839
cdata.cnum);
834-
callback(def_like, token::str_to_ident(name));
840+
callback(def_like, token::str_to_ident(name),
841+
item_visibility(child_item_doc));
835842
}
836843
}
837844

@@ -844,7 +851,7 @@ pub fn each_child_of_item(intr: @ident_interner,
844851
cdata: Cmd,
845852
id: ast::NodeId,
846853
get_crate_data: GetCrateDataCb,
847-
callback: &fn(DefLike, ast::Ident)) {
854+
callback: &fn(DefLike, ast::Ident, ast::visibility)) {
848855
// Find the item.
849856
let root_doc = reader::Doc(cdata.data);
850857
let items = reader::get_doc(root_doc, tag_items);
@@ -864,7 +871,8 @@ pub fn each_child_of_item(intr: @ident_interner,
864871
pub fn each_top_level_item_of_crate(intr: @ident_interner,
865872
cdata: Cmd,
866873
get_crate_data: GetCrateDataCb,
867-
callback: &fn(DefLike, ast::Ident)) {
874+
callback: &fn(DefLike, ast::Ident,
875+
ast::visibility)) {
868876
let root_doc = reader::Doc(cdata.data);
869877
let misc_info_doc = reader::get_doc(root_doc, tag_misc_info);
870878
let crate_items_doc = reader::get_doc(misc_info_doc,
@@ -1161,7 +1169,8 @@ pub fn get_static_methods_if_impl(intr: @ident_interner,
11611169
static_impl_methods.push(StaticMethodInfo {
11621170
ident: item_name(intr, impl_method_doc),
11631171
def_id: item_def_id(impl_method_doc, cdata),
1164-
purity: purity
1172+
purity: purity,
1173+
vis: item_visibility(impl_method_doc),
11651174
});
11661175
}
11671176
_ => {}

0 commit comments

Comments
 (0)