1
Fork 0

Auto merge of #119892 - joboet:libs_use_assert_unchecked, r=Nilstrieb,cuviper

Use `assert_unchecked` instead of `assume` intrinsic in the standard library

Now that a public wrapper for the `assume` intrinsic exists, we can use it in the standard library.

CC #119131
This commit is contained in:
bors 2024-01-23 06:45:58 +00:00
commit e35a56d96f
17 changed files with 32 additions and 22 deletions

View file

@ -1996,7 +1996,7 @@ impl<T, A: Allocator> Vec<T, A> {
} else {
unsafe {
self.len -= 1;
core::intrinsics::assume(self.len < self.capacity());
core::hint::assert_unchecked(self.len < self.capacity());
Some(ptr::read(self.as_ptr().add(self.len())))
}
}