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.
This commit is contained in:
parent
f2023ac599
commit
a87b44dbea
1 changed files with 2 additions and 2 deletions
|
|
@ -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 {
|
||||
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue