Skip to content

Increase the default stack size to 16 MiB and remove ensure_sufficient_stack - #160535

Open
ChrisDenton wants to merge 5 commits into
rust-lang:mainfrom
ChrisDenton:remove-ensure_sufficient_stack
Open

Increase the default stack size to 16 MiB and remove ensure_sufficient_stack#160535
ChrisDenton wants to merge 5 commits into
rust-lang:mainfrom
ChrisDenton:remove-ensure_sufficient_stack

Conversation

@ChrisDenton

@ChrisDenton ChrisDenton commented Aug 5, 2026

Copy link
Copy Markdown
Member

Tracking issue: #160275

Fixes #93237

@rustbot

rustbot commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

Some changes occurred in match checking

cc @Nadrieril

Some changes occurred in match lowering

cc @Nadrieril

changes to the core type system

cc @lcnr

These commits modify the Cargo.lock file. Unintentional changes to Cargo.lock can be introduced when switching branches and rebasing PRs.

If this was unintentional then you should revert the changes before this PR is merged.
Otherwise, you can ignore this comment.

The parser was modified, potentially altering the grammar of (stable) Rust
which would be a breaking change.

cc @fmease

Some changes occurred to the CTFE machinery

cc @RalfJung, @oli-obk, @lcnr

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

Some changes occurred in exhaustiveness checking

cc @Nadrieril

@rustbot rustbot added A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver) labels Aug 5, 2026
@rustbot

rustbot commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

r? @petrochenkov

rustbot has assigned @petrochenkov.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: compiler, types
  • compiler, types expanded to 75 candidates
  • Random selection from 20 candidates

@ChrisDenton ChrisDenton changed the title Remove ensure sufficient stack Increase the stack size to 16 MiB and remove ensure sufficient stack Aug 5, 2026
@ChrisDenton ChrisDenton changed the title Increase the stack size to 16 MiB and remove ensure sufficient stack Increase the default stack size to 16 MiB and remove ensure sufficient stack Aug 5, 2026
@ChrisDenton

Copy link
Copy Markdown
Member Author

Oh that pinged everyone, sorry. It does touch a lot of files but most of the +/- diff is whitespace changes.

@ChrisDenton ChrisDenton changed the title Increase the default stack size to 16 MiB and remove ensure sufficient stack Increase the default stack size to 16 MiB and remove ensure_sufficient_stack Aug 5, 2026
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@ChrisDenton
ChrisDenton force-pushed the remove-ensure_sufficient_stack branch from 39e551e to 5b3365e Compare August 5, 2026 01:30
@rustbot

rustbot commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

The list of allowed third-party dependencies may have been modified! You must ensure that any new dependencies have compatible licenses before merging.

cc @davidtwco, @BoxyUwU

@rustbot rustbot added A-tidy Area: The tidy tool T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels Aug 5, 2026
@rust-log-analyzer

This comment has been minimized.

@ChrisDenton
ChrisDenton force-pushed the remove-ensure_sufficient_stack branch from 4b5f459 to 8f4397d Compare August 5, 2026 03:06

@ChrisDenton ChrisDenton Aug 5, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test is fairly recent but I'm not sure that this it is still useful. It's basically testing the use of stacker, which is obsolete now.

View changes since the review

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suspect that this test might start failing again with increased scale of the test (e.g. if N=8000 fails at 3MiB, then at N=45000 it would fail at 16MiB.) But maybe making the scale here large enough makes the code itself impractical in other ways? 🤷

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One thing I'm finding with these high recursion cases is that they start becoming very slow even before they approach the (new) stack limit. So we could increase the stack size further if there's a real world use case (which I don't see atm but not ruling out) but I think that might be sweeping the problem under the rug. I do feel that at the very least we should be warning about it if not treating it as a bug to be fixed.

@ChrisDenton
ChrisDenton force-pushed the remove-ensure_sufficient_stack branch from 8f4397d to a4e65d7 Compare August 5, 2026 03:25
@rust-log-analyzer

This comment has been minimized.

"windows_i686_msvc",
"windows_x86_64_gnu",
"windows_x86_64_gnullvm",
"windows_x86_64_msvc",

@bjorn3 bjorn3 Aug 5, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rustbot

rustbot commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

This PR changes a file inside tests/crashes. If a crash was fixed, please move into the corresponding ui subdir and add 'Fixes #' to the PR description to autoclose the issue upon merge.

@petrochenkov

Copy link
Copy Markdown
Contributor

The implementation looks good to me.

Do you think this needs a whole team FCP in addition to the seconded MCP?
If not then r=me when CI is green.
@rustbot author
@bors rollup=never

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 5, 2026
@ChrisDenton

Copy link
Copy Markdown
Member Author

Hm, I don't personally feel it needs an FCP in addition to the MCP but if someone thinks it should then I'm happy either way.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@ChrisDenton
ChrisDenton force-pushed the remove-ensure_sufficient_stack branch from d536b40 to 967f720 Compare August 5, 2026 14:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) A-tidy Area: The tidy tool S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tracking issue for MCP 1011: Let the OS handle stack growth Segfault when returning deep function compositions

6 participants