about summary refs log tree commit diff
path: root/library/std/src/alloc.rs
diff options
context:
space:
mode:
authorEric Huss <eric@huss.org>2025-02-13 12:51:22 -0800
committerEric Huss <eric@huss.org>2025-02-14 07:36:17 -0800
commit4f4ea35a6969cdbebfdf96778e8a9d49bea8c9ce (patch)
tree8cae3e3e42729395d2a9e5bda49b909ef3e04f90 /library/std/src/alloc.rs
parentd5f0aa49e711db038d7bd30ceb76ba260de8b1fd (diff)
downloadrust-4f4ea35a6969cdbebfdf96778e8a9d49bea8c9ce.tar.gz
rust-4f4ea35a6969cdbebfdf96778e8a9d49bea8c9ce.zip
std: Apply unsafe_op_in_unsafe_fn
Diffstat (limited to 'library/std/src/alloc.rs')
-rw-r--r--library/std/src/alloc.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/library/std/src/alloc.rs b/library/std/src/alloc.rs
index 3936ed057e6..99d105a2454 100644
--- a/library/std/src/alloc.rs
+++ b/library/std/src/alloc.rs
@@ -20,11 +20,11 @@
 //!
 //! unsafe impl GlobalAlloc for MyAllocator {
 //!     unsafe fn alloc(&self, layout: Layout) -> *mut u8 {
-//!         System.alloc(layout)
+//!         unsafe { System.alloc(layout) }
 //!     }
 //!
 //!     unsafe fn dealloc(&self, ptr: *mut u8, layout: Layout) {
-//!         System.dealloc(ptr, layout)
+//!         unsafe { System.dealloc(ptr, layout) }
 //!     }
 //! }
 //!
@@ -102,7 +102,7 @@ pub use alloc_crate::alloc::*;
 ///
 /// unsafe impl GlobalAlloc for Counter {
 ///     unsafe fn alloc(&self, layout: Layout) -> *mut u8 {
-///         let ret = System.alloc(layout);
+///         let ret = unsafe { System.alloc(layout) };
 ///         if !ret.is_null() {
 ///             ALLOCATED.fetch_add(layout.size(), Relaxed);
 ///         }
@@ -110,7 +110,7 @@ pub use alloc_crate::alloc::*;
 ///     }
 ///
 ///     unsafe fn dealloc(&self, ptr: *mut u8, layout: Layout) {
-///         System.dealloc(ptr, layout);
+///         unsafe { System.dealloc(ptr, layout); }
 ///         ALLOCATED.fetch_sub(layout.size(), Relaxed);
 ///     }
 /// }