about summary refs log tree commit diff
path: root/library/std/src/alloc.rs
diff options
context:
space:
mode:
authorjoboet <jonasboettiger@icloud.com>2024-01-13 20:10:00 +0100
committerjoboet <jonasboettiger@icloud.com>2024-01-13 20:10:00 +0100
commitfa9a911a57eff5d2cd59eacbffb4e41bc721db2e (patch)
treebe7dbf9dcc0c9d7639d68111762adbd962e6ee11 /library/std/src/alloc.rs
parent174e73a3f6df6f96ab453493796e461164dea94a (diff)
downloadrust-fa9a911a57eff5d2cd59eacbffb4e41bc721db2e.tar.gz
rust-fa9a911a57eff5d2cd59eacbffb4e41bc721db2e.zip
libs: use `assert_unchecked` instead of intrinsic
Diffstat (limited to 'library/std/src/alloc.rs')
-rw-r--r--library/std/src/alloc.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/library/std/src/alloc.rs b/library/std/src/alloc.rs
index bb786bd59dc..a834b36697c 100644
--- a/library/std/src/alloc.rs
+++ b/library/std/src/alloc.rs
@@ -56,7 +56,7 @@
 #![deny(unsafe_op_in_unsafe_fn)]
 #![stable(feature = "alloc_module", since = "1.28.0")]
 
-use core::intrinsics;
+use core::hint;
 use core::ptr::NonNull;
 use core::sync::atomic::{AtomicPtr, Ordering};
 use core::{mem, ptr};
@@ -172,7 +172,7 @@ impl System {
                 let new_size = new_layout.size();
 
                 // `realloc` probably checks for `new_size >= old_layout.size()` or something similar.
-                intrinsics::assume(new_size >= old_layout.size());
+                hint::assert_unchecked(new_size >= old_layout.size());
 
                 let raw_ptr = GlobalAlloc::realloc(self, ptr.as_ptr(), old_layout, new_size);
                 let ptr = NonNull::new(raw_ptr).ok_or(AllocError)?;
@@ -264,7 +264,7 @@ unsafe impl Allocator for System {
             // SAFETY: `new_size` is non-zero. Other conditions must be upheld by the caller
             new_size if old_layout.align() == new_layout.align() => unsafe {
                 // `realloc` probably checks for `new_size <= old_layout.size()` or something similar.
-                intrinsics::assume(new_size <= old_layout.size());
+                hint::assert_unchecked(new_size <= old_layout.size());
 
                 let raw_ptr = GlobalAlloc::realloc(self, ptr.as_ptr(), old_layout, new_size);
                 let ptr = NonNull::new(raw_ptr).ok_or(AllocError)?;