Skip to content

Commit

Permalink
Always inline mem::{size_of,align_of} in debug builds
Browse files Browse the repository at this point in the history
Those two are const fn and do not have any arguments. Inlining
helps reducing generated code size in debug builds.
  • Loading branch information
tesuji committed Oct 2, 2019
1 parent f2023ac commit a87b44d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/libcore/mem/mod.rs
Expand Up @@ -236,7 +236,7 @@ pub fn forget_unsized<T: ?Sized>(t: T) {
/// ```
///
/// [alignment]: ./fn.align_of.html
#[inline]
#[inline(always)]
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_promotable]
pub const fn size_of<T>() -> usize {
Expand Down Expand Up @@ -328,7 +328,7 @@ pub fn min_align_of_val<T: ?Sized>(val: &T) -> usize {
///
/// assert_eq!(4, mem::align_of::<i32>());
/// ```
#[inline]
#[inline(always)]
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_promotable]
pub const fn align_of<T>() -> usize {
Expand Down

0 comments on commit a87b44d

Please sign in to comment.