about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAndrew Cann <shum@canndrew.org>2016-11-09 17:55:11 +0800
committerAndrew Cann <shum@canndrew.org>2016-11-22 13:21:21 +0800
commita6cc398207009884a2885855e79ba424c2f4c303 (patch)
tree40fdf91521e57ee6ea40afc706944bddf1d960ee
parent5b20c6aec716abd1b1e8cd8750ae0d106db5f616 (diff)
downloadrust-a6cc398207009884a2885855e79ba424c2f4c303.tar.gz
rust-a6cc398207009884a2885855e79ba424c2f4c303.zip
Revert libcore changes, redefine Void instead
-rw-r--r--src/libcore/fmt/mod.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/libcore/fmt/mod.rs b/src/libcore/fmt/mod.rs
index 9fcccacdbe1..c5116b996dd 100644
--- a/src/libcore/fmt/mod.rs
+++ b/src/libcore/fmt/mod.rs
@@ -166,7 +166,9 @@ pub struct Formatter<'a> {
 // NB. Argument is essentially an optimized partially applied formatting function,
 // equivalent to `exists T.(&T, fn(&T, &mut Formatter) -> Result`.
 
-enum Void {}
+struct Void {
+    _private: (),
+}
 
 /// This struct represents the generic "argument" which is taken by the Xprintf
 /// family of functions. It contains a function to format the given value. At
@@ -178,9 +180,8 @@ enum Void {}
            issue = "0")]
 #[doc(hidden)]
 pub struct ArgumentV1<'a> {
-    _ph: PhantomData<&'a ()>,
-    value: *const Void,
-    formatter: fn(*const Void, &mut Formatter) -> Result,
+    value: &'a Void,
+    formatter: fn(&Void, &mut Formatter) -> Result,
 }
 
 #[unstable(feature = "fmt_internals", reason = "internal to format_args!",
@@ -204,7 +205,6 @@ impl<'a> ArgumentV1<'a> {
                       f: fn(&T, &mut Formatter) -> Result) -> ArgumentV1<'b> {
         unsafe {
             ArgumentV1 {
-                _ph: PhantomData,
                 formatter: mem::transmute(f),
                 value: mem::transmute(x)
             }
@@ -220,7 +220,7 @@ impl<'a> ArgumentV1<'a> {
 
     fn as_usize(&self) -> Option<usize> {
         if self.formatter as usize == ArgumentV1::show_usize as usize {
-            Some(unsafe { *(self.value as *const usize) })
+            Some(unsafe { *(self.value as *const _ as *const usize) })
         } else {
             None
         }