diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2014-04-30 20:33:08 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2014-05-07 08:13:24 -0700 |
| commit | 71924525458e508be139d76f48b34e64a5a9dca3 (patch) | |
| tree | 744d30cadfa4eb496be2da9f25a3f9d6b372223f | |
| parent | d9708539afa16bf233332fee846cc9c6d7344517 (diff) | |
core: Inherit the char module
| -rw-r--r-- | src/libcore/char.rs (renamed from src/libstd/char.rs) | 13 | ||||
| -rw-r--r-- | src/libcore/lib.rs | 4 | ||||
| -rw-r--r-- | src/libstd/lib.rs | 2 |
3 files changed, 16 insertions, 3 deletions
diff --git a/src/libstd/char.rs b/src/libcore/char.rs index 228db221cfc..7a52af82403 100644 --- a/src/libstd/char.rs +++ b/src/libcore/char.rs @@ -27,14 +27,13 @@ use cast::transmute; use option::{None, Option, Some}; use iter::{Iterator, range_step}; -use str::StrSlice; use unicode::{derived_property, property, general_category, decompose, conversions}; #[cfg(test)] use str::Str; #[cfg(test)] use strbuf::StrBuf; #[cfg(test)] use slice::ImmutableVector; -#[cfg(not(test))] use cmp::{Eq, Ord}; +#[cfg(not(test))] use cmp::{Eq, Ord, TotalEq, TotalOrd, Ordering}; #[cfg(not(test))] use default::Default; // UTF-8 ranges and tags for encoding characters @@ -660,12 +659,22 @@ impl Eq for char { } #[cfg(not(test))] +impl TotalEq for char {} + +#[cfg(not(test))] impl Ord for char { #[inline] fn lt(&self, other: &char) -> bool { *self < *other } } #[cfg(not(test))] +impl TotalOrd for char { + fn cmp(&self, other: &char) -> Ordering { + (*self as u32).cmp(&(*other as u32)) + } +} + +#[cfg(not(test))] impl Default for char { #[inline] fn default() -> char { '\x00' } diff --git a/src/libcore/lib.rs b/src/libcore/lib.rs index 1f94b41b9bb..dd64148aa2b 100644 --- a/src/libcore/lib.rs +++ b/src/libcore/lib.rs @@ -34,3 +34,7 @@ pub mod kinds; pub mod ops; pub mod ty; pub mod container; + +/* Core types and methods on primitives */ + +pub mod char; diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index 44684ba97c2..26e8e18909c 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -138,6 +138,7 @@ extern crate core; #[cfg(not(test))] pub use ty = core::ty; pub use core::cast; +pub use core::char; pub use core::container; pub use core::intrinsics; pub use core::mem; @@ -188,7 +189,6 @@ pub mod prelude; pub mod unit; pub mod bool; -pub mod char; pub mod tuple; pub mod slice; |
