Skip to content

Disable main_needs_argc_argv for Wasm#156571

Open
daxpedda wants to merge 1 commit into
rust-lang:mainfrom
daxpedda:wasm-main
Open

Disable main_needs_argc_argv for Wasm#156571
daxpedda wants to merge 1 commit into
rust-lang:mainfrom
daxpedda:wasm-main

Conversation

@daxpedda
Copy link
Copy Markdown
Contributor

@daxpedda daxpedda commented May 14, 2026

AFAIU this explains to the "Rust Runtime" that main() doesn't need argc/argv. Newer Wasm targets have explicitly disabled this, this PR changes it so that the base Wasm configuration affecting all Wasm targets disables this now.

This affects the following targets:

  • wasm32-unknown-unknown
  • wasm32v1-none
  • wasm64-unknown-unknown

The only Wasm target where main_needs_argc_argv is still enabled is wasm32-unknown-emscripten. @hoodmane let me know and I can remove it there as well.

Credit goes to @Spxg for stumbling on this.

r? @alexcrichton

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels May 14, 2026
@daxpedda daxpedda marked this pull request as ready for review May 14, 2026 12:54
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented May 14, 2026

These commits modify compiler targets.
(See the Target Tier Policy.)

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels May 14, 2026
@alexcrichton
Copy link
Copy Markdown
Member

@bors r+

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented May 14, 2026

📌 Commit 072be06 has been approved by alexcrichton

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-review Status: Awaiting review from the assignee but also interested parties. labels May 14, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request May 14, 2026
Disable `main_needs_argc_argv` for Wasm

AFAIU this explains to the "Rust Runtime" that `main()` doesn't need `argc`/`argv`. Newer Wasm targets have explicitly disabled this, this PR changes it so that the base Wasm configuration affecting all Wasm targets disables this now.

This affects the following targets:
- `wasm32-unknown-unknown`
- `wasm32v1-none`
- `wasm64-unknown-unknown`

The only Wasm target where `main_needs_argc_argv` is still enabled is `wasm32-unknown-emscripten`. @hoodmane let me know and I can remove it there as well.

Credit goes to @Spxg for stumbling on this.

r? @alexcrichton
rust-bors Bot pushed a commit that referenced this pull request May 14, 2026
…uwer

Rollup of 2 pull requests

Successful merges:

 - #155521 (Add lint againts invalid runtime symbol definitions)
 - #156571 (Disable `main_needs_argc_argv` for Wasm)
@hoodmane
Copy link
Copy Markdown
Contributor

Emscripten uses this so we do want to keep it.

@alexcrichton
Copy link
Copy Markdown
Member

@bors r-

@rust-bors rust-bors Bot 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-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels May 14, 2026
@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented May 14, 2026

This pull request was unapproved.

This PR was contained in a rollup (#156574), which was unapproved.

View changes since this unapproval

@daxpedda
Copy link
Copy Markdown
Contributor Author

That's okay @alexcrichton, the PR doesn't modify the Emscripten target. I deliberately only covered the unknown/none ones.

@alexcrichton
Copy link
Copy Markdown
Member

The Emscripten target inherits from the base::wasm options being modified here, though, so I think that target will need to explicitly opt-back into the default of true?

@daxpedda
Copy link
Copy Markdown
Contributor Author

I just wanted to write that it doesn't, but double-checked and it does:


All the other targets start with that, Emscripten ended with it, which is why I missed it.

Sorry! Fixed now.

@alexcrichton
Copy link
Copy Markdown
Member

@bors r+

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented May 14, 2026

📌 Commit 1b7609c has been approved by alexcrichton

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 May 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants