Skip to content

Commit 89117f8

Browse files
committed
Use fake libc in core test
1 parent 0230848 commit 89117f8

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

library/core/src/primitive_docs.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,11 @@ impl () {}
537537
/// ## 4. Get it from C.
538538
///
539539
/// ```
540-
/// # #![feature(rustc_private)]
540+
/// # mod libc {
541+
/// # pub unsafe fn malloc(_size: usize) -> *mut core::ffi::c_void { core::ptr::NonNull::dangling().as_ptr() }
542+
/// # pub unsafe fn free(_ptr: *mut core::ffi::c_void) {}
543+
/// # }
544+
/// # #[cfg(any())]
541545
/// #[allow(unused_extern_crates)]
542546
/// extern crate libc;
543547
///
@@ -548,7 +552,7 @@ impl () {}
548552
/// if my_num.is_null() {
549553
/// panic!("failed to allocate memory");
550554
/// }
551-
/// libc::free(my_num as *mut libc::c_void);
555+
/// libc::free(my_num as *mut core::ffi::c_void);
552556
/// }
553557
/// ```
554558
///

0 commit comments

Comments
 (0)