Skip to content

Commit a87b44d

Browse files
committed
Always inline mem::{size_of,align_of} in debug builds
Those two are const fn and do not have any arguments. Inlining helps reducing generated code size in debug builds.
1 parent f2023ac commit a87b44d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/libcore/mem/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ pub fn forget_unsized<T: ?Sized>(t: T) {
236236
/// ```
237237
///
238238
/// [alignment]: ./fn.align_of.html
239-
#[inline]
239+
#[inline(always)]
240240
#[stable(feature = "rust1", since = "1.0.0")]
241241
#[rustc_promotable]
242242
pub const fn size_of<T>() -> usize {
@@ -328,7 +328,7 @@ pub fn min_align_of_val<T: ?Sized>(val: &T) -> usize {
328328
///
329329
/// assert_eq!(4, mem::align_of::<i32>());
330330
/// ```
331-
#[inline]
331+
#[inline(always)]
332332
#[stable(feature = "rust1", since = "1.0.0")]
333333
#[rustc_promotable]
334334
pub const fn align_of<T>() -> usize {

0 commit comments

Comments
 (0)