Skip to content

Commit 13e47c8

Browse files
authored
Rollup merge of rust-lang#65016 - lzutao:inline-mem-constfn, r=oli-obk
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. See also rust-lang#64996.
2 parents 518deda + a87b44d commit 13e47c8

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)