From 2872b5f4cd30dea08543ae858535837bea361c62 Mon Sep 17 00:00:00 2001 From: Bastian Kauschke Date: Wed, 28 Oct 2020 13:26:15 +0100 Subject: [PATCH] do not inline `grow_amortized` --- library/alloc/src/raw_vec.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/library/alloc/src/raw_vec.rs b/library/alloc/src/raw_vec.rs index a4240308bb35f..6ee8451cb3b68 100644 --- a/library/alloc/src/raw_vec.rs +++ b/library/alloc/src/raw_vec.rs @@ -389,6 +389,9 @@ impl RawVec { // so that all of the code that depends on `T` is within it, while as much // of the code that doesn't depend on `T` as possible is in functions that // are non-generic over `T`. + // + // We never inline this function to keep `Vec::push` small. + #[inline(never)] fn grow_amortized(&mut self, len: usize, additional: usize) -> Result<(), TryReserveError> { // This is ensured by the calling contexts. debug_assert!(additional > 0);