diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2013-10-05 14:44:37 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2013-10-07 13:00:52 -0700 |
| commit | de7d1431760c788e5a471194fa85675033d0ed72 (patch) | |
| tree | 2ece65f6d02061b9ed83dc19a20dc2a5401374d0 | |
| parent | 439e2770be6aec41a3961235305787a78d47fbdd (diff) | |
| download | rust-de7d1431760c788e5a471194fa85675033d0ed72.tar.gz rust-de7d1431760c788e5a471194fa85675033d0ed72.zip | |
Fix existing privacy/visibility violations
This commit fixes all of the fallout of the previous commit which is an attempt to refine privacy. There were a few unfortunate leaks which now must be plugged, and the most horrible one is the current `shouldnt_be_public` module now inside `std::rt`. I think that this either needs a slight reorganization of the runtime, or otherwise it needs to just wait for the external users of these modules to get replaced with their `rt` implementations. Other fixes involve making things pub which should be pub, and otherwise updating error messages that now reference privacy instead of referencing an "unresolved name" (yay!).
43 files changed, 168 insertions, 111 deletions
diff --git a/src/libextra/container.rs b/src/libextra/container.rs index c5311d210ab..cbc2f08679b 100644 --- a/src/libextra/container.rs +++ b/src/libextra/container.rs @@ -40,7 +40,7 @@ pub trait Deque<T> : Mutable { } #[cfg(test)] -mod bench { +pub mod bench { use std::container::MutableMap; use std::{vec, rand}; use std::rand::Rng; diff --git a/src/libextra/crypto/cryptoutil.rs b/src/libextra/crypto/cryptoutil.rs index 8c97f7db2bd..f4bc87ae763 100644 --- a/src/libextra/crypto/cryptoutil.rs +++ b/src/libextra/crypto/cryptoutil.rs @@ -346,7 +346,7 @@ impl <T: FixedBuffer> StandardPadding for T { #[cfg(test)] -mod test { +pub mod test { use std::rand::{IsaacRng, Rng}; use std::vec; diff --git a/src/libextra/stats.rs b/src/libextra/stats.rs index 64c4a4a03fd..9ac0d73c2ec 100644 --- a/src/libextra/stats.rs +++ b/src/libextra/stats.rs @@ -101,7 +101,8 @@ pub trait Stats { /// Extracted collection of all the summary statistics of a sample set. #[deriving(Clone, Eq)] -struct Summary { +#[allow(missing_doc)] +pub struct Summary { sum: f64, min: f64, max: f64, diff --git a/src/librustc/middle/borrowck/gather_loans/mod.rs b/src/librustc/middle/borrowck/gather_loans/mod.rs index b3980c2e045..aaaa893c3e5 100644 --- a/src/librustc/middle/borrowck/gather_loans/mod.rs +++ b/src/librustc/middle/borrowck/gather_loans/mod.rs @@ -31,8 +31,8 @@ use syntax::ast_util::id_range; use syntax::codemap::Span; use syntax::print::pprust; use syntax::visit; -use syntax::visit::Visitor; -use syntax::ast::{Expr, fn_kind, fn_decl, Block, NodeId, Stmt, Pat, Local}; +use syntax::visit::{Visitor, fn_kind}; +use syntax::ast::{Expr, fn_decl, Block, NodeId, Stmt, Pat, Local}; mod lifetime; mod restrictions; diff --git a/src/librustc/middle/trans/datum.rs b/src/librustc/middle/trans/datum.rs index a70b38fca17..3de3f99020e 100644 --- a/src/librustc/middle/trans/datum.rs +++ b/src/librustc/middle/trans/datum.rs @@ -581,7 +581,7 @@ impl Datum { if !header && !ty::type_contents(bcx.tcx(), content_ty).contains_managed() { let ptr = self.to_value_llval(bcx); - let ty = type_of(bcx.ccx(), content_ty); + let ty = type_of::type_of(bcx.ccx(), content_ty); let body = PointerCast(bcx, ptr, ty.ptr_to()); Datum {val: body, ty: content_ty, mode: ByRef(ZeroMem)} } else { // has a header diff --git a/src/librustc/middle/trans/expr.rs b/src/librustc/middle/trans/expr.rs index 098f0e3db7c..a6cf6344999 100644 --- a/src/librustc/middle/trans/expr.rs +++ b/src/librustc/middle/trans/expr.rs @@ -1026,7 +1026,7 @@ fn trans_lvalue_unadjusted(bcx: @mut Block, expr: &ast::Expr) -> DatumBlock { // which may not be equal to the enum's type for // non-C-like enums. let val = base::get_item_val(bcx.ccx(), did.node); - let pty = type_of(bcx.ccx(), const_ty).ptr_to(); + let pty = type_of::type_of(bcx.ccx(), const_ty).ptr_to(); PointerCast(bcx, val, pty) } else { { @@ -1040,7 +1040,7 @@ fn trans_lvalue_unadjusted(bcx: @mut Block, expr: &ast::Expr) -> DatumBlock { } unsafe { - let llty = type_of(bcx.ccx(), const_ty); + let llty = type_of::type_of(bcx.ccx(), const_ty); let symbol = csearch::get_symbol( bcx.ccx().sess.cstore, did); @@ -1396,7 +1396,7 @@ fn trans_unary_datum(bcx: @mut Block, heap: heap) -> DatumBlock { let _icx = push_ctxt("trans_boxed_expr"); if heap == heap_exchange { - let llty = type_of(bcx.ccx(), contents_ty); + let llty = type_of::type_of(bcx.ccx(), contents_ty); let size = llsize_of(bcx.ccx(), llty); let Result { bcx: bcx, val: val } = malloc_raw_dyn(bcx, contents_ty, heap_exchange, size); diff --git a/src/librustc/middle/trans/glue.rs b/src/librustc/middle/trans/glue.rs index d420514e84f..0f7e1db1583 100644 --- a/src/librustc/middle/trans/glue.rs +++ b/src/librustc/middle/trans/glue.rs @@ -203,7 +203,7 @@ pub fn lazily_emit_tydesc_glue(ccx: @mut CrateContext, field: uint, ti: @mut tydesc_info) { let _icx = push_ctxt("lazily_emit_tydesc_glue"); - let llfnty = Type::glue_fn(type_of::type_of(ccx, ti.ty).ptr_to()); + let llfnty = Type::glue_fn(type_of(ccx, ti.ty).ptr_to()); if lazily_emit_simplified_tydesc_glue(ccx, field, ti) { return; @@ -345,7 +345,7 @@ pub fn make_visit_glue(bcx: @mut Block, v: ValueRef, t: ty::t) -> @mut Block { bcx.tcx().sess.fatal(s); } }; - let v = PointerCast(bcx, v, type_of::type_of(bcx.ccx(), object_ty).ptr_to()); + let v = PointerCast(bcx, v, type_of(bcx.ccx(), object_ty).ptr_to()); bcx = reflect::emit_calls_to_trait_visit_ty(bcx, t, v, visitor_trait.def_id); // The visitor is a boxed object and needs to be dropped add_clean(bcx, v, object_ty); diff --git a/src/librustc/middle/typeck/coherence.rs b/src/librustc/middle/typeck/coherence.rs index 6adbcbf89d7..ae8081df7ba 100644 --- a/src/librustc/middle/typeck/coherence.rs +++ b/src/librustc/middle/typeck/coherence.rs @@ -330,8 +330,8 @@ impl CoherenceChecker { let impl_poly_type = ty::lookup_item_type(tcx, impl_id); - let provided = ty::provided_trait_methods(tcx, trait_ref.def_id); - for trait_method in provided.iter() { + let prov = ty::provided_trait_methods(tcx, trait_ref.def_id); + for trait_method in prov.iter() { // Synthesize an ID. let new_id = tcx.sess.next_node_id(); let new_did = local_def(new_id); diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs index f04527ee893..acb8720c786 100644 --- a/src/librustdoc/html/render.rs +++ b/src/librustdoc/html/render.rs @@ -126,7 +126,7 @@ enum Implementor { /// to be a fairly large and expensive structure to clone. Instead this adheres /// to both `Send` and `Freeze` so it may be stored in a `RWArc` instance and /// shared among the various rendering tasks. -struct Cache { +pub struct Cache { /// Mapping of typaram ids to the name of the type parameter. This is used /// when pretty-printing a type (so pretty printing doesn't have to /// painfully maintain a context like this) diff --git a/src/librusti/program.rs b/src/librusti/program.rs index 0053d713776..4ab9ac4aef5 100644 --- a/src/librusti/program.rs +++ b/src/librusti/program.rs @@ -24,7 +24,7 @@ use utils::*; /// This structure keeps track of the state of the world for the code being /// executed in rusti. #[deriving(Clone)] -struct Program { +pub struct Program { /// All known local variables local_vars: HashMap<~str, LocalVariable>, /// New variables which will be present (learned from typechecking) diff --git a/src/libstd/num/cmath.rs b/src/libstd/num/cmath.rs index 38923c5bda4..0c515538266 100644 --- a/src/libstd/num/cmath.rs +++ b/src/libstd/num/cmath.rs @@ -36,10 +36,10 @@ pub mod c_double_utils { pub fn exp(n: c_double) -> c_double; // rename: for consistency with underscore usage elsewhere #[link_name="expm1"] - fn exp_m1(n: c_double) -> c_double; + pub fn exp_m1(n: c_double) -> c_double; pub fn exp2(n: c_double) -> c_double; #[link_name="fabs"] - fn abs(n: c_double) -> c_double; + pub fn abs(n: c_double) -> c_double; // rename: for clarity and consistency with add/sub/mul/div #[link_name="fdim"] pub fn abs_sub(a: c_double, b: c_double) -> c_double; diff --git a/src/libstd/rt/io/buffered.rs b/src/libstd/rt/io/buffered.rs index a8cf8151499..2269469ee23 100644 --- a/src/libstd/rt/io/buffered.rs +++ b/src/libstd/rt/io/buffered.rs @@ -335,14 +335,15 @@ mod test { // newtype struct autoderef weirdness #[test] fn test_buffered_stream() { + use rt; struct S; - impl Writer for S { + impl rt::io::Writer for S { fn write(&mut self, _: &[u8]) {} fn flush(&mut self) {} } - impl Reader for S { + impl rt::io::Reader for S { fn read(&mut self, _: &mut [u8]) -> Option<uint> { None } fn eof(&mut self) -> bool { true } } diff --git a/src/libstd/rt/io/mod.rs b/src/libstd/rt/io/mod.rs index c2f137ba119..a18f97930fa 100644 --- a/src/libstd/rt/io/mod.rs +++ b/src/libstd/rt/io/mod.rs @@ -300,7 +300,8 @@ pub mod comm_adapters; mod extensions; /// Non-I/O things needed by the I/O module -mod support; +// XXX: shouldn this really be pub? +pub mod support; /// Basic Timer pub mod timer; diff --git a/src/libstd/rt/mod.rs b/src/libstd/rt/mod.rs index 2ece2800cf2..c7c4d3fc4f6 100644 --- a/src/libstd/rt/mod.rs +++ b/src/libstd/rt/mod.rs @@ -67,14 +67,27 @@ use rt::local::Local; use rt::sched::{Scheduler, Shutdown}; use rt::sleeper_list::SleeperList; use rt::task::{Task, SchedTask, GreenTask, Sched}; -use rt::thread::Thread; -use rt::work_queue::WorkQueue; use rt::uv::uvio::UvEventLoop; use unstable::atomics::{AtomicInt, SeqCst}; use unstable::sync::UnsafeArc; use vec; use vec::{OwnedVector, MutableVector, ImmutableVector}; +use self::thread::Thread; +use self::work_queue::WorkQueue; + +// XXX: these probably shouldn't be public... +#[doc(hidden)] +pub mod shouldnt_be_public { + pub use super::sched::Scheduler; + pub use super::kill::KillHandle; + pub use super::thread::Thread; + pub use super::work_queue::WorkQueue; + pub use super::select::SelectInner; + pub use super::rtio::EventLoop; + pub use super::select::{SelectInner, SelectPortInner}; +} + /// The global (exchange) heap. pub mod global_heap; diff --git a/src/libstd/rt/sched.rs b/src/libstd/rt/sched.rs index bddcb700433..cbffec51cc9 100644 --- a/src/libstd/rt/sched.rs +++ b/src/libstd/rt/sched.rs @@ -803,6 +803,12 @@ impl SchedHandle { self.queue.push(msg); self.remote.fire(); } + pub fn send_task_from_friend(&mut self, friend: ~Task) { + self.send(TaskFromFriend(friend)); + } + pub fn send_shutdown(&mut self) { + self.send(Shutdown); + } } struct CleanupJob { diff --git a/src/libstd/select.rs b/src/libstd/select.rs index 2554a0ad588..049b301144b 100644 --- a/src/libstd/select.rs +++ b/src/libstd/select.rs @@ -15,10 +15,8 @@ use iter::{Iterator, DoubleEndedIterator}; use option::*; // use either::{Either, Left, Right}; // use rt::kill::BlockedTask; -use rt::sched::Scheduler; -use rt::select::{SelectInner, SelectPortInner}; use rt::local::Local; -use rt::rtio::EventLoop; +use rt::shouldnt_be_public::{EventLoop, Scheduler, SelectInner, SelectPortInner}; use task; use unstable::finally::Finally; use vec::{OwnedVector, MutableVector}; diff --git a/src/libstd/task/mod.rs b/src/libstd/task/mod.rs index 8e5353341ea..cb45c6f78eb 100644 --- a/src/libstd/task/mod.rs +++ b/src/libstd/task/mod.rs @@ -551,7 +551,7 @@ pub fn deschedule() { //! Yield control to the task scheduler use rt::local::Local; - use rt::sched::Scheduler; + use rt::shouldnt_be_public::Scheduler; // FIXME(#7544): Optimize this, since we know we won't block. let sched: ~Scheduler = Local::take(); diff --git a/src/libstd/task/spawn.rs b/src/libstd/task/spawn.rs index a77c9744298..a801bf3328d 100644 --- a/src/libstd/task/spawn.rs +++ b/src/libstd/task/spawn.rs @@ -89,11 +89,8 @@ use unstable::sync::Exclusive; use rt::in_green_task_context; use rt::local::Local; use rt::task::{Task, Sched}; -use rt::kill::KillHandle; -use rt::sched::Scheduler; +use rt::shouldnt_be_public::{Scheduler, KillHandle, WorkQueue, Thread}; use rt::uv::uvio::UvEventLoop; -use rt::thread::Thread; -use rt::work_queue::WorkQueue; #[cfg(test)] use task::default_task_opts; #[cfg(test)] use comm; @@ -556,8 +553,6 @@ fn enlist_many(child: &KillHandle, child_arc: &TaskGroupArc, } pub fn spawn_raw(mut opts: TaskOpts, f: ~fn()) { - use rt::sched::*; - rtassert!(in_green_task_context()); let child_data = Cell::new(gen_child_taskgroup(opts.linked, opts.supervised)); @@ -622,7 +617,7 @@ pub fn spawn_raw(mut opts: TaskOpts, f: ~fn()) { let mut new_sched_handle = new_sched.make_handle(); // Allow the scheduler to exit when the pinned task exits - new_sched_handle.send(Shutdown); + new_sched_handle.send_shutdown(); // Pin the new task to the new scheduler let new_task = if opts.watched { @@ -660,7 +655,7 @@ pub fn spawn_raw(mut opts: TaskOpts, f: ~fn()) { rtdebug!("enqueing join_task"); // Now tell the original scheduler to join with this thread // by scheduling a thread-joining task on the original scheduler - orig_sched_handle.send(TaskFromFriend(join_task)); + orig_sched_handle.send_task_from_friend(join_task); // NB: We can't simply send a message from here to another task // because this code isn't running in a task and message passing doesn't diff --git a/src/libstd/unstable/mod.rs b/src/libstd/unstable/mod.rs index e16e6384a4f..0e281f33e2a 100644 --- a/src/libstd/unstable/mod.rs +++ b/src/libstd/unstable/mod.rs @@ -38,7 +38,7 @@ a normal large stack. */ pub fn run_in_bare_thread(f: ~fn()) { use cell::Cell; - use rt::thread::Thread; + use rt::shouldnt_be_public::Thread; let f_cell = Cell::new(f); let (port, chan) = comm::stream(); diff --git a/src/libstd/util.rs b/src/libstd/util.rs index 64bdc7fe8cd..44cfdb86057 100644 --- a/src/libstd/util.rs +++ b/src/libstd/util.rs @@ -90,10 +90,10 @@ mod tests { use super::*; use clone::Clone; + use ops::Drop; use option::{None, Some}; use either::{Either, Left, Right}; use sys::size_of; - use kinds::Drop; #[test] fn identity_crisis() { diff --git a/src/libsyntax/ast_util.rs b/src/libsyntax/ast_util.rs index 926d1997465..d9e24e045ff 100644 --- a/src/libsyntax/ast_util.rs +++ b/src/libsyntax/ast_util.rs @@ -964,7 +964,7 @@ mod test { use super::*; use std::io; use opt_vec; - use std::hash::HashMap; + use std::hashmap::HashMap; fn ident_to_segment(id : &Ident) -> PathSegment { PathSegment{identifier:id.clone(), lifetime: None, types: opt_vec::Empty} diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs index 39540deb38f..1039ec07804 100644 --- a/src/libsyntax/ext/expand.rs +++ b/src/libsyntax/ext/expand.rs @@ -1551,7 +1551,8 @@ mod test { let varrefs = @mut ~[]; visit::walk_crate(&mut new_path_finder(varrefs), &renamed_ast, ()); match varrefs { - @[Path{segments:[ref seg],_}] => assert_eq!(mtwt_resolve(seg.identifier),a2_name), + @[ast::Path{segments:[ref seg],_}] => + assert_eq!(mtwt_resolve(seg.identifier),a2_name), _ => assert_eq!(0,1) } @@ -1565,7 +1566,8 @@ mod test { let varrefs = @mut ~[]; visit::walk_crate(&mut new_path_finder(varrefs), &double_renamed, ()); match varrefs { - @[Path{segments:[ref seg],_}] => assert_eq!(mtwt_resolve(seg.identifier),a3_name), + @[ast::Path{segments:[ref seg],_}] => + assert_eq!(mtwt_resolve(seg.identifier),a3_name), _ => assert_eq!(0,1) } } diff --git a/src/test/compile-fail/export-import.rs b/src/test/compile-fail/export-import.rs index a7578f6104f..3877250126d 100644 --- a/src/test/compile-fail/export-import.rs +++ b/src/test/compile-fail/export-import.rs @@ -8,9 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// error-pattern: import - use m::unexported; +//~^ ERROR: is private mod m { pub fn exported() { } diff --git a/src/test/compile-fail/export-tag-variant.rs b/src/test/compile-fail/export-tag-variant.rs index 629699ca6a4..d92cd204850 100644 --- a/src/test/compile-fail/export-tag-variant.rs +++ b/src/test/compile-fail/export-tag-variant.rs @@ -8,12 +8,10 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// error-pattern: unresolved name - mod foo { pub fn x() { } enum y { y1, } } -fn main() { let z = foo::y1; } +fn main() { let z = foo::y1; } //~ ERROR: is private diff --git a/src/test/compile-fail/issue-3993-2.rs b/src/test/compile-fail/issue-3993-2.rs index 2ca871cd11c..61980abdfe7 100644 --- a/src/test/compile-fail/issue-3993-2.rs +++ b/src/test/compile-fail/issue-3993-2.rs @@ -8,12 +8,11 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use zoo::{duck, goose}; //~ ERROR failed to resolve import - //~^ ERROR unresolved import: found `goose` in `zoo` but it is private +use zoo::{duck, goose}; //~ ERROR: variant `goose` is private mod zoo { pub enum bird { - pub duck, + pub duck, //~ ERROR: unnecessary `pub` visibility priv goose } } diff --git a/src/test/compile-fail/issue-3993-3.rs b/src/test/compile-fail/issue-3993-3.rs index cab999f621d..fae5eb51272 100644 --- a/src/test/compile-fail/issue-3993-3.rs +++ b/src/test/compile-fail/issue-3993-3.rs @@ -8,13 +8,13 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use zoo::fly; //~ ERROR failed to resolve import - //~^ ERROR unresolved import: found `fly` in `zoo` but it is private +use zoo::fly; //~ ERROR: function `fly` is private mod zoo { - type fly = (); fn fly() {} } -fn main() {} +fn main() { + fly(); +} diff --git a/src/test/compile-fail/issue-3993.rs b/src/test/compile-fail/issue-3993.rs index 53a56ad2774..fae5eb51272 100644 --- a/src/test/compile-fail/issue-3993.rs +++ b/src/test/compile-fail/issue-3993.rs @@ -8,12 +8,13 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use zoo::fly; //~ ERROR failed to resolve import - //~^ ERROR unresolved import: found `fly` in `zoo` but it is private +use zoo::fly; //~ ERROR: function `fly` is private mod zoo { fn fly() {} } -fn main() {} +fn main() { + fly(); +} diff --git a/src/test/compile-fail/issue-4366-2.rs b/src/test/compile-fail/issue-4366-2.rs new file mode 100644 index 00000000000..4530267f35f --- /dev/null +++ b/src/test/compile-fail/issue-4366-2.rs @@ -0,0 +1,38 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + +// ensures that 'use foo:*' doesn't import non-public item + +use m1::*; + +mod foo { + pub fn foo() {} +} +mod a { + pub mod b { + use foo::foo; + type bar = int; + } + pub mod sub { + use a::b::*; + fn sub() -> bar { 1 } + //~^ ERROR: undeclared type name + } +} + +mod m1 { + fn foo() {} +} + +fn main() { + foo(); //~ ERROR: unresolved name +} + diff --git a/src/test/compile-fail/issue-4366.rs b/src/test/compile-fail/issue-4366.rs index 6b84d897c87..e9c1092a4a5 100644 --- a/src/test/compile-fail/issue-4366.rs +++ b/src/test/compile-fail/issue-4366.rs @@ -27,8 +27,7 @@ mod a { } pub mod sub { use a::b::*; - fn sub() -> bar { foo(); 1 } //~ ERROR: unresolved name `foo` - //~^ ERROR: use of undeclared type name `bar` + fn sub() -> int { foo(); 1 } //~ ERROR: unresolved name `foo` } } @@ -36,6 +35,4 @@ mod m1 { fn foo() {} } -fn main() { - foo(); //~ ERROR: unresolved name `foo` -} +fn main() {} diff --git a/src/test/compile-fail/macro-local-data-key-priv.rs b/src/test/compile-fail/macro-local-data-key-priv.rs index 463ad958f11..e87d57aaa56 100644 --- a/src/test/compile-fail/macro-local-data-key-priv.rs +++ b/src/test/compile-fail/macro-local-data-key-priv.rs @@ -18,5 +18,5 @@ mod bar { fn main() { local_data::set(bar::baz, -10.0); - //~^ ERROR unresolved name `bar::baz` + //~^ ERROR static `baz` is private } diff --git a/src/test/compile-fail/private-item-simple.rs b/src/test/compile-fail/private-item-simple.rs index a31d0030f67..2b9e32b8f58 100644 --- a/src/test/compile-fail/private-item-simple.rs +++ b/src/test/compile-fail/private-item-simple.rs @@ -13,5 +13,5 @@ mod a { } fn main() { - a::f(); //~ ERROR unresolved name + a::f(); //~ ERROR function `f` is private } diff --git a/src/test/compile-fail/private-variant.rs b/src/test/compile-fail/private-variant.rs index 3285997523a..d63d04c90cc 100644 --- a/src/test/compile-fail/private-variant.rs +++ b/src/test/compile-fail/private-variant.rs @@ -17,5 +17,5 @@ mod a { } fn main() { - let x = a::Liege; //~ ERROR unresolved name + let x = a::Liege; //~ ERROR variant `Liege` is private } diff --git a/src/test/compile-fail/static-priv-by-default.rs b/src/test/compile-fail/static-priv-by-default.rs index 59d7e23855c..f447a6c547c 100644 --- a/src/test/compile-fail/static-priv-by-default.rs +++ b/src/test/compile-fail/static-priv-by-default.rs @@ -24,15 +24,15 @@ mod child { fn foo(_: int) {} fn full_ref() { - foo(static_priv_by_default::private); //~ ERROR: unresolved name + foo(static_priv_by_default::private); //~ ERROR: static `private` is private foo(static_priv_by_default::public); - foo(child::childs_child::private); //~ ERROR: unresolved name + foo(child::childs_child::private); //~ ERROR: static `private` is private foo(child::childs_child::public); } fn medium_ref() { use child::childs_child; - foo(childs_child::private); //~ ERROR: unresolved name + foo(childs_child::private); //~ ERROR: static `private` is private foo(childs_child::public); } diff --git a/src/test/compile-fail/static-priv-by-default2.rs b/src/test/compile-fail/static-priv-by-default2.rs index 28a17cf5e1c..423d182dd69 100644 --- a/src/test/compile-fail/static-priv-by-default2.rs +++ b/src/test/compile-fail/static-priv-by-default2.rs @@ -19,11 +19,22 @@ mod child { } } -fn main() { - use static_priv_by_default::private; //~ ERROR: unresolved import - //~^ ERROR: failed to resolve - use static_priv_by_default::public; - use child::childs_child::private; //~ ERROR: unresolved import - //~^ ERROR: failed to resolve +fn foo<T>(_: T) {} + +fn test1() { + use child::childs_child::private; + //~^ ERROR: static `private` is private use child::childs_child::public; + + foo(private); +} + +fn test2() { + use static_priv_by_default::private; + //~^ ERROR: static `private` is private + use static_priv_by_default::public; + + foo(private); } + +fn main() {} diff --git a/src/test/compile-fail/xc-private-method.rs b/src/test/compile-fail/xc-private-method.rs index b4a999766b5..a0a411ec9b0 100644 --- a/src/test/compile-fail/xc-private-method.rs +++ b/src/test/compile-fail/xc-private-method.rs @@ -15,8 +15,8 @@ extern mod xc_private_method_lib; fn main() { let _ = xc_private_method_lib::Struct::static_meth_struct(); - //~^ ERROR: unresolved name + //~^ ERROR: method `static_meth_struct` is private let _ = xc_private_method_lib::Enum::static_meth_enum(); - //~^ ERROR: unresolved name + //~^ ERROR: method `static_meth_enum` is private } diff --git a/src/test/compile-fail/xcrate-private-by-default.rs b/src/test/compile-fail/xcrate-private-by-default.rs index 38649981f93..ca1221e7432 100644 --- a/src/test/compile-fail/xcrate-private-by-default.rs +++ b/src/test/compile-fail/xcrate-private-by-default.rs @@ -10,15 +10,14 @@ // aux-build:static_priv_by_default.rs -#[allow(unused_imports)]; -#[no_std]; +#[no_std]; // helps if debugging resolve extern mod static_priv_by_default; fn foo<T>() {} #[start] -fn main(_: int, _: **u8, _: *u8) -> int { +fn main(_: int, _: **u8) -> int { // Actual public items should be public static_priv_by_default::a; static_priv_by_default::b; @@ -33,25 +32,23 @@ fn main(_: int, _: **u8, _: *u8) -> int { // private items at the top should be inaccessible static_priv_by_default::i; - //~^ ERROR: unresolved name + //~^ ERROR: static `i` is private static_priv_by_default::j; - //~^ ERROR: unresolved name + //~^ ERROR: function `j` is private static_priv_by_default::k; - //~^ ERROR: unresolved name + //~^ ERROR: struct `k` is private foo::<static_priv_by_default::l>(); - //~^ ERROR: use of undeclared type name - //~^^ ERROR: use of undeclared type name + //~^ ERROR: type `l` is private // public items in a private mod should be inaccessible static_priv_by_default::foo::a; - //~^ ERROR: unresolved name + //~^ ERROR: static `a` is private static_priv_by_default::foo::b; - //~^ ERROR: unresolved name + //~^ ERROR: function `b` is private static_priv_by_default::foo::c; - //~^ ERROR: unresolved name + //~^ ERROR: struct `c` is private foo::<static_priv_by_default::foo::d>(); - //~^ ERROR: use of undeclared type name - //~^^ ERROR: use of undeclared type name + //~^ ERROR: type `d` is private 3 } diff --git a/src/test/run-pass/export-non-interference2.rs b/src/test/run-pass/export-non-interference2.rs index 9147596b0db..8fdc9c56315 100644 --- a/src/test/run-pass/export-non-interference2.rs +++ b/src/test/run-pass/export-non-interference2.rs @@ -9,7 +9,7 @@ // except according to those terms. mod foo { - mod bar { + pub mod bar { pub fn y() { super::super::foo::x(); } } diff --git a/src/test/run-pass/foreign-dupe.rs b/src/test/run-pass/foreign-dupe.rs index 3ff1ebb5732..e8a9d666dcc 100644 --- a/src/test/run-pass/foreign-dupe.rs +++ b/src/test/run-pass/foreign-dupe.rs @@ -17,7 +17,7 @@ mod rustrt1 { #[abi = "cdecl"] #[link_name = "rustrt"] extern { - fn rust_get_test_int() -> libc::intptr_t; + pub fn rust_get_test_int() -> libc::intptr_t; } } @@ -27,7 +27,7 @@ mod rustrt2 { #[abi = "cdecl"] #[link_name = "rustrt"] extern { - fn rust_get_test_int() -> libc::intptr_t; + pub fn rust_get_test_int() -> libc::intptr_t; } } diff --git a/src/test/run-pass/foreign-no-abi.rs b/src/test/run-pass/foreign-no-abi.rs index f9c2698eda4..6a7ee7101ef 100644 --- a/src/test/run-pass/foreign-no-abi.rs +++ b/src/test/run-pass/foreign-no-abi.rs @@ -14,7 +14,7 @@ mod rustrt { use std::libc; extern { - fn rust_get_test_int() -> libc::intptr_t; + pub fn rust_get_test_int() -> libc::intptr_t; } } diff --git a/src/test/run-pass/intrinsic-uninit.rs b/src/test/run-pass/intrinsic-uninit.rs index 993e2777197..53c9ed63141 100644 --- a/src/test/run-pass/intrinsic-uninit.rs +++ b/src/test/run-pass/intrinsic-uninit.rs @@ -11,7 +11,7 @@ mod rusti { #[abi = "rust-intrinsic"] extern "rust-intrinsic" { - fn uninit<T>() -> T; + pub fn uninit<T>() -> T; } } pub fn main() { diff --git a/src/test/run-pass/intrinsics-integer.rs b/src/test/run-pass/intrinsics-integer.rs index bbbc8bf4c1f..2ca71866db8 100644 --- a/src/test/run-pass/intrinsics-integer.rs +++ b/src/test/run-pass/intrinsics-integer.rs @@ -17,24 +17,24 @@ extern mod extra; mod rusti { #[abi = "rust-intrinsic"] extern "rust-intrinsic" { - fn ctpop8(x: i8) -> i8; - fn ctpop16(x: i16) -> i16; - fn ctpop32(x: i32) -> i32; - fn ctpop64(x: i64) -> i64; - - fn ctlz8(x: i8) -> i8; - fn ctlz16(x: i16) -> i16; - fn ctlz32(x: i32) -> i32; - fn ctlz64(x: i64) -> i64; - - fn cttz8(x: i8) -> i8; - fn cttz16(x: i16) -> i16; - fn cttz32(x: i32) -> i32; - fn cttz64(x: i64) -> i64; - - fn bswap16(x: i16) -> i16; - fn bswap32(x: i32) -> i32; - fn bswap64(x: i64) -> i64; + pub fn ctpop8(x: i8) -> i8; + pub fn ctpop16(x: i16) -> i16; + pub fn ctpop32(x: i32) -> i32; + pub fn ctpop64(x: i64) -> i64; + + pub fn ctlz8(x: i8) -> i8; + pub fn ctlz16(x: i16) -> i16; + pub fn ctlz32(x: i32) -> i32; + pub fn ctlz64(x: i64) -> i64; + + pub fn cttz8(x: i8) -> i8; + pub fn cttz16(x: i16) -> i16; + pub fn cttz32(x: i32) -> i32; + pub fn cttz64(x: i64) -> i64; + + pub fn bswap16(x: i16) -> i16; + pub fn bswap32(x: i32) -> i32; + pub fn bswap64(x: i64) -> i64; } } diff --git a/src/test/run-pass/mod_dir_simple/load_another_mod.rs b/src/test/run-pass/mod_dir_simple/load_another_mod.rs index 335da61cd4e..c11b1e8c074 100644 --- a/src/test/run-pass/mod_dir_simple/load_another_mod.rs +++ b/src/test/run-pass/mod_dir_simple/load_another_mod.rs @@ -8,4 +8,4 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -mod test; +pub mod test; diff --git a/src/test/run-pass/rec-align-u64.rs b/src/test/run-pass/rec-align-u64.rs index f3bfb998dbb..e833f67b51e 100644 --- a/src/test/run-pass/rec-align-u64.rs +++ b/src/test/run-pass/rec-align-u64.rs @@ -46,7 +46,7 @@ mod m { } #[cfg(target_arch = "x86_64")] - mod m { + pub mod m { pub fn align() -> uint { 8u } pub fn size() -> uint { 16u } } |
