Skip to content

Commit 8ed728b

Browse files
committed
core: Inherit the any module
1 parent 85a8e6b commit 8ed728b

File tree

4 files changed

+10
-19
lines changed

4 files changed

+10
-19
lines changed

src/libstd/any.rs renamed to src/libcore/any.rs

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
//! the extension traits (`*Ext`) for the full details.
2222
2323
use cast::{transmute, transmute_copy};
24-
use fmt;
2524
use option::{Option, Some, None};
2625
use owned::Box;
2726
use raw::TraitObject;
@@ -145,22 +144,6 @@ impl AnyOwnExt for Box<Any> {
145144
}
146145
}
147146

148-
///////////////////////////////////////////////////////////////////////////////
149-
// Trait implementations
150-
///////////////////////////////////////////////////////////////////////////////
151-
152-
impl fmt::Show for Box<Any> {
153-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
154-
f.pad("Box<Any>")
155-
}
156-
}
157-
158-
impl<'a> fmt::Show for &'a Any {
159-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
160-
f.pad("&Any")
161-
}
162-
}
163-
164147
#[cfg(test)]
165148
mod tests {
166149
use prelude::*;

src/libcore/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,6 @@ pub mod container;
3737

3838
/* Core types and methods on primitives */
3939

40+
pub mod any;
4041
pub mod finally;
4142
pub mod char;

src/libstd/fmt/mod.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1242,6 +1242,14 @@ impl<T> Show for *mut T {
12421242
fn fmt(&self, f: &mut Formatter) -> Result { secret_pointer(self, f) }
12431243
}
12441244

1245+
impl Show for Box<any::Any> {
1246+
fn fmt(&self, f: &mut Formatter) -> Result { f.pad("Box<Any>") }
1247+
}
1248+
1249+
impl<'a> Show for &'a any::Any {
1250+
fn fmt(&self, f: &mut Formatter) -> Result { f.pad("&Any") }
1251+
}
1252+
12451253
impl Show for TypeId {
12461254
fn fmt(&self, f: &mut Formatter) -> Result {
12471255
write!(f.buf, "TypeId \\{ {} \\}", self.hash())

src/libstd/lib.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ extern crate core;
137137
#[cfg(not(test))] pub use ops = core::ops;
138138
#[cfg(not(test))] pub use ty = core::ty;
139139

140+
pub use core::any;
140141
pub use core::cast;
141142
pub use core::char;
142143
pub use core::container;
@@ -218,8 +219,6 @@ pub mod iter;
218219
pub mod to_str;
219220
pub mod clone;
220221
pub mod hash;
221-
pub mod default;
222-
pub mod any;
223222

224223
/* Common data structures */
225224

0 commit comments

Comments
 (0)