From 82fd71137a87ad4568eee24142d22bf87a4d2e2b Mon Sep 17 00:00:00 2001 From: Patrick Walton Date: Wed, 3 Oct 2012 19:24:06 -0700 Subject: [PATCH] libcore: De-export core.rc and core.rs --- src/libcore/core.rc | 157 ++++++++++++++++++++++---------------------- src/libcore/core.rs | 93 ++++++++++---------------- 2 files changed, 113 insertions(+), 137 deletions(-) diff --git a/src/libcore/core.rc b/src/libcore/core.rc index 818e1e890ec..0a8641b4a1b 100644 --- a/src/libcore/core.rc +++ b/src/libcore/core.rc @@ -36,7 +36,7 @@ Implicitly, all crates behave as if they included the following prologue: // Don't link to core. We are core. #[no_core]; -#[legacy_exports]; +//#[legacy_exports]; #[warn(deprecated_mode)]; #[warn(deprecated_pattern)]; @@ -44,6 +44,7 @@ Implicitly, all crates behave as if they included the following prologue: #[warn(vecs_implicitly_copyable)]; #[deny(non_camel_case_types)]; +/* export int, i8, i16, i32, i64; export uint, u8, u16, u32, u64; export float, f32, f64; @@ -81,182 +82,182 @@ export option_iter; // This creates some APIs that I do not want to commit to, but it must be // exported from core in order for uv to remain in std (see #2648). export private; - +*/ // Built-in-type support modules /// Operations and constants for `int` #[path = "int-template"] -mod int { +pub mod int { pub use inst::{ pow }; #[path = "int.rs"] - mod inst; + pub mod inst; } /// Operations and constants for `i8` #[path = "int-template"] -mod i8 { +pub mod i8 { #[path = "i8.rs"] - mod inst; + pub mod inst; } /// Operations and constants for `i16` #[path = "int-template"] -mod i16 { +pub mod i16 { #[path = "i16.rs"] - mod inst; + pub mod inst; } /// Operations and constants for `i32` #[path = "int-template"] -mod i32 { +pub mod i32 { #[path = "i32.rs"] - mod inst; + pub mod inst; } /// Operations and constants for `i64` #[path = "int-template"] -mod i64 { +pub mod i64 { #[path = "i64.rs"] - mod inst; + pub mod inst; } /// Operations and constants for `uint` #[path = "uint-template"] -mod uint { +pub mod uint { pub use inst::{ div_ceil, div_round, div_floor, iterate, next_power_of_two }; #[path = "uint.rs"] - mod inst; + pub mod inst; } /// Operations and constants for `u8` #[path = "uint-template"] -mod u8 { +pub mod u8 { pub use inst::is_ascii; #[path = "u8.rs"] - mod inst; + pub mod inst; } /// Operations and constants for `u16` #[path = "uint-template"] -mod u16 { +pub mod u16 { #[path = "u16.rs"] - mod inst; + pub mod inst; } /// Operations and constants for `u32` #[path = "uint-template"] -mod u32 { +pub mod u32 { #[path = "u32.rs"] - mod inst; + pub mod inst; } /// Operations and constants for `u64` #[path = "uint-template"] -mod u64 { +pub mod u64 { #[path = "u64.rs"] - mod inst; + pub mod inst; } -mod box; -mod char; -mod float; -mod f32; -mod f64; -mod str; -mod ptr; -mod vec; -mod at_vec; -mod bool; -mod tuple; -mod unit; -mod uniq; +pub mod box; +pub mod char; +pub mod float; +pub mod f32; +pub mod f64; +pub mod str; +pub mod ptr; +pub mod vec; +pub mod at_vec; +pub mod bool; +pub mod tuple; +pub mod unit; +pub mod uniq; // Ubiquitous-utility-type modules #[cfg(notest)] -mod ops; -mod cmp; -mod num; -mod hash; -mod either; -mod iter; -mod logging; -mod option; +pub mod ops; +pub mod cmp; +pub mod num; +pub mod hash; +pub mod either; +pub mod iter; +pub mod logging; +pub mod option; #[path="iter-trait"] -mod option_iter { +pub mod option_iter { #[path = "option.rs"] - mod inst; + pub mod inst; } -mod result; -mod to_str; -mod to_bytes; -mod from_str; -mod util; +pub mod result; +pub mod to_str; +pub mod to_bytes; +pub mod from_str; +pub mod util; // Data structure modules -mod dvec; +pub mod dvec; #[path="iter-trait"] -mod dvec_iter { +pub mod dvec_iter { #[path = "dvec.rs"] - mod inst; + pub mod inst; } -mod dlist; +pub mod dlist; #[path="iter-trait"] -mod dlist_iter { +pub mod dlist_iter { #[path ="dlist.rs"] - mod inst; + pub mod inst; } -mod send_map; +pub mod send_map; // Concurrency -mod comm; -mod task { +pub mod comm; +pub mod task { pub mod local_data; mod local_data_priv; pub mod spawn; pub mod rt; } -mod future; -mod pipes; +pub mod future; +pub mod pipes; // Runtime and language-primitive support -mod gc; -mod io; -mod libc; -mod os; -mod path; -mod rand; -mod run; -mod sys; -mod cast; -mod mutable; -mod flate; -mod repr; -mod cleanup; -mod reflect; +pub mod gc; +pub mod io; +pub mod libc; +pub mod os; +pub mod path; +pub mod rand; +pub mod run; +pub mod sys; +pub mod cast; +pub mod mutable; +pub mod flate; +pub mod repr; +pub mod cleanup; +pub mod reflect; // Modules supporting compiler-generated code // Exported but not part of the public interface #[legacy_exports] -mod extfmt; +pub mod extfmt; // The test harness links against core, so don't include runtime in tests. #[cfg(notest)] #[legacy_exports] -mod rt; +pub mod rt; // For internal use, not exported +pub mod private; mod unicode; -mod private; mod cmath; mod stackwalk; diff --git a/src/libcore/core.rs b/src/libcore/core.rs index c7261aa8c29..a14b67b40f1 100644 --- a/src/libcore/core.rs +++ b/src/libcore/core.rs @@ -2,101 +2,76 @@ // Export various ubiquitous types, constructors, methods. -use option::{Some, None}; -use Option = option::Option; -use result::{Result, Ok, Err}; +pub use option::{Some, None}; +pub use Option = option::Option; +pub use result::{Result, Ok, Err}; -use Path = path::Path; -use GenericPath = path::GenericPath; -use WindowsPath = path::WindowsPath; -use PosixPath = path::PosixPath; +pub use Path = path::Path; +pub use GenericPath = path::GenericPath; +pub use WindowsPath = path::WindowsPath; +pub use PosixPath = path::PosixPath; -use tuple::{TupleOps, ExtendedTupleOps}; -use str::{StrSlice, UniqueStr}; -use vec::{ConstVector, CopyableVector, ImmutableVector}; -use vec::{ImmutableEqVector, ImmutableCopyableVector}; -use vec::{MutableVector, MutableCopyableVector}; -use iter::{BaseIter, ExtendedIter, EqIter, CopyableIter}; -use iter::{CopyableOrderedIter, Times, TimesIx}; -use num::Num; -use ptr::Ptr; -use to_str::ToStr; - -export Path, WindowsPath, PosixPath, GenericPath; -export Option, Some, None; -export Result, Ok, Err; -export extensions; -// The following exports are the extension impls for numeric types -export Num, Times, TimesIx; -// The following exports are the common traits -export StrSlice, UniqueStr; -export ConstVector, CopyableVector, ImmutableVector; -export ImmutableEqVector, ImmutableCopyableVector, IterTraitExtensions; -export MutableVector, MutableCopyableVector; -export BaseIter, CopyableIter, CopyableOrderedIter, ExtendedIter, EqIter; -export TupleOps, ExtendedTupleOps; -export Ptr; -export ToStr; +pub use tuple::{TupleOps, ExtendedTupleOps}; +pub use str::{StrSlice, UniqueStr}; +pub use vec::{ConstVector, CopyableVector, ImmutableVector}; +pub use vec::{ImmutableEqVector, ImmutableCopyableVector}; +pub use vec::{MutableVector, MutableCopyableVector}; +pub use iter::{BaseIter, ExtendedIter, EqIter, CopyableIter}; +pub use iter::{CopyableOrderedIter, Times, TimesIx}; +pub use num::Num; +pub use ptr::Ptr; +pub use to_str::ToStr; // The following exports are the core operators and kinds // The compiler has special knowlege of these so we must not duplicate them // when compiling for testing #[cfg(notest)] -use ops::{Const, Copy, Send, Owned}; +pub use ops::{Const, Copy, Send, Owned}; #[cfg(notest)] -use ops::{Add, Sub, Mul, Div, Modulo, Neg, BitAnd, BitOr, BitXor}; +pub use ops::{Add, Sub, Mul, Div, Modulo, Neg, BitAnd, BitOr, BitXor}; #[cfg(notest)] -use ops::{Shl, Shr, Index}; - -#[cfg(notest)] -export Const, Copy, Send, Owned; -#[cfg(notest)] -export Add, Sub, Mul, Div, Modulo, Neg, BitAnd, BitOr, BitXor; -#[cfg(notest)] -export Shl, Shr, Index; +pub use ops::{Shl, Shr, Index}; #[cfg(test)] extern mod coreops(name = "core", vers = "0.4"); #[cfg(test)] -use coreops::ops::{Const, Copy, Send, Owned}; +pub use coreops::ops::{Const, Copy, Send, Owned}; #[cfg(test)] -use coreops::ops::{Add, Sub, Mul, Div, Modulo, Neg, BitAnd, BitOr, BitXor}; +pub use coreops::ops::{Add, Sub, Mul, Div, Modulo, Neg, BitAnd, BitOr}; #[cfg(test)] -use coreops::ops::{Shl, Shr, Index}; +pub use coreops::ops::{BitXor}; +#[cfg(test)] +pub use coreops::ops::{Shl, Shr, Index}; // Export the log levels as global constants. Higher levels mean // more-verbosity. Error is the bottom level, default logging level is // warn-and-below. -export error, warn, info, debug; - /// The error log level -const error : u32 = 0_u32; +pub const error : u32 = 0_u32; /// The warning log level -const warn : u32 = 1_u32; +pub const warn : u32 = 1_u32; /// The info log level -const info : u32 = 2_u32; +pub const info : u32 = 2_u32; /// The debug log level -const debug : u32 = 3_u32; +pub const debug : u32 = 3_u32; // A curious inner-module that's not exported that contains the binding // 'core' so that macro-expanded references to core::error and such // can be resolved within libcore. #[doc(hidden)] // FIXME #3538 mod core { - #[legacy_exports]; - const error : u32 = 0_u32; - const warn : u32 = 1_u32; - const info : u32 = 2_u32; - const debug : u32 = 3_u32; + pub const error : u32 = 0_u32; + pub const warn : u32 = 1_u32; + pub const info : u32 = 2_u32; + pub const debug : u32 = 3_u32; } // Similar to above. Some magic to make core testable. #[cfg(test)] mod std { - #[legacy_exports]; extern mod std(vers = "0.4"); - use std::test; + pub use std::test; }