Skip to content

Commit 5be6c19

Browse files
committed
Auto merge of rust-lang#113687 - saethlin:inline-assertion-helpers, r=cuviper
Add #[inline] to core debug assertion helpers These functions are called a lot and not inlined by default in a dev compiler. Adding `#[inline]` should improve things in a dev workflow and be irrelevant in the distributed library.
2 parents f9e5dbc + f2342aa commit 5be6c19

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

core/src/intrinsics.rs

+3
Original file line numberDiff line numberDiff line change
@@ -2524,12 +2524,14 @@ pub(crate) use assert_unsafe_precondition;
25242524

25252525
/// Checks whether `ptr` is properly aligned with respect to
25262526
/// `align_of::<T>()`.
2527+
#[inline]
25272528
pub(crate) fn is_aligned_and_not_null<T>(ptr: *const T) -> bool {
25282529
!ptr.is_null() && ptr.is_aligned()
25292530
}
25302531

25312532
/// Checks whether an allocation of `len` instances of `T` exceeds
25322533
/// the maximum allowed allocation size.
2534+
#[inline]
25332535
pub(crate) fn is_valid_allocation_size<T>(len: usize) -> bool {
25342536
let max_len = const {
25352537
let size = crate::mem::size_of::<T>();
@@ -2540,6 +2542,7 @@ pub(crate) fn is_valid_allocation_size<T>(len: usize) -> bool {
25402542

25412543
/// Checks whether the regions of memory starting at `src` and `dst` of size
25422544
/// `count * size_of::<T>()` do *not* overlap.
2545+
#[inline]
25432546
pub(crate) fn is_nonoverlapping<T>(src: *const T, dst: *const T, count: usize) -> bool {
25442547
let src_usize = src.addr();
25452548
let dst_usize = dst.addr();

0 commit comments

Comments
 (0)