about summary refs log tree commit diff
diff options
context:
space:
mode:
authorChris Denton <chris@chrisdenton.dev>2024-04-15 02:10:25 +0000
committerChris Denton <chris@chrisdenton.dev>2024-04-15 17:50:49 +0000
commit89117f85e3f22d7e240a6237be100d7697ae2435 (patch)
tree4fb37dd52f97be7100758af6fc296f8aca6c948a
parent023084804e5e8ea42877451c2b3030e7050281cc (diff)
downloadrust-89117f85e3f22d7e240a6237be100d7697ae2435.tar.gz
rust-89117f85e3f22d7e240a6237be100d7697ae2435.zip
Use fake libc in core test
-rw-r--r--library/core/src/primitive_docs.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/library/core/src/primitive_docs.rs b/library/core/src/primitive_docs.rs
index e8e23f2a7ec..bda1ee6f457 100644
--- a/library/core/src/primitive_docs.rs
+++ b/library/core/src/primitive_docs.rs
@@ -537,7 +537,11 @@ impl () {}
 /// ## 4. Get it from C.
 ///
 /// ```
-/// # #![feature(rustc_private)]
+/// # mod libc {
+/// # pub unsafe fn malloc(_size: usize) -> *mut core::ffi::c_void { core::ptr::NonNull::dangling().as_ptr() }
+/// # pub unsafe fn free(_ptr: *mut core::ffi::c_void) {}
+/// # }
+/// # #[cfg(any())]
 /// #[allow(unused_extern_crates)]
 /// extern crate libc;
 ///
@@ -548,7 +552,7 @@ impl () {}
 ///     if my_num.is_null() {
 ///         panic!("failed to allocate memory");
 ///     }
-///     libc::free(my_num as *mut libc::c_void);
+///     libc::free(my_num as *mut core::ffi::c_void);
 /// }
 /// ```
 ///