Skip to content

Commit

Permalink
Rollup merge of rust-lang#65016 - lzutao:inline-mem-constfn, r=oli-obk
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
tmandry committed Oct 18, 2019
2 parents 518deda + a87b44d commit 7167a59
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/libcore/mem/mod.rs
Original file line number Diff line number Diff line change
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 7167a59

Please sign in to comment.