Skip to content

Reduce special casing for the panic runtime #140809

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

bjorn3
Copy link
Member

@bjorn3 bjorn3 commented May 8, 2025

See the individual commits for more info.

@rustbot
Copy link
Collaborator

rustbot commented May 8, 2025

r? @compiler-errors

rustbot has assigned @compiler-errors.
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

@rustbot rustbot added 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. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels May 8, 2025
@rustbot
Copy link
Collaborator

rustbot commented May 8, 2025

Some changes occurred in compiler/rustc_codegen_ssa

cc @WaffleLapkin

@bjorn3
Copy link
Member Author

bjorn3 commented May 8, 2025

I was looking at making panic_abort and panic_unwind depend on libstd (#139103 (comment)). These changes make this easier, though is still blocked on the fact that when compiling libstd as dylib, panic_unwind already needs to be present.

@rust-log-analyzer

This comment has been minimized.

@bjorn3 bjorn3 force-pushed the panic_runtime_cleanup branch from 6d4613c to c7e8663 Compare May 8, 2025 16:10
@rustbot
Copy link
Collaborator

rustbot commented May 8, 2025

The Miri subtree was changed

cc @rust-lang/miri

@rust-log-analyzer

This comment has been minimized.

@bjorn3 bjorn3 force-pushed the panic_runtime_cleanup branch from c7e8663 to 93cf365 Compare May 8, 2025 17:55
@bors
Copy link
Collaborator

bors commented May 9, 2025

☔ The latest upstream changes (presumably #140176) made this pull request unmergeable. Please resolve the merge conflicts.

@bjorn3 bjorn3 force-pushed the panic_runtime_cleanup branch from 93cf365 to a9d5498 Compare May 9, 2025 09:41
@bors
Copy link
Collaborator

bors commented May 17, 2025

☔ The latest upstream changes (presumably #141024) made this pull request unmergeable. Please resolve the merge conflicts.

@bjorn3 bjorn3 force-pushed the panic_runtime_cleanup branch from d730005 to 7d0f158 Compare May 18, 2025 14:16
@bors
Copy link
Collaborator

bors commented May 19, 2025

☔ The latest upstream changes (presumably #141238) made this pull request unmergeable. Please resolve the merge conflicts.

@bjorn3 bjorn3 force-pushed the panic_runtime_cleanup branch from 7d0f158 to 0dfacc7 Compare May 19, 2025 09:54
@bors
Copy link
Collaborator

bors commented Jun 1, 2025

☔ The latest upstream changes (presumably #141730) made this pull request unmergeable. Please resolve the merge conflicts.

bjorn3 added 5 commits June 3, 2025 08:55
rustc_std_internal_symbol is meant to call functions from crates where
there is no direct dependency on said crate. As they either have to be
added to symbols.o or rustc has to introduce an implicit dependency on
them to avoid linker errors. The latter is done for some things like the
panic runtime, but adding these symbols to symbols.o allows removing
those implicit dependencies.
This used to be necessary for a correct linker order, but ever since the
introduction of symbols.o adding the symbols in question to symbols.o
would work just as well. We do still add dependencies on the panic runtime
to the local crate, but not for #![needs_panic_runtime] crates.

This also removes the runtime-depends-on-needs-runtime test.
inject_dependency_if used to emit this error, but with symbols.o it is
no longer important that there is no dependency and in fact it may be
nice to have panic_abort and panic_unwind directly depend on libstd in
the future for calling std::process::abort().
You shouldn't ever need to explicitly depend on it. And we weren't
checking that the panic runtime used the correct panic strategy either.
There is already panic-unwind to enable it.
@bjorn3 bjorn3 force-pushed the panic_runtime_cleanup branch from 0dfacc7 to 6df5456 Compare June 3, 2025 09:01
@wesleywiser
Copy link
Member

r? wesleywiser

@wesleywiser
Copy link
Member

Compiler changes look good to me but I'd like someone from libs to review the change in exposed standard library features to make sure there's no concerns there.

r? libs

jhpratt added a commit to jhpratt/rust that referenced this pull request Jun 17, 2025
…sleywiser,ibraheemdev

Reduce special casing for the panic runtime

See the individual commits for more info.
bors added a commit that referenced this pull request Jun 17, 2025
Rollup of 11 pull requests

Successful merges:

 - #140809 (Reduce special casing for the panic runtime)
 - #141608 (Add support for repetition to `proc_macro::quote`)
 - #141864 (Handle win32 separator for cygwin paths)
 - #142216 (Miscellaneous RefCell cleanups)
 - #142517 (Windows: Use anonymous pipes in Command)
 - #142570 (Reject union default field values)
 - #142584 (Handle same-crate macro for borrowck semicolon suggestion)
 - #142585 (Update books)
 - #142586 (Fold unnecessary `visit_struct_field_def` in AstValidator)
 - #142595 (Revert overeager warning for misuse of `--print native-static-libs`)
 - #142598 (Set elf e_flags on ppc64 targets according to abi)

r? `@ghost`
`@rustbot` modify labels: rollup
workingjubilee added a commit to workingjubilee/rustc that referenced this pull request Jun 17, 2025
…sleywiser,ibraheemdev

Reduce special casing for the panic runtime

See the individual commits for more info.
@workingjubilee
Copy link
Member

vibes-based judgement:
@bors rollup=iffy

@bors
Copy link
Collaborator

bors commented Jun 17, 2025

⌛ Testing commit 6df5456 with merge 242d148...

bors added a commit that referenced this pull request Jun 17, 2025
…braheemdev

Reduce special casing for the panic runtime

See the individual commits for more info.
@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Collaborator

bors commented Jun 17, 2025

💔 Test failed - checks-actions

@bors bors 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 Jun 17, 2025
@bjorn3
Copy link
Member Author

bjorn3 commented Jun 17, 2025

I think LTO is causing the #[rustc_std_internal_symbol] functions to be internalized, making it impossible to reference them from symbols.o. I suspect the same would already happen for non-public #[thread_local] statics on Windows because of the thread local shim.

@bjorn3
Copy link
Member Author

bjorn3 commented Jun 17, 2025

@bors2 try jobs=x86_64-msvc-1,x86_64-msvc-2

@rust-bors
Copy link

rust-bors bot commented Jun 17, 2025

⌛ Trying commit 6e801de with merge dd3c68b

To cancel the try build, run the command @bors2 try cancel.

rust-bors bot added a commit that referenced this pull request Jun 17, 2025
Reduce special casing for the panic runtime

See the individual commits for more info.
try-job: x86_64-msvc-1
try-job: x86_64-msvc-2
@rust-log-analyzer

This comment has been minimized.

@bjorn3 bjorn3 force-pushed the panic_runtime_cleanup branch from 6e801de to 2489701 Compare June 17, 2025 17:04
@bjorn3
Copy link
Member Author

bjorn3 commented Jun 17, 2025

@bors2 try cancel
@bors2 try jobs=x86_64-msvc-1,x86_64-msvc-2

@rust-bors
Copy link

rust-bors bot commented Jun 17, 2025

Try build cancelled. Cancelled workflows:

@rust-bors
Copy link

rust-bors bot commented Jun 17, 2025

⌛ Trying commit 2489701 with merge a21c332

To cancel the try build, run the command @bors2 try cancel.

rust-bors bot added a commit that referenced this pull request Jun 17, 2025
Reduce special casing for the panic runtime

See the individual commits for more info.
try-job: x86_64-msvc-1
try-job: x86_64-msvc-2
@rust-bors
Copy link

rust-bors bot commented Jun 17, 2025

💔 Test failed

@rustbot rustbot added the A-run-make Area: port run-make Makefiles to rmake.rs label Jun 17, 2025
@rustbot
Copy link
Collaborator

rustbot commented Jun 17, 2025

This PR modifies run-make tests.

cc @jieyouxu

@bjorn3
Copy link
Member Author

bjorn3 commented Jun 17, 2025

Updated the test that unstably includes the panic_unwind panic runtime without libstd to use #[rustc_std_internal_symbol] for the symbols that panic_unwind needs.

@bors2 try jobs=x86_64-msvc-1,x86_64-msvc-2

@rust-bors
Copy link

rust-bors bot commented Jun 17, 2025

⌛ Trying commit b46f424 with merge dec7734

To cancel the try build, run the command @bors2 try cancel.

rust-bors bot added a commit that referenced this pull request Jun 17, 2025
Reduce special casing for the panic runtime

See the individual commits for more info.
try-job: x86_64-msvc-1
try-job: x86_64-msvc-2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-run-make Area: port run-make Makefiles to rmake.rs 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. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants