Skip to content
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

support panic=abort #1549

Merged
merged 2 commits into from Sep 18, 2020
Merged

support panic=abort #1549

merged 2 commits into from Sep 18, 2020

Conversation

RalfJung
Copy link
Member

@RalfJung RalfJung commented Sep 18, 2020

This adds support for abort-on-panic (#1058). To achieve this, we insert cargo-miri as RUSTC when building the standard library, and patch the rustc flags in a way similar to what bootstrap does.

However, this is currently not supported on Windows as the Windows code uses inline assembly to cause an abort (?!?). I'll submit a rustc PR with some cffg(miri) to make that work. (EDIT: that would be rust-lang/rust#76871)

Cc @Aaron1011 r? @oli-obk

.expect("No panic runtime found!");
let panic_runtime = tcx.crate_name(*panic_runtime);
// This replicates some of the logic in `inject_panic_runtime`.
// FIXME: is there a way to reuse that logic?
Copy link
Contributor

Choose a reason for hiding this comment

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

we could have a start_panic_instance function on Session in rustc

Copy link
Member Author

@RalfJung RalfJung Sep 18, 2020

Choose a reason for hiding this comment

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

Or maybe we could somehow figure out "which crate that was added as a dependency is the panic runtime". I thought that's what the previous code was doing, but it still saw the panic_unwind crate even with -C panic=abort so clearly that was not the right approach.

src/shims/foreign_items.rs Outdated Show resolved Hide resolved
Co-authored-by: Oli Scherer <github35764891676564198441@oli-obk.de>
@RalfJung
Copy link
Member Author

@bors r=oli-obk

@bors
Copy link
Collaborator

bors commented Sep 18, 2020

📌 Commit 97a71c0 has been approved by oli-obk

@bors
Copy link
Collaborator

bors commented Sep 18, 2020

⌛ Testing commit 97a71c0 with merge 84a4514...

@bors
Copy link
Collaborator

bors commented Sep 18, 2020

☀️ Test successful - checks-travis, status-appveyor
Approved by: oli-obk
Pushing 84a4514 to master...

@bors bors merged commit 84a4514 into rust-lang:master Sep 18, 2020
@RalfJung RalfJung deleted the panic-abort branch September 18, 2020 17:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants