From d978aace53feef02b769515552bb2cfd024e833a Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Sat, 14 Jan 2012 03:13:09 -0800 Subject: [PATCH] libcore: Make ctypes::void an unconstructable, undestructurable tag --- src/libcore/ctypes.rs | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/src/libcore/ctypes.rs b/src/libcore/ctypes.rs index b9d42275824..478e8741631 100644 --- a/src/libcore/ctypes.rs +++ b/src/libcore/ctypes.rs @@ -9,6 +9,15 @@ FIXME: Add a test that uses some native code to verify these sizes, which are not obviously correct for all potential platforms. */ +export c_int, c_uint, long, longlong, unsigned, ulong, ulonglong; +export intptr_t, uintptr_t; +export uint32_t; +export void; +export c_float, c_double; +export size_t, ssize_t; +export off_t, fd_t, pid_t; +export enum; + // PORT adapt to architecture /* @@ -80,13 +89,19 @@ type uint32_t = u32; /* Type: void -A type, a pointer to which can be used as C `void *` +A type, a pointer to which can be used as C `void *`. -Note that this does not directly correspond to the C `void` type, -which is an incomplete type. Using pointers to this type -when interoperating with C void pointers can help in documentation. +The void type cannot be constructed or destructured, but using +pointers to this type when interoperating with C void pointers can +help in documentation. */ -type void = int; +tag void { + // Making the only variant reference itself makes it impossible to + // construct. Not exporting it makes it impossible to destructure. + void_private(@void); + // FIXME: #881 + void_private2(@void); +} /* Type: c_float