1 #![stable(feature = "", since = "1.30.0")]
3 #![allow(non_camel_case_types)]
5 //! Utilities related to FFI bindings.
9 /// Equivalent to C's `void` type when used as a [pointer].
11 /// In essence, `*const c_void` is equivalent to C's `const void*`
12 /// and `*mut c_void` is equivalent to C's `void*`. That said, this is
13 /// *not* the same as C's `void` return type, which is Rust's `()` type.
15 /// Ideally, this type would be equivalent to [`!`], but currently it may
16 /// be more ideal to use `c_void` for FFI purposes.
18 /// [`!`]: ../../std/primitive.never.html
19 /// [pointer]: ../../std/primitive.pointer.html
20 // NB: For LLVM to recognize the void pointer type and by extension
21 // functions like malloc(), we need to have it represented as i8* in
22 // LLVM bitcode. The enum used here ensures this and prevents misuse
23 // of the "raw" type by only having private variants.. We need two
24 // variants, because the compiler complains about the repr attribute
27 #[stable(feature = "raw_os", since = "1.1.0")]
29 #[unstable(feature = "c_void_variant", reason = "should not have to exist",
31 #[doc(hidden)] __variant1,
32 #[unstable(feature = "c_void_variant", reason = "should not have to exist",
34 #[doc(hidden)] __variant2,
37 #[stable(feature = "std_debug", since = "1.16.0")]
38 impl fmt::Debug for c_void {
39 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {