Describe why size_align have not been inlined so far

This commit is contained in:
Tomasz Miąsko 2020-12-10 00:00:00 +00:00
parent f0f68778f7
commit cf5bd26329

View File

@ -4,6 +4,12 @@ use crate::mem;
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>())
}