about summary refs log tree commit diff
path: root/library/alloc/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/alloc/src/alloc.rs
parent174e73a3f6df6f96ab453493796e461164dea94a (diff)
downloadrust-fa9a911a57eff5d2cd59eacbffb4e41bc721db2e.tar.gz
rust-fa9a911a57eff5d2cd59eacbffb4e41bc721db2e.zip
libs: use `assert_unchecked` instead of intrinsic
Diffstat (limited to 'library/alloc/src/alloc.rs')
-rw-r--r--library/alloc/src/alloc.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/library/alloc/src/alloc.rs b/library/alloc/src/alloc.rs
index 1663aa84921..0b142939755 100644
--- a/library/alloc/src/alloc.rs
+++ b/library/alloc/src/alloc.rs
@@ -3,7 +3,7 @@
 #![stable(feature = "alloc_module", since = "1.28.0")]
 
 #[cfg(not(test))]
-use core::intrinsics;
+use core::hint;
 
 #[cfg(not(test))]
 use core::ptr::{self, NonNull};
@@ -208,7 +208,7 @@ impl Global {
                 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 = realloc(ptr.as_ptr(), old_layout, new_size);
                 let ptr = NonNull::new(raw_ptr).ok_or(AllocError)?;
@@ -299,7 +299,7 @@ unsafe impl Allocator for Global {
             // 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 = realloc(ptr.as_ptr(), old_layout, new_size);
                 let ptr = NonNull::new(raw_ptr).ok_or(AllocError)?;