Skip to content

Commit c1aa854

Browse files
committed
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.
2 parents 3b18651 + 59536fb commit c1aa854

File tree

1 file changed

+1
-0
lines changed
  • compiler/rustc_data_structures/src

1 file changed

+1
-0
lines changed

compiler/rustc_data_structures/src/stack.rs

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ const STACK_PER_RECURSION: usize = 1 * 1024 * 1024; // 1MB
1212
/// from this.
1313
///
1414
/// Should not be sprinkled around carelessly, as it causes a little bit of overhead.
15+
#[inline]
1516
pub fn ensure_sufficient_stack<R>(f: impl FnOnce() -> R) -> R {
1617
stacker::maybe_grow(RED_ZONE, STACK_PER_RECURSION, f)
1718
}

0 commit comments

Comments
 (0)