Auto merge of #79827 - tmiasko:size-align, r=kennytm

Describe why `size_align` have not been inlined so far

although it is used only in one place.
This commit is contained in:
bors 2021-01-03 03:43:29 +00:00
commit 05dfaba442

View File

@ -4,6 +4,12 @@
use crate::num::NonZeroUsize;
use crate::ptr::NonNull;
// While this function is used in one place and its implementation
// could be inlined, the previous attempts to do so made rustc
// slower:
//
// * https://github.com/rust-lang/rust/pull/72189
// * https://github.com/rust-lang/rust/pull/79827
const fn size_align<T>() -> (usize, usize) {
(mem::size_of::<T>(), mem::align_of::<T>())
}