mirror of
https://github.com/rust-lang/rust.git
synced 2025-01-22 12:43:36 +00:00
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:
commit
05dfaba442
@ -4,6 +4,12 @@ use crate::mem;
|
|||||||
use crate::num::NonZeroUsize;
|
use crate::num::NonZeroUsize;
|
||||||
use crate::ptr::NonNull;
|
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) {
|
const fn size_align<T>() -> (usize, usize) {
|
||||||
(mem::size_of::<T>(), mem::align_of::<T>())
|
(mem::size_of::<T>(), mem::align_of::<T>())
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user