From 8ed728babb057c0f736a63a69ba772e45278148f Mon Sep 17 00:00:00 2001
From: Alex Crichton <alex@alexcrichton.com>
Date: Wed, 30 Apr 2014 20:36:58 -0700
Subject: [PATCH] core: Inherit the any module

---
 src/{libstd => libcore}/any.rs | 17 -----------------
 src/libcore/lib.rs             |  1 +
 src/libstd/fmt/mod.rs          |  8 ++++++++
 src/libstd/lib.rs              |  3 +--
 4 files changed, 10 insertions(+), 19 deletions(-)
 rename src/{libstd => libcore}/any.rs (95%)

diff --git a/src/libstd/any.rs b/src/libcore/any.rs
similarity index 95%
rename from src/libstd/any.rs
rename to src/libcore/any.rs
index 2c1ce9fa779..f22453eb740 100644
--- a/src/libstd/any.rs
+++ b/src/libcore/any.rs
@@ -21,7 +21,6 @@
 //! the extension traits (`*Ext`) for the full details.
 
 use cast::{transmute, transmute_copy};
-use fmt;
 use option::{Option, Some, None};
 use owned::Box;
 use raw::TraitObject;
@@ -145,22 +144,6 @@ impl AnyOwnExt for Box<Any> {
     }
 }
 
-///////////////////////////////////////////////////////////////////////////////
-// Trait implementations
-///////////////////////////////////////////////////////////////////////////////
-
-impl fmt::Show for Box<Any> {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        f.pad("Box<Any>")
-    }
-}
-
-impl<'a> fmt::Show for &'a Any {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        f.pad("&Any")
-    }
-}
-
 #[cfg(test)]
 mod tests {
     use prelude::*;
diff --git a/src/libcore/lib.rs b/src/libcore/lib.rs
index 5206ba1f32a..08b0434d827 100644
--- a/src/libcore/lib.rs
+++ b/src/libcore/lib.rs
@@ -37,5 +37,6 @@ pub mod container;
 
 /* Core types and methods on primitives */
 
+pub mod any;
 pub mod finally;
 pub mod char;
diff --git a/src/libstd/fmt/mod.rs b/src/libstd/fmt/mod.rs
index 53d6f2fc0d2..8c999c2e2e3 100644
--- a/src/libstd/fmt/mod.rs
+++ b/src/libstd/fmt/mod.rs
@@ -1242,6 +1242,14 @@ impl<T> Show for *mut T {
     fn fmt(&self, f: &mut Formatter) -> Result { secret_pointer(self, f) }
 }
 
+impl Show for Box<any::Any> {
+    fn fmt(&self, f: &mut Formatter) -> Result { f.pad("Box<Any>") }
+}
+
+impl<'a> Show for &'a any::Any {
+    fn fmt(&self, f: &mut Formatter) -> Result { f.pad("&Any") }
+}
+
 impl Show for TypeId {
     fn fmt(&self, f: &mut Formatter) -> Result {
         write!(f.buf, "TypeId \\{ {} \\}", self.hash())
diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs
index 26e8e18909c..356b653281e 100644
--- a/src/libstd/lib.rs
+++ b/src/libstd/lib.rs
@@ -137,6 +137,7 @@ extern crate core;
 #[cfg(not(test))] pub use ops = core::ops;
 #[cfg(not(test))] pub use ty = core::ty;
 
+pub use core::any;
 pub use core::cast;
 pub use core::char;
 pub use core::container;
@@ -218,8 +219,6 @@ pub mod iter;
 pub mod to_str;
 pub mod clone;
 pub mod hash;
-pub mod default;
-pub mod any;
 
 /* Common data structures */