about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-02-20 15:10:19 +0000
committerbors <bors@rust-lang.org>2022-02-20 15:10:19 +0000
commitc1aa85475cf5623caf50f7ef3b62903bb084e518 (patch)
tree0cc9d849cc3ad54aeaeefc74d8057bb7d6e9efdf
parent3b186511f62b0ce20e72ede0e8e13f8787155f02 (diff)
parent59536fb02384e47560f2580596e147fa1a39a100 (diff)
downloadrust-c1aa85475cf5623caf50f7ef3b62903bb084e518.tar.gz
rust-c1aa85475cf5623caf50f7ef3b62903bb084e518.zip
Auto merge of #93934 - rusticstuff:inline_ensure_sufficient_stack, r=estebank
Allow inlining of `ensure_sufficient_stack()`

This functions is monomorphized a lot and allowing the compiler to inline it improves instructions count and max RSS significantly in my local tests.
-rw-r--r--compiler/rustc_data_structures/src/stack.rs1
1 files changed, 1 insertions, 0 deletions
diff --git a/compiler/rustc_data_structures/src/stack.rs b/compiler/rustc_data_structures/src/stack.rs
index a4964b7aa0c..3bdd6751232 100644
--- a/compiler/rustc_data_structures/src/stack.rs
+++ b/compiler/rustc_data_structures/src/stack.rs
@@ -12,6 +12,7 @@ const STACK_PER_RECURSION: usize = 1 * 1024 * 1024; // 1MB
 /// from this.
 ///
 /// Should not be sprinkled around carelessly, as it causes a little bit of overhead.
+#[inline]
 pub fn ensure_sufficient_stack<R>(f: impl FnOnce() -> R) -> R {
     stacker::maybe_grow(RED_ZONE, STACK_PER_RECURSION, f)
 }