|
18 | 18 |
|
19 | 19 | #![stable(feature = "raw_os", since = "1.1.0")] |
20 | 20 |
|
21 | | -use fmt; |
22 | | - |
23 | 21 | #[doc(include = "os/raw/char.md")] |
24 | 22 | #[cfg(any(all(target_os = "linux", any(target_arch = "aarch64", |
25 | 23 | target_arch = "arm", |
@@ -83,40 +81,9 @@ use fmt; |
83 | 81 | #[doc(include = "os/raw/double.md")] |
84 | 82 | #[stable(feature = "raw_os", since = "1.1.0")] pub type c_double = f64; |
85 | 83 |
|
86 | | -/// Equivalent to C's `void` type when used as a [pointer]. |
87 | | -/// |
88 | | -/// In essence, `*const c_void` is equivalent to C's `const void*` |
89 | | -/// and `*mut c_void` is equivalent to C's `void*`. That said, this is |
90 | | -/// *not* the same as C's `void` return type, which is Rust's `()` type. |
91 | | -/// |
92 | | -/// Ideally, this type would be equivalent to [`!`], but currently it may |
93 | | -/// be more ideal to use `c_void` for FFI purposes. |
94 | | -/// |
95 | | -/// [`!`]: ../../primitive.never.html |
96 | | -/// [pointer]: ../../primitive.pointer.html |
97 | | -// NB: For LLVM to recognize the void pointer type and by extension |
98 | | -// functions like malloc(), we need to have it represented as i8* in |
99 | | -// LLVM bitcode. The enum used here ensures this and prevents misuse |
100 | | -// of the "raw" type by only having private variants.. We need two |
101 | | -// variants, because the compiler complains about the repr attribute |
102 | | -// otherwise. |
103 | | -#[repr(u8)] |
104 | 84 | #[stable(feature = "raw_os", since = "1.1.0")] |
105 | | -pub enum c_void { |
106 | | - #[unstable(feature = "c_void_variant", reason = "should not have to exist", |
107 | | - issue = "0")] |
108 | | - #[doc(hidden)] __variant1, |
109 | | - #[unstable(feature = "c_void_variant", reason = "should not have to exist", |
110 | | - issue = "0")] |
111 | | - #[doc(hidden)] __variant2, |
112 | | -} |
113 | | - |
114 | | -#[stable(feature = "std_debug", since = "1.16.0")] |
115 | | -impl fmt::Debug for c_void { |
116 | | - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { |
117 | | - f.pad("c_void") |
118 | | - } |
119 | | -} |
| 85 | +#[doc(no_inline)] |
| 86 | +pub use core::ffi::c_void; |
120 | 87 |
|
121 | 88 | #[cfg(test)] |
122 | 89 | #[allow(unused_imports)] |
|
0 commit comments