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

Implement the `panic` profile option #2687

Merged
merged 1 commit into from May 21, 2016

Conversation

Projects
None yet
8 participants
@alexcrichton
Member

alexcrichton commented May 13, 2016

This is the Cargo half of the implementation of RFC 1513 which adds a new
profile.*.panic option to customize the -C panic argument to the compiler.
This is not passed by default and can otherwise be specified as abort or
unwind on the nightly compiler.

The profile.*.panic option is only used from the top-level crate, not each
crate individually. This means that applications should customize this value as
they see fit, and libraries will only use their own value when they're being
tested.

Cargo also has specific knowledge that when testing a crate it can't pass
-C panic=abort for now as the default test harness requires panic=unwind.
This essentially just means that cargo test will continue to work for crates
that specify panic=abort in Cargo.toml.

@alexcrichton

This comment has been minimized.

Member

alexcrichton commented May 13, 2016

r? @brson

@rust-highfive

This comment has been minimized.

rust-highfive commented May 13, 2016

r? @wycats

(rust_highfive has picked a reviewer for you, use r? to override)

@steveklabnik

This comment has been minimized.

Member

steveklabnik commented May 15, 2016

Any chance we can get this merged sometime soon? Eagerly awaiting 😄

@bors

This comment has been minimized.

Contributor

bors commented May 17, 2016

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

@alexcrichton alexcrichton force-pushed the alexcrichton:panic-abort branch from 95ec901 to b6e0fe9 May 18, 2016

@wycats

This comment has been minimized.

Contributor

wycats commented May 20, 2016

@bors r+

@bors

This comment has been minimized.

Contributor

bors commented May 20, 2016

📌 Commit b6e0fe9 has been approved by wycats

@bors

This comment has been minimized.

Contributor

bors commented May 20, 2016

⌛️ Testing commit b6e0fe9 with merge aaea05d...

bors added a commit that referenced this pull request May 20, 2016

Auto merge of #2687 - alexcrichton:panic-abort, r=wycats
Implement the `panic` profile option

This is the Cargo half of the implementation of [RFC 1513] which adds a new
`profile.*.panic` option to customize the `-C panic` argument to the compiler.
This is not passed by default and can otherwise be specified as `abort` or
`unwind` on the nightly compiler.

[RFC 1513]: rust-lang/rfcs#1513

The `profile.*.panic` option is *only* used from the top-level crate, not each
crate individually. This means that applications should customize this value as
they see fit, and libraries will only use their own value when they're being
tested.

Cargo also has specific knowledge that when *testing* a crate it can't pass
`-C panic=abort` for now as the default test harness requires `panic=unwind`.
This essentially just means that `cargo test` will continue to work for crates
that specify `panic=abort` in Cargo.toml.
@bors

This comment has been minimized.

Contributor

bors commented May 20, 2016

💔 Test failed - cargo-linux-64

Implement the `panic` profile option
This is the Cargo half of the implementation of [RFC 1513] which adds a new
`profile.*.panic` option to customize the `-C panic` argument to the compiler.
This is not passed by default and can otherwise be specified as `abort` or
`unwind` on the nightly compiler.

[RFC 1513]: rust-lang/rfcs#1513

The `profile.*.panic` option is *only* used from the top-level crate, not each
crate individually. This means that applications should customize this value as
they see fit, and libraries will only use their own value when they're being
tested.

Cargo also has specific knowledge that when *testing* a crate it can't pass
`-C panic=abort` for now as the default test harness requires `panic=unwind`.
This essentially just means that `cargo test` will continue to work for crates
that specify `panic=abort` in Cargo.toml.

@alexcrichton alexcrichton force-pushed the alexcrichton:panic-abort branch from b6e0fe9 to 75848a2 May 20, 2016

@alexcrichton

This comment has been minimized.

Member

alexcrichton commented May 20, 2016

@bors: r=wycats

@bors

This comment has been minimized.

Contributor

bors commented May 20, 2016

📌 Commit 75848a2 has been approved by wycats

@bors

This comment has been minimized.

Contributor

bors commented May 21, 2016

⌛️ Testing commit 75848a2 with merge 259324c...

bors added a commit that referenced this pull request May 21, 2016

Auto merge of #2687 - alexcrichton:panic-abort, r=wycats
Implement the `panic` profile option

This is the Cargo half of the implementation of [RFC 1513] which adds a new
`profile.*.panic` option to customize the `-C panic` argument to the compiler.
This is not passed by default and can otherwise be specified as `abort` or
`unwind` on the nightly compiler.

[RFC 1513]: rust-lang/rfcs#1513

The `profile.*.panic` option is *only* used from the top-level crate, not each
crate individually. This means that applications should customize this value as
they see fit, and libraries will only use their own value when they're being
tested.

Cargo also has specific knowledge that when *testing* a crate it can't pass
`-C panic=abort` for now as the default test harness requires `panic=unwind`.
This essentially just means that `cargo test` will continue to work for crates
that specify `panic=abort` in Cargo.toml.
@bors

This comment has been minimized.

@bors bors merged commit 75848a2 into rust-lang:master May 21, 2016

2 of 3 checks passed

continuous-integration/appveyor/pr Waiting for AppVeyor build to complete
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details
@alexbool

This comment has been minimized.

alexbool commented May 22, 2016

Seems like there's a bug in your implementation.
When I build my crate with

[profile.dev]
panic = "abort"

I get an error if my crate depends on any crate that builds using a build.rs.
The failure looks as following:

$ cargo build --release --verbose
...
   Compiling kernel32-sys v0.2.2
     Running `rustc /Users/alexbool/.cargo/registry/src/github.com-1ecc6299db9ec823/kernel32-sys-0.2.2/build.rs --crate-name build_script_build --crate-type bin -g --out-dir /Users/alexbool/Documents/IdeaProjects/rust/mycrate/target/release/build/kernel32-sys-d6afa5bd3d7cfaef --emit=dep-info,link -L dependency=/Users/alexbool/Documents/IdeaProjects/rust/mycrate/target/release/deps -L dependency=/Users/alexbool/Documents/IdeaProjects/rust/mycrate/target/release/deps --extern build=/Users/alexbool/Documents/IdeaProjects/rust/mycrate/target/release/deps/libbuild-493a7b0628804707.rlib --cap-lints allow`
error: the crate `build` is compiled with the panic strategy `abort` which is incompatible with this crate's strategy of `unwind`
error: aborting due to previous error
Build failed, waiting for other jobs to finish...
error: Could not compile `kernel32-sys`.

@alexcrichton alexcrichton deleted the alexcrichton:panic-abort branch May 22, 2016

@alexcrichton

This comment has been minimized.

Member

alexcrichton commented May 22, 2016

Thanks for the report @alexbool! I unfortunately can't seem to reproduce easily, could you open an issue with some instructions about how to reproduce as well?

@tomaka

This comment has been minimized.

Contributor

tomaka commented May 22, 2016

@alexcrichton I didn't test a lot, but I think the issue appears when you have a different value for panic for the dev and release profiles.

@alexbool

This comment has been minimized.

alexbool commented May 22, 2016

@alexcrichton the issue is #2726 :)

@alexcrichton

This comment has been minimized.

Member

alexcrichton commented May 23, 2016

Thanks!

@ozkriff ozkriff referenced this pull request May 30, 2016

Open

Check panic="abort" #18

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment