Skip to content

Commit a6cc398

Browse files
committed
Revert libcore changes, redefine Void instead
1 parent 5b20c6a commit a6cc398

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/libcore/fmt/mod.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,9 @@ pub struct Formatter<'a> {
166166
// NB. Argument is essentially an optimized partially applied formatting function,
167167
// equivalent to `exists T.(&T, fn(&T, &mut Formatter) -> Result`.
168168

169-
enum Void {}
169+
struct Void {
170+
_private: (),
171+
}
170172

171173
/// This struct represents the generic "argument" which is taken by the Xprintf
172174
/// family of functions. It contains a function to format the given value. At
@@ -178,9 +180,8 @@ enum Void {}
178180
issue = "0")]
179181
#[doc(hidden)]
180182
pub struct ArgumentV1<'a> {
181-
_ph: PhantomData<&'a ()>,
182-
value: *const Void,
183-
formatter: fn(*const Void, &mut Formatter) -> Result,
183+
value: &'a Void,
184+
formatter: fn(&Void, &mut Formatter) -> Result,
184185
}
185186

186187
#[unstable(feature = "fmt_internals", reason = "internal to format_args!",
@@ -204,7 +205,6 @@ impl<'a> ArgumentV1<'a> {
204205
f: fn(&T, &mut Formatter) -> Result) -> ArgumentV1<'b> {
205206
unsafe {
206207
ArgumentV1 {
207-
_ph: PhantomData,
208208
formatter: mem::transmute(f),
209209
value: mem::transmute(x)
210210
}
@@ -220,7 +220,7 @@ impl<'a> ArgumentV1<'a> {
220220

221221
fn as_usize(&self) -> Option<usize> {
222222
if self.formatter as usize == ArgumentV1::show_usize as usize {
223-
Some(unsafe { *(self.value as *const usize) })
223+
Some(unsafe { *(self.value as *const _ as *const usize) })
224224
} else {
225225
None
226226
}

0 commit comments

Comments
 (0)