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

View all comments

Tracking issue: #160275

Fixes #93237
Fixes #108499

@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.

@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
@ChrisDenton

Copy link
Copy Markdown
Member Author

PR CI is green. Let's see what the full CI says

@bors r=petrochenkov

@rust-bors

rust-bors Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 967f720 has been approved by petrochenkov

It is now in the queue for this repository.

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Aug 5, 2026
@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Aug 6, 2026
…=petrochenkov

Increase the default stack size to 16 MiB and remove `ensure_sufficient_stack`

Tracking issue: #160275

Fixes #93237
@rust-log-analyzer

This comment has been minimized.

@rust-bors rust-bors Bot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Aug 6, 2026
@rust-bors

rust-bors Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

💔 Test for 145c517 failed: CI. Failed job:

@oli-obk

oli-obk commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

I guess some stack overflow regression test is not regressing anymore. Does that succeed spuriously (so it's close to the 16 MiB boundary?) or is it generally fixed?

@ChrisDenton

Copy link
Copy Markdown
Member Author

I guess some stack overflow regression test is not regressing anymore. Does that succeed spuriously (so it's close to the 16 MiB boundary?) or is it generally fixed?

It succeeds on some runners but fails on others. I guess due to the particular optimisations they use. My thought is that doing mathematics in the type system is weird enough that asking the user to set RUST_MIN_STACK to some higher value is fine. Otherwise we could just increase the default stack size but I'm not sure it's worth it for this case.

In short I don't think this is a bug any more under the new system because the user now has options rather than needing us to fix it.

@petrochenkov petrochenkov 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 6, 2026
@oli-obk

oli-obk commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

makes sense. Could turn it into a ui test with more stack or just remove it. Either way, can mark the issue as fixed by this PR.

@oli-obk

oli-obk commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

r=me with the crash test handled $somehow

This crash test was for a bug in our use of `ensure_sufficient_stack`. Since that has now been removed, this test is redundant. Users can use the `RUST_MIN_STACK` environment variable instead if the default stack isn't sufficient.
@ChrisDenton
ChrisDenton force-pushed the remove-ensure_sufficient_stack branch from 967f720 to 402237c Compare August 6, 2026 11:18
@ChrisDenton

Copy link
Copy Markdown
Member Author

I've removed it but if this merges then I'll comment on the original issue.

@bors r=petrochenkov,oli-obk

@rust-bors

rust-bors Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 402237c has been approved by petrochenkov,oli-obk

It is now in the queue for this repository.

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Aug 6, 2026
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-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. 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

7 participants