Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

librustc: Enforce privacy for static methods. #5437

Merged
merged 1 commit into from
Mar 20, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/libcore/rt/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,4 @@ pub fn get() -> &Environment {

extern {
fn rust_get_rt_env() -> &Environment;
}
}
3 changes: 1 addition & 2 deletions src/libcore/rt/stack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ pub impl StackSegment {
pub struct StackPool(());

impl StackPool {

static fn new() -> StackPool { StackPool(()) }
static pub fn new() -> StackPool { StackPool(()) }

fn take_segment(&self, min_size: uint) -> StackSegment {
StackSegment::new(min_size)
Expand Down
2 changes: 1 addition & 1 deletion src/libcore/task/rt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ pub type rust_task = libc::c_void;
#[allow(non_camel_case_types)] // runtime type
pub type rust_closure = libc::c_void;

extern {
pub extern {
#[rust_stack]
fn rust_task_yield(task: *rust_task) -> bool;

Expand Down
1 change: 1 addition & 0 deletions src/librustc/metadata/decoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ fn item_family(item: ebml::Doc) -> Family {

fn item_visibility(item: ebml::Doc) -> ast::visibility {
let visibility = reader::get_doc(item, tag_items_data_item_visibility);
debug!("item visibility for %?", item_family(item));
match reader::doc_as_u8(visibility) as char {
'y' => ast::public,
'n' => ast::private,
Expand Down
9 changes: 8 additions & 1 deletion src/librustc/metadata/encoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -881,6 +881,7 @@ fn encode_info_for_item(ecx: @EncodeContext, ebml_w: writer::Encoder,
encode_family(ebml_w, purity_fn_family(mty.fty.purity));
encode_self_type(ebml_w, mty.self_ty);
encode_method_sort(ebml_w, 'r');
encode_visibility(ebml_w, ast::public);
ebml_w.end_tag();
}
provided(m) => {
Expand All @@ -896,6 +897,7 @@ fn encode_info_for_item(ecx: @EncodeContext, ebml_w: writer::Encoder,
encode_family(ebml_w, purity_fn_family(mty.fty.purity));
encode_self_type(ebml_w, mty.self_ty);
encode_method_sort(ebml_w, 'p');
encode_visibility(ebml_w, m.vis);
ebml_w.end_tag();
}
}
Expand Down Expand Up @@ -930,6 +932,11 @@ fn encode_info_for_item(ecx: @EncodeContext, ebml_w: writer::Encoder,
let mut m_path = vec::append(~[], path); // :-(
m_path += [ast_map::path_name(item.ident)];
encode_path(ecx, ebml_w, m_path, ast_map::path_name(ty_m.ident));

// For now, use the item visibility until trait methods can have
// real visibility in the AST.
encode_visibility(ebml_w, item.vis);

ebml_w.end_tag();
}

Expand Down Expand Up @@ -1018,7 +1025,7 @@ fn encode_info_for_items(ecx: @EncodeContext, ebml_w: writer::Encoder,
|ni, cx, v| {
visit::visit_foreign_item(ni, cx, v);
match ecx.tcx.items.get(&ni.id) {
ast_map::node_foreign_item(_, abi, pt) => {
ast_map::node_foreign_item(_, abi, _, pt) => {
encode_info_for_foreign_item(ecx, ebml_w, ni,
index, /*bad*/copy *pt,
abi);
Expand Down
Loading