diff --git a/src/libarena/lib.rs b/src/libarena/lib.rs index 5d316cdb51e37..e3cb848355aa6 100644 --- a/src/libarena/lib.rs +++ b/src/libarena/lib.rs @@ -28,9 +28,12 @@ html_favicon_url = "http://www.rust-lang.org/favicon.ico", html_root_url = "http://doc.rust-lang.org/master/")] -#![feature(unsafe_destructor)] +#![feature(unsafe_destructor, visible_private_types)] #![allow(missing_doc)] +// NOTE(stage0, pcwalton): Remove after snapshot. +#![allow(unknown_features)] + use std::cell::{Cell, RefCell}; use std::cmp; use std::intrinsics::{TyDesc, get_tydesc}; @@ -359,6 +362,7 @@ pub struct TypedArena { /// A pointer to the first arena segment. first: RefCell>, } + type TypedArenaChunkRef = Option>>; struct TypedArenaChunk { diff --git a/src/libcore/iter.rs b/src/libcore/iter.rs index b8ed8bdf92394..70818b5617dbc 100644 --- a/src/libcore/iter.rs +++ b/src/libcore/iter.rs @@ -2182,7 +2182,6 @@ pub type Iterate<'a, T> = Unfold<'a, T, IterateState<'a, T>>; /// Creates a new iterator that produces an infinite sequence of /// repeated applications of the given function `f`. -#[allow(visible_private_types)] pub fn iterate<'a, T: Clone>(f: |T|: 'a -> T, seed: T) -> Iterate<'a, T> { Unfold::new((f, Some(seed), true), |st| { let &(ref mut f, ref mut val, ref mut first) = st; diff --git a/src/libcore/lib.rs b/src/libcore/lib.rs index e4285ed597c8b..887f31fff9416 100644 --- a/src/libcore/lib.rs +++ b/src/libcore/lib.rs @@ -58,9 +58,12 @@ #![no_std] #![feature(globs, intrinsics, lang_items, macro_rules, managed_boxes, phase)] -#![feature(simd, unsafe_destructor)] +#![feature(simd, unsafe_destructor, visible_private_types)] #![deny(missing_doc)] +// NOTE(stage0, pcwalton): Remove after snapshot. +#![allow(unknown_features)] + mod macros; #[path = "num/float_macros.rs"] mod float_macros; diff --git a/src/libdebug/lib.rs b/src/libdebug/lib.rs index 6341a38056359..de9a3adbb3f97 100644 --- a/src/libdebug/lib.rs +++ b/src/libdebug/lib.rs @@ -25,9 +25,12 @@ html_favicon_url = "http://www.rust-lang.org/favicon.ico", html_root_url = "http://doc.rust-lang.org/master/")] #![experimental] -#![feature(managed_boxes, macro_rules)] +#![feature(managed_boxes, macro_rules, visible_private_types)] #![allow(experimental)] +// NOTE(stage0, pcwalton): Remove after snapshot. +#![allow(unknown_features)] + pub mod fmt; pub mod reflect; pub mod repr; diff --git a/src/libgreen/lib.rs b/src/libgreen/lib.rs index 5c280a31db792..bbcf3c403295b 100644 --- a/src/libgreen/lib.rs +++ b/src/libgreen/lib.rs @@ -217,8 +217,11 @@ html_playground_url = "http://play.rust-lang.org/")] // NB this does *not* include globs, please keep it that way. -#![feature(macro_rules, phase, default_type_params)] -#![allow(visible_private_types, deprecated)] +#![feature(macro_rules, phase, default_type_params, visible_private_types)] +#![allow(deprecated)] + +// NOTE(stage0, pcwalton): Remove after snapshot. +#![allow(unknown_features)] #[cfg(test)] #[phase(plugin, link)] extern crate log; #[cfg(test)] extern crate rustuv; diff --git a/src/libnative/io/timer_unix.rs b/src/libnative/io/timer_unix.rs index 06d48f2f886b8..2887b47ff1582 100644 --- a/src/libnative/io/timer_unix.rs +++ b/src/libnative/io/timer_unix.rs @@ -74,7 +74,6 @@ struct Inner { id: uint, } -#[allow(visible_private_types)] pub enum Req { // Add a new timer to the helper thread. NewTimer(Box), diff --git a/src/libnative/lib.rs b/src/libnative/lib.rs index c7b89b6cb9153..e2149cb82b2cc 100644 --- a/src/libnative/lib.rs +++ b/src/libnative/lib.rs @@ -63,6 +63,10 @@ // consider whether they're needed before adding that feature here (the // answer is that you don't need them) #![feature(macro_rules, unsafe_destructor, default_type_params)] +#![feature(visible_private_types)] + +// NOTE(stage0, pcwalton): Remove after snapshot. +#![allow(unknown_features)] extern crate alloc; extern crate libc; diff --git a/src/libregex/compile.rs b/src/libregex/compile.rs index ea472abeee690..48ba98a7c152d 100644 --- a/src/libregex/compile.rs +++ b/src/libregex/compile.rs @@ -8,9 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// Enable this to squash warnings due to exporting pieces of the representation -// for use with the regex! macro. See lib.rs for explanation. -#![allow(visible_private_types)] +#![allow(missing_doc)] use std::cmp; use parse; diff --git a/src/libregex/lib.rs b/src/libregex/lib.rs index fae3e5986806d..30d400e2991f7 100644 --- a/src/libregex/lib.rs +++ b/src/libregex/lib.rs @@ -368,9 +368,12 @@ html_root_url = "http://doc.rust-lang.org/master/", html_playground_url = "http://play.rust-lang.org/")] -#![feature(macro_rules, phase)] +#![feature(macro_rules, phase, visible_private_types)] #![deny(missing_doc)] +// NOTE(stage0, pcwalton): Remove after snapshot. +#![allow(unknown_features)] + #[cfg(test)] extern crate stdtest = "test"; #[cfg(test)] diff --git a/src/libregex/re.rs b/src/libregex/re.rs index 8e4145b2a3198..1c9b7feb83b5c 100644 --- a/src/libregex/re.rs +++ b/src/libregex/re.rs @@ -102,7 +102,6 @@ pub fn is_match(regex: &str, text: &str) -> Result { /// More details about the `regex!` macro can be found in the `regex` crate /// documentation. #[deriving(Clone)] -#[allow(visible_private_types)] pub enum Regex { // The representation of `Regex` is exported to support the `regex!` // syntax extension. Do not rely on it. @@ -516,7 +515,6 @@ impl Regex { } #[doc(hidden)] - #[allow(visible_private_types)] #[experimental] pub fn names_iter<'a>(&'a self) -> NamesIter<'a> { match *self { diff --git a/src/librustc/front/feature_gate.rs b/src/librustc/front/feature_gate.rs index fdfbdea245bb2..f5de62f1ae1c0 100644 --- a/src/librustc/front/feature_gate.rs +++ b/src/librustc/front/feature_gate.rs @@ -68,6 +68,7 @@ static KNOWN_FEATURES: &'static [(&'static str, Status)] = &[ ("rustc_diagnostic_macros", Active), ("unboxed_closures", Active), + ("visible_private_types", Active), // if you change this list without updating src/doc/rust.md, cmr will be sad @@ -98,7 +99,8 @@ pub struct Features { pub default_type_params: Cell, pub issue_5723_bootstrap: Cell, pub overloaded_calls: Cell, - pub rustc_diagnostic_macros: Cell + pub rustc_diagnostic_macros: Cell, + pub visible_private_types: Cell, } impl Features { @@ -107,7 +109,8 @@ impl Features { default_type_params: Cell::new(false), issue_5723_bootstrap: Cell::new(false), overloaded_calls: Cell::new(false), - rustc_diagnostic_macros: Cell::new(false) + rustc_diagnostic_macros: Cell::new(false), + visible_private_types: Cell::new(false), } } } @@ -439,4 +442,5 @@ pub fn check_crate(sess: &Session, krate: &ast::Crate) { sess.features.issue_5723_bootstrap.set(cx.has_feature("issue_5723_bootstrap")); sess.features.overloaded_calls.set(cx.has_feature("overloaded_calls")); sess.features.rustc_diagnostic_macros.set(cx.has_feature("rustc_diagnostic_macros")); + sess.features.visible_private_types.set(cx.has_feature("visible_private_types")); } diff --git a/src/librustc/lint/builtin.rs b/src/librustc/lint/builtin.rs index 738c5d9be7907..236b508f8e8b3 100644 --- a/src/librustc/lint/builtin.rs +++ b/src/librustc/lint/builtin.rs @@ -1539,9 +1539,6 @@ declare_lint!(pub DEAD_ASSIGNMENT, Warn, declare_lint!(pub DEAD_CODE, Warn, "detect piece of code that will never be used") -declare_lint!(pub VISIBLE_PRIVATE_TYPES, Warn, - "detect use of private types in exported type signatures") - declare_lint!(pub UNREACHABLE_CODE, Warn, "detects unreachable code") @@ -1570,7 +1567,6 @@ impl LintPass for HardwiredLints { UNUSED_VARIABLE, DEAD_ASSIGNMENT, DEAD_CODE, - VISIBLE_PRIVATE_TYPES, UNREACHABLE_CODE, WARNINGS, UNKNOWN_FEATURES, diff --git a/src/librustc/middle/mem_categorization.rs b/src/librustc/middle/mem_categorization.rs index ef1e0515156c0..da7fb1190b6f6 100644 --- a/src/librustc/middle/mem_categorization.rs +++ b/src/librustc/middle/mem_categorization.rs @@ -224,7 +224,7 @@ pub fn deref_kind(tcx: &ty::ctxt, t: ty::t) -> deref_kind { } } -trait ast_node { +pub trait ast_node { fn id(&self) -> ast::NodeId; fn span(&self) -> Span; } diff --git a/src/librustc/middle/privacy.rs b/src/librustc/middle/privacy.rs index 61e6debb08647..8f0c912131aea 100644 --- a/src/librustc/middle/privacy.rs +++ b/src/librustc/middle/privacy.rs @@ -17,7 +17,6 @@ use std::mem::replace; use metadata::csearch; use middle::def; -use lint; use middle::resolve; use middle::ty; use middle::typeck::{MethodCall, MethodMap, MethodOrigin, MethodParam}; @@ -163,23 +162,6 @@ struct EmbargoVisitor<'a> { prev_public: bool, } -impl<'a> EmbargoVisitor<'a> { - // There are checks inside of privacy which depend on knowing whether a - // trait should be exported or not. The two current consumers of this are: - // - // 1. Should default methods of a trait be exported? - // 2. Should the methods of an implementation of a trait be exported? - // - // The answer to both of these questions partly rely on whether the trait - // itself is exported or not. If the trait is somehow exported, then the - // answers to both questions must be yes. Right now this question involves - // more analysis than is currently done in rustc, so we conservatively - // answer "yes" so that all traits need to be exported. - fn exported_trait(&self, _id: ast::NodeId) -> bool { - true - } -} - impl<'a> Visitor<()> for EmbargoVisitor<'a> { fn visit_item(&mut self, item: &ast::Item, _: ()) { let orig_all_pub = self.prev_public; @@ -194,12 +176,6 @@ impl<'a> Visitor<()> for EmbargoVisitor<'a> { // cannot have visibility qualifiers on them anyway ast::ItemImpl(..) | ast::ItemForeignMod(..) => {} - // Traits are a little special in that even if they themselves are - // not public they may still be exported. - ast::ItemTrait(..) => { - self.prev_exported = self.exported_trait(item.id); - } - // Private by default, hence we only retain the "public chain" if // `pub` is explicitly listed. _ => { @@ -1218,7 +1194,6 @@ impl<'a> SanePrivacyVisitor<'a> { struct VisiblePrivateTypesVisitor<'a> { tcx: &'a ty::ctxt, exported_items: &'a ExportedItems, - public_items: &'a PublicItems, } struct CheckTypeForPrivatenessVisitor<'a, 'b> { @@ -1250,9 +1225,14 @@ impl<'a> VisiblePrivateTypesVisitor<'a> { } fn trait_is_public(&self, trait_id: ast::NodeId) -> bool { - // FIXME: this would preferably be using `exported_items`, but all - // traits are exported currently (see `EmbargoVisitor.exported_trait`) - self.public_items.contains(&trait_id) + self.exported_items.contains(&trait_id) + } + + fn check_path(&self, path: &ast::Path, path_id: ast::NodeId) { + if self.path_is_private_type(path_id) { + self.tcx.sess.span_err(path.span, + "private type in exported type signature"); + } } } @@ -1407,10 +1387,6 @@ impl<'a> Visitor<()> for VisiblePrivateTypesVisitor<'a> { return } - // `type ... = ...;` can contain private types, because - // we're introducing a new name. - ast::ItemTy(..) => return, - // not at all public, so we don't care _ if !self.exported_items.contains(&item.id) => return, @@ -1439,17 +1415,24 @@ impl<'a> Visitor<()> for VisiblePrivateTypesVisitor<'a> { } } - fn visit_ty(&mut self, t: &ast::Ty, _: ()) { - match t.node { - ast::TyPath(ref p, _, path_id) => { - if self.path_is_private_type(path_id) { - self.tcx.sess.add_lint( - lint::builtin::VISIBLE_PRIVATE_TYPES, - path_id, p.span, - "private type in exported type \ - signature".to_string()); + fn visit_generics(&mut self, g: &ast::Generics, _: ()) { + for type_parameter in g.ty_params.iter() { + for bound in type_parameter.bounds.iter() { + match *bound { + ast::TraitTyParamBound(ref trait_ref) => { + self.check_path(&trait_ref.path, trait_ref.ref_id) + } + ast::StaticRegionTyParamBound | + ast::UnboxedFnTyParamBound(_) | + ast::OtherRegionTyParamBound(_) => {} } } + } + } + + fn visit_ty(&mut self, t: &ast::Ty, _: ()) { + match t.node { + ast::TyPath(ref p, _, path_id) => self.check_path(p, path_id), _ => {} } visit::walk_ty(self, t, ()) @@ -1535,13 +1518,13 @@ pub fn check_crate(tcx: &ty::ctxt, let EmbargoVisitor { exported_items, public_items, .. } = visitor; - { + if !tcx.sess.features.visible_private_types.get() { let mut visitor = VisiblePrivateTypesVisitor { tcx: tcx, exported_items: &exported_items, - public_items: &public_items }; visit::walk_crate(&mut visitor, krate, ()); } + return (exported_items, public_items); } diff --git a/src/librustc/middle/resolve.rs b/src/librustc/middle/resolve.rs index 3ce6f72610095..7414f9238f94f 100644 --- a/src/librustc/middle/resolve.rs +++ b/src/librustc/middle/resolve.rs @@ -44,7 +44,7 @@ use std::uint; // Definition mapping pub type DefMap = RefCell>; -struct binding_info { +pub struct binding_info { span: Span, binding_mode: BindingMode, } diff --git a/src/librustc/middle/resolve_lifetime.rs b/src/librustc/middle/resolve_lifetime.rs index 5001e7a88bd93..253e2583d1938 100644 --- a/src/librustc/middle/resolve_lifetime.rs +++ b/src/librustc/middle/resolve_lifetime.rs @@ -56,7 +56,7 @@ struct LifetimeContext<'a> { named_region_map: NamedRegionMap, } -enum ScopeChain<'a> { +pub enum ScopeChain<'a> { /// EarlyScope(i, ['a, 'b, ...], s) extends s with early-bound /// lifetimes, assigning indexes 'a => i, 'b => i+1, ... etc. EarlyScope(subst::ParamSpace, &'a Vec, Scope<'a>), @@ -69,7 +69,7 @@ enum ScopeChain<'a> { RootScope } -type Scope<'a> = &'a ScopeChain<'a>; +pub type Scope<'a> = &'a ScopeChain<'a>; pub fn krate(sess: &Session, krate: &ast::Crate) -> NamedRegionMap { let mut ctxt = LifetimeContext { diff --git a/src/librustc/middle/typeck/infer/error_reporting.rs b/src/librustc/middle/typeck/infer/error_reporting.rs index beaf81409a38b..58edabcfab4b3 100644 --- a/src/librustc/middle/typeck/infer/error_reporting.rs +++ b/src/librustc/middle/typeck/infer/error_reporting.rs @@ -1429,7 +1429,7 @@ impl<'a> ErrorReportingHelpers for InferCtxt<'a> { } } -trait Resolvable { +pub trait Resolvable { fn resolve(&self, infcx: &InferCtxt) -> Self; fn contains_error(&self) -> bool; } diff --git a/src/librustc/middle/typeck/infer/lattice.rs b/src/librustc/middle/typeck/infer/lattice.rs index 708eb498f8421..e1ac8e7bf6fbb 100644 --- a/src/librustc/middle/typeck/infer/lattice.rs +++ b/src/librustc/middle/typeck/infer/lattice.rs @@ -45,7 +45,7 @@ use util::ppaux::Repr; use std::collections::HashMap; -trait LatticeValue : Clone + Repr + PartialEq { +pub trait LatticeValue : Clone + Repr + PartialEq { fn sub(cf: CombineFields, a: &Self, b: &Self) -> ures; fn lub(cf: CombineFields, a: &Self, b: &Self) -> cres; fn glb(cf: CombineFields, a: &Self, b: &Self) -> cres; diff --git a/src/librustc/middle/typeck/variance.rs b/src/librustc/middle/typeck/variance.rs index e0fab95a04529..c5293273a815e 100644 --- a/src/librustc/middle/typeck/variance.rs +++ b/src/librustc/middle/typeck/variance.rs @@ -230,11 +230,11 @@ pub fn infer_variance(tcx: &ty::ctxt, * a variable. */ -type VarianceTermPtr<'a> = &'a VarianceTerm<'a>; +pub type VarianceTermPtr<'a> = &'a VarianceTerm<'a>; -struct InferredIndex(uint); +pub struct InferredIndex(uint); -enum VarianceTerm<'a> { +pub enum VarianceTerm<'a> { ConstantTerm(ty::Variance), TransformTerm(VarianceTermPtr<'a>, VarianceTermPtr<'a>), InferredTerm(InferredIndex), diff --git a/src/librustc_llvm/lib.rs b/src/librustc_llvm/lib.rs index 1ac0aee85d4d9..03fd4a663478f 100644 --- a/src/librustc_llvm/lib.rs +++ b/src/librustc_llvm/lib.rs @@ -140,7 +140,7 @@ pub enum AttributeSet { FunctionIndex = !0 } -trait AttrHelper { +pub trait AttrHelper { fn apply_llfn(&self, idx: c_uint, llfn: ValueRef); fn apply_callsite(&self, idx: c_uint, callsite: ValueRef); } diff --git a/src/librustrt/lib.rs b/src/librustrt/lib.rs index b7b5e09a5562a..d1b1542ae134a 100644 --- a/src/librustrt/lib.rs +++ b/src/librustrt/lib.rs @@ -18,9 +18,13 @@ #![feature(macro_rules, phase, globs, thread_local, managed_boxes, asm)] #![feature(linkage, lang_items, unsafe_destructor, default_type_params)] +#![feature(visible_private_types)] #![no_std] #![experimental] +// NOTE(stage0, pcwalton): Remove after snapshot. +#![allow(unknown_features)] + #[phase(plugin, link)] extern crate core; extern crate alloc; extern crate libc; @@ -45,10 +49,10 @@ use task::{Task, BlockedTask, TaskOpts}; mod macros; mod at_exit_imp; +mod libunwind; mod local_ptr; mod thread_local_storage; mod util; -mod libunwind; pub mod args; pub mod bookkeeping; diff --git a/src/librustrt/local.rs b/src/librustrt/local.rs index e2a5eef0d99e1..8531f569a6b12 100644 --- a/src/librustrt/local.rs +++ b/src/librustrt/local.rs @@ -26,7 +26,6 @@ pub trait Local { unsafe fn try_unsafe_borrow() -> Option<*mut Self>; } -#[allow(visible_private_types)] impl Local> for Task { #[inline] fn put(value: Box) { unsafe { local_ptr::put(value) } } diff --git a/src/librustrt/local_ptr.rs b/src/librustrt/local_ptr.rs index c94e5c6187b3a..91f04794c39c6 100644 --- a/src/librustrt/local_ptr.rs +++ b/src/librustrt/local_ptr.rs @@ -374,7 +374,6 @@ pub mod native { #[inline] #[cfg(not(test))] - #[allow(visible_private_types)] pub fn maybe_tls_key() -> Option { unsafe { // NB: This is a little racy because, while the key is diff --git a/src/librustrt/unwind.rs b/src/librustrt/unwind.rs index 79f83df5be809..864cd45410bd2 100644 --- a/src/librustrt/unwind.rs +++ b/src/librustrt/unwind.rs @@ -236,7 +236,6 @@ fn rust_exception_class() -> uw::_Unwind_Exception_Class { #[cfg(not(target_arch = "arm"), not(windows, target_arch = "x86_64"), not(test))] #[doc(hidden)] -#[allow(visible_private_types)] pub mod eabi { use uw = libunwind; use libc::c_int; @@ -290,7 +289,6 @@ pub mod eabi { #[cfg(target_os = "ios", target_arch = "arm", not(test))] #[doc(hidden)] -#[allow(visible_private_types)] pub mod eabi { use uw = libunwind; use libc::c_int; @@ -343,7 +341,6 @@ pub mod eabi { // but otherwise works the same. #[cfg(target_arch = "arm", not(target_os = "ios"), not(test))] #[doc(hidden)] -#[allow(visible_private_types)] pub mod eabi { use uw = libunwind; use libc::c_int; @@ -393,7 +390,6 @@ pub mod eabi { #[cfg(windows, target_arch = "x86_64", not(test))] #[doc(hidden)] -#[allow(visible_private_types)] #[allow(non_camel_case_types)] pub mod eabi { use uw = libunwind; diff --git a/src/librustuv/lib.rs b/src/librustuv/lib.rs index dd80ab3ee78a1..6d0e7bcbcf4f9 100644 --- a/src/librustuv/lib.rs +++ b/src/librustuv/lib.rs @@ -44,9 +44,11 @@ via `close` and `delete` methods. html_root_url = "http://doc.rust-lang.org/master/", html_playground_url = "http://play.rust-lang.org/")] -#![feature(macro_rules, unsafe_destructor)] +#![feature(macro_rules, unsafe_destructor, visible_private_types)] #![deny(unused_result, unused_must_use)] -#![allow(visible_private_types)] + +// NOTE(stage0, pcwalton): Remove after snapshot. +#![allow(unknown_features)] #![reexport_test_harness_main = "test_main"] @@ -86,9 +88,9 @@ fn start(argc: int, argv: *const *const u8) -> int { mod macros; mod access; -mod timeout; mod homing; mod queue; +mod timeout; mod rc; pub mod uvio; diff --git a/src/libstd/collections/hashmap.rs b/src/libstd/collections/hashmap.rs index b8f8bd41a2d9d..650fc66758b0f 100644 --- a/src/libstd/collections/hashmap.rs +++ b/src/libstd/collections/hashmap.rs @@ -28,6 +28,7 @@ use option::{Some, None, Option}; use result::{Ok, Err}; use ops::Index; +#[allow(missing_doc)] mod table { use clone::Clone; use cmp; diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index 103cd574e7381..156dbfe3964d2 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -107,6 +107,7 @@ #![feature(macro_rules, globs, managed_boxes, linkage)] #![feature(default_type_params, phase, lang_items, unsafe_destructor)] +#![feature(visible_private_types)] // Don't link to std. We are std. #![no_std] @@ -114,6 +115,9 @@ #![allow(deprecated)] #![deny(missing_doc)] +// NOTE(stage0, pcwalton): Remove after snapshot. +#![allow(unknown_features)] + #![reexport_test_harness_main = "test_main"] // When testing libstd, bring in libuv as the I/O backend so tests can print diff --git a/src/libstd/rand/mod.rs b/src/libstd/rand/mod.rs index 40d8f80171c4e..46f24632b01cd 100644 --- a/src/libstd/rand/mod.rs +++ b/src/libstd/rand/mod.rs @@ -269,7 +269,9 @@ impl reseeding::Reseeder for TaskRngReseeder { } } } + static TASK_RNG_RESEED_THRESHOLD: uint = 32_768; + type TaskRngInner = reseeding::ReseedingRng; /// The task-local RNG. diff --git a/src/libstd/rt/backtrace.rs b/src/libstd/rt/backtrace.rs index a4491b2ab1d46..e099a25898d12 100644 --- a/src/libstd/rt/backtrace.rs +++ b/src/libstd/rt/backtrace.rs @@ -235,6 +235,7 @@ fn demangle(writer: &mut Writer, s: &str) -> IoResult<()> { /// to symbols. This is a bit of a hokey implementation as-is, but it works for /// all unix platforms we support right now, so it at least gets the job done. #[cfg(unix)] +#[allow(missing_doc)] mod imp { use c_str::CString; use io::{IoResult, Writer}; @@ -657,7 +658,7 @@ mod imp { /// copy of that function in my mingw install (maybe it was broken?). Instead, /// this takes the route of using StackWalk64 in order to walk the stack. #[cfg(windows)] -#[allow(dead_code, uppercase_variables)] +#[allow(dead_code, uppercase_variables, missing_doc)] mod imp { use c_str::CString; use core_collections::Collection; diff --git a/src/libsyntax/ast_map/mod.rs b/src/libsyntax/ast_map/mod.rs index 5fccf6cc3f025..b10e0e5a71bbd 100644 --- a/src/libsyntax/ast_map/mod.rs +++ b/src/libsyntax/ast_map/mod.rs @@ -49,12 +49,12 @@ impl fmt::Show for PathElem { } #[deriving(Clone)] -struct LinkedPathNode<'a> { +pub struct LinkedPathNode<'a> { node: PathElem, next: LinkedPath<'a>, } -type LinkedPath<'a> = Option<&'a LinkedPathNode<'a>>; +pub type LinkedPath<'a> = Option<&'a LinkedPathNode<'a>>; impl<'a> Iterator for LinkedPath<'a> { fn next(&mut self) -> Option { diff --git a/src/test/auxiliary/iss.rs b/src/test/auxiliary/iss.rs index 095cc3ec1a04d..75728c075d1eb 100644 --- a/src/test/auxiliary/iss.rs +++ b/src/test/auxiliary/iss.rs @@ -12,7 +12,7 @@ // part of issue-6919.rs -struct C<'a> { +pub struct C<'a> { pub k: ||: 'a, } diff --git a/src/test/auxiliary/issue-11225-1.rs b/src/test/auxiliary/issue-11225-1.rs index 88277af4a5118..0a9a402c4d588 100644 --- a/src/test/auxiliary/issue-11225-1.rs +++ b/src/test/auxiliary/issue-11225-1.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -mod inner { +pub mod inner { pub trait Trait { fn f(&self) { f(); } } diff --git a/src/test/auxiliary/issue-11225-2.rs b/src/test/auxiliary/issue-11225-2.rs index 848574a61fe8f..b3044e1080327 100644 --- a/src/test/auxiliary/issue-11225-2.rs +++ b/src/test/auxiliary/issue-11225-2.rs @@ -10,7 +10,7 @@ use inner::Trait; -mod inner { +pub mod inner { pub struct Foo; pub trait Trait { fn f(&self); diff --git a/src/test/auxiliary/issue-2526.rs b/src/test/auxiliary/issue-2526.rs index c2e1dd69a900c..b24f51058e512 100644 --- a/src/test/auxiliary/issue-2526.rs +++ b/src/test/auxiliary/issue-2526.rs @@ -36,7 +36,7 @@ fn init() -> arc_destruct { arc(context_res()) } -struct context_res { +pub struct context_res { ctx : int, } diff --git a/src/test/auxiliary/noexporttypelib.rs b/src/test/auxiliary/noexporttypelib.rs index 4e9e3688ecdbf..94b079b1dcfeb 100644 --- a/src/test/auxiliary/noexporttypelib.rs +++ b/src/test/auxiliary/noexporttypelib.rs @@ -8,5 +8,5 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -type oint = Option; +pub type oint = Option; pub fn foo() -> oint { Some(3) } diff --git a/src/test/auxiliary/priv-impl-prim-ty.rs b/src/test/auxiliary/priv-impl-prim-ty.rs index 16d3ca8fa649d..8c07dd5b785fd 100644 --- a/src/test/auxiliary/priv-impl-prim-ty.rs +++ b/src/test/auxiliary/priv-impl-prim-ty.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -trait A { +pub trait A { fn frob(&self); } diff --git a/src/test/compile-fail/lint-dead-code-1.rs b/src/test/compile-fail/lint-dead-code-1.rs index 8417f7810ead2..f3ab70147f126 100644 --- a/src/test/compile-fail/lint-dead-code-1.rs +++ b/src/test/compile-fail/lint-dead-code-1.rs @@ -11,7 +11,6 @@ #![no_std] #![allow(unused_variable)] #![allow(non_camel_case_types)] -#![allow(visible_private_types)] #![deny(dead_code)] #![feature(lang_items)] @@ -46,7 +45,7 @@ struct UsedStruct1 { } struct UsedStruct2(int); struct UsedStruct3; -struct UsedStruct4; +pub struct UsedStruct4; // this struct is never used directly, but its method is, so we don't want // to warn it struct SemiUsedStruct; @@ -54,7 +53,7 @@ impl SemiUsedStruct { fn la_la_la() {} } struct StructUsedAsField; -struct StructUsedInEnum; +pub struct StructUsedInEnum; struct StructUsedInGeneric; pub struct PubStruct2 { #[allow(dead_code)] diff --git a/src/test/compile-fail/visible-private-trait-bounds.rs b/src/test/compile-fail/visible-private-trait-bounds.rs new file mode 100644 index 0000000000000..84611b451c0f9 --- /dev/null +++ b/src/test/compile-fail/visible-private-trait-bounds.rs @@ -0,0 +1,18 @@ +// Copyright 2014 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub mod a { + trait Foo {} + + pub fn f() {} //~ ERROR private type in exported type signature +} + +fn main() {} + diff --git a/src/test/compile-fail/visible-private-typedefs.rs b/src/test/compile-fail/visible-private-typedefs.rs new file mode 100644 index 0000000000000..06acc9fb3e847 --- /dev/null +++ b/src/test/compile-fail/visible-private-typedefs.rs @@ -0,0 +1,19 @@ +// Copyright 2014 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub mod a { + type Foo = int; + + pub fn f(_: Foo) {} //~ ERROR private type in exported type signature +} + +fn main() {} + + diff --git a/src/test/run-pass/deriving-enum-single-variant.rs b/src/test/run-pass/deriving-enum-single-variant.rs index fc03763a3b7a8..a9bdcf2734bbc 100644 --- a/src/test/run-pass/deriving-enum-single-variant.rs +++ b/src/test/run-pass/deriving-enum-single-variant.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -type task_id = int; +pub type task_id = int; #[deriving(PartialEq)] pub enum Task { diff --git a/src/test/run-pass/extern-pass-TwoU16s.rs b/src/test/run-pass/extern-pass-TwoU16s.rs index 8a9231b640e83..6161d31c4a9ea 100644 --- a/src/test/run-pass/extern-pass-TwoU16s.rs +++ b/src/test/run-pass/extern-pass-TwoU16s.rs @@ -12,7 +12,7 @@ // by value. #[deriving(PartialEq, Show)] -struct TwoU16s { +pub struct TwoU16s { one: u16, two: u16 } diff --git a/src/test/run-pass/extern-pass-TwoU32s.rs b/src/test/run-pass/extern-pass-TwoU32s.rs index 480eef1c6e9d9..3e6b650207447 100644 --- a/src/test/run-pass/extern-pass-TwoU32s.rs +++ b/src/test/run-pass/extern-pass-TwoU32s.rs @@ -12,7 +12,7 @@ // by value. #[deriving(PartialEq, Show)] -struct TwoU32s { +pub struct TwoU32s { one: u32, two: u32 } diff --git a/src/test/run-pass/extern-pass-TwoU64s.rs b/src/test/run-pass/extern-pass-TwoU64s.rs index ca0df4728c6b0..5ad1e89425b09 100644 --- a/src/test/run-pass/extern-pass-TwoU64s.rs +++ b/src/test/run-pass/extern-pass-TwoU64s.rs @@ -12,7 +12,7 @@ // by value. #[deriving(PartialEq, Show)] -struct TwoU64s { +pub struct TwoU64s { one: u64, two: u64 } diff --git a/src/test/run-pass/extern-pass-TwoU8s.rs b/src/test/run-pass/extern-pass-TwoU8s.rs index 7aeb0a0ec84ea..14ba7c80059b5 100644 --- a/src/test/run-pass/extern-pass-TwoU8s.rs +++ b/src/test/run-pass/extern-pass-TwoU8s.rs @@ -12,7 +12,7 @@ // by value. #[deriving(PartialEq, Show)] -struct TwoU8s { +pub struct TwoU8s { one: u8, two: u8 } diff --git a/src/test/run-pass/extern-return-TwoU16s.rs b/src/test/run-pass/extern-return-TwoU16s.rs index 95352e6702031..ca9767307f42e 100644 --- a/src/test/run-pass/extern-return-TwoU16s.rs +++ b/src/test/run-pass/extern-return-TwoU16s.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -struct TwoU16s { +pub struct TwoU16s { one: u16, two: u16 } diff --git a/src/test/run-pass/extern-return-TwoU32s.rs b/src/test/run-pass/extern-return-TwoU32s.rs index 81bd0e9559da2..8d650459daa8d 100644 --- a/src/test/run-pass/extern-return-TwoU32s.rs +++ b/src/test/run-pass/extern-return-TwoU32s.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -struct TwoU32s { +pub struct TwoU32s { one: u32, two: u32 } diff --git a/src/test/run-pass/extern-return-TwoU64s.rs b/src/test/run-pass/extern-return-TwoU64s.rs index 7c37e0f4e686e..924aaf811f44a 100644 --- a/src/test/run-pass/extern-return-TwoU64s.rs +++ b/src/test/run-pass/extern-return-TwoU64s.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -struct TwoU64s { +pub struct TwoU64s { one: u64, two: u64 } diff --git a/src/test/run-pass/extern-return-TwoU8s.rs b/src/test/run-pass/extern-return-TwoU8s.rs index d20f5475c4eee..1dbce403cc8a1 100644 --- a/src/test/run-pass/extern-return-TwoU8s.rs +++ b/src/test/run-pass/extern-return-TwoU8s.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -struct TwoU8s { +pub struct TwoU8s { one: u8, two: u8 } diff --git a/src/test/run-pass/hashmap-memory.rs b/src/test/run-pass/hashmap-memory.rs index f733fc1eb8f1a..587486c15d150 100644 --- a/src/test/run-pass/hashmap-memory.rs +++ b/src/test/run-pass/hashmap-memory.rs @@ -23,7 +23,7 @@ pub fn map(filename: String, emit: map_reduce::putter) { emit(filename, "1".to_string()); } -mod map_reduce { +pub mod map_reduce { use std::collections::HashMap; use std::str; use std::task; diff --git a/src/test/run-pass/issue-3656.rs b/src/test/run-pass/issue-3656.rs index 8fd603781ba61..53157ce7546ff 100644 --- a/src/test/run-pass/issue-3656.rs +++ b/src/test/run-pass/issue-3656.rs @@ -15,7 +15,7 @@ extern crate libc; use libc::{c_uint, uint32_t, c_void}; -struct KEYGEN { +pub struct KEYGEN { hash_algorithm: [c_uint, ..2], count: uint32_t, salt: *const c_void, diff --git a/src/test/run-pass/issue-3753.rs b/src/test/run-pass/issue-3753.rs index fe2d729bc9e44..951832a14aa60 100644 --- a/src/test/run-pass/issue-3753.rs +++ b/src/test/run-pass/issue-3753.rs @@ -14,7 +14,7 @@ use std::f64; -struct Point { +pub struct Point { x: f64, y: f64 } diff --git a/src/test/run-pass/issue-5708.rs b/src/test/run-pass/issue-5708.rs index 2bb320e556235..29787fd51c240 100644 --- a/src/test/run-pass/issue-5708.rs +++ b/src/test/run-pass/issue-5708.rs @@ -48,7 +48,7 @@ pub fn main() { // minimal -trait MyTrait { } +pub trait MyTrait { } pub struct MyContainer<'a, T> { foos: Vec<&'a MyTrait> , diff --git a/src/test/run-pass/regions-no-variance-from-fn-generics.rs b/src/test/run-pass/regions-no-variance-from-fn-generics.rs index 3814de79bb6b3..a35ab1bfc0ce6 100644 --- a/src/test/run-pass/regions-no-variance-from-fn-generics.rs +++ b/src/test/run-pass/regions-no-variance-from-fn-generics.rs @@ -12,7 +12,7 @@ // should not upset the variance inference for actual occurrences of // that lifetime in type expressions. -trait HasLife<'a> { } +pub trait HasLife<'a> { } trait UseLife01 { fn refs<'a, H: HasLife<'a>>(&'a self) -> H; @@ -23,7 +23,7 @@ trait UseLife02 { } -trait HasType { } +pub trait HasType { } trait UseLife03 { fn refs<'a, H: HasType<&'a T>>(&'a self) -> H; diff --git a/src/test/run-pass/struct-partial-move-1.rs b/src/test/run-pass/struct-partial-move-1.rs index 7e02d10208182..d64408ec42f70 100644 --- a/src/test/run-pass/struct-partial-move-1.rs +++ b/src/test/run-pass/struct-partial-move-1.rs @@ -9,7 +9,7 @@ // except according to those terms. #[deriving(PartialEq, Show)] -struct Partial { x: T, y: T } +pub struct Partial { x: T, y: T } #[deriving(PartialEq, Show)] struct S { val: int } diff --git a/src/test/run-pass/struct-partial-move-2.rs b/src/test/run-pass/struct-partial-move-2.rs index fe5e1eaaa1af5..0e77079ed057e 100644 --- a/src/test/run-pass/struct-partial-move-2.rs +++ b/src/test/run-pass/struct-partial-move-2.rs @@ -9,14 +9,14 @@ // except according to those terms. #[deriving(PartialEq, Show)] -struct Partial { x: T, y: T } +pub struct Partial { x: T, y: T } #[deriving(PartialEq, Show)] struct S { val: int } impl S { fn new(v: int) -> S { S { val: v } } } impl Drop for S { fn drop(&mut self) { } } -type Two = (Partial, Partial); +pub type Two = (Partial, Partial); pub fn f((b1, b2): (T, T), (b3, b4): (T, T), f: |T| -> T) -> Two { let p = Partial { x: b1, y: b2 }; diff --git a/src/test/run-pass/visible-private-types-feature-gate.rs b/src/test/run-pass/visible-private-types-feature-gate.rs new file mode 100644 index 0000000000000..cf811f7071998 --- /dev/null +++ b/src/test/run-pass/visible-private-types-feature-gate.rs @@ -0,0 +1,22 @@ +// Copyright 2014 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(visible_private_types)] + +pub mod a { + struct Struct { + x: int, + } + + pub fn f(x: Struct) {} +} + +fn main() {} +