about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2021-01-03 03:43:29 +0000
committerbors <bors@rust-lang.org>2021-01-03 03:43:29 +0000
commit05dfaba442258c3378070c0af41cd8b0735f7a0a (patch)
treef6a0945135fc5c6496b5ef06ee56bfc3fc6bdbc8
parent18d855b8f6358d34dbee033faccc82b8c849a4b3 (diff)
parentcf5bd26329eb8dcff4c1e619b655ede662eda0d9 (diff)
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.
-rw-r--r--library/core/src/alloc/layout.rs6
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>())
 }