diff options
| author | Tomasz Miąsko <tomasz.miasko@gmail.com> | 2020-12-10 00:00:00 +0000 |
|---|---|---|
| committer | Tomasz Miąsko <tomasz.miasko@gmail.com> | 2020-12-10 00:00:00 +0000 |
| commit | cf5bd26329eb8dcff4c1e619b655ede662eda0d9 (patch) | |
| tree | 21f373b5b0acf3e9c58148f320358b314ef0fbe2 | |
| parent | f0f68778f798d6d34649745b41770829b17ba5b8 (diff) | |
| download | rust-cf5bd26329eb8dcff4c1e619b655ede662eda0d9.tar.gz rust-cf5bd26329eb8dcff4c1e619b655ede662eda0d9.zip | |
Describe why `size_align` have not been inlined so far
| -rw-r--r-- | library/core/src/alloc/layout.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/library/core/src/alloc/layout.rs b/library/core/src/alloc/layout.rs index 57c6624b64f..c572c66ce32 100644 --- a/library/core/src/alloc/layout.rs +++ b/library/core/src/alloc/layout.rs @@ -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>()) } |
