|
2 | 2 |
|
3 | 3 | use core::alloc::LayoutError;
|
4 | 4 | use core::cmp;
|
5 |
| -use core::intrinsics; |
| 5 | +use core::hint; |
6 | 6 | use core::mem::{self, ManuallyDrop, MaybeUninit, SizedTypeProperties};
|
7 | 7 | use core::ptr::{self, NonNull, Unique};
|
8 | 8 | use core::slice;
|
@@ -325,7 +325,7 @@ impl<T, A: Allocator> RawVec<T, A> {
|
325 | 325 | }
|
326 | 326 | unsafe {
|
327 | 327 | // Inform the optimizer that the reservation has succeeded or wasn't needed
|
328 |
| - core::intrinsics::assume(!self.needs_to_grow(len, additional)); |
| 328 | + hint::assert_unchecked(!self.needs_to_grow(len, additional)); |
329 | 329 | }
|
330 | 330 | Ok(())
|
331 | 331 | }
|
@@ -363,7 +363,7 @@ impl<T, A: Allocator> RawVec<T, A> {
|
363 | 363 | }
|
364 | 364 | unsafe {
|
365 | 365 | // Inform the optimizer that the reservation has succeeded or wasn't needed
|
366 |
| - core::intrinsics::assume(!self.needs_to_grow(len, additional)); |
| 366 | + hint::assert_unchecked(!self.needs_to_grow(len, additional)); |
367 | 367 | }
|
368 | 368 | Ok(())
|
369 | 369 | }
|
@@ -514,7 +514,7 @@ where
|
514 | 514 | debug_assert_eq!(old_layout.align(), new_layout.align());
|
515 | 515 | unsafe {
|
516 | 516 | // The allocator checks for alignment equality
|
517 |
| - intrinsics::assume(old_layout.align() == new_layout.align()); |
| 517 | + hint::assert_unchecked(old_layout.align() == new_layout.align()); |
518 | 518 | alloc.grow(ptr, old_layout, new_layout)
|
519 | 519 | }
|
520 | 520 | } else {
|
|
0 commit comments