Support rustc's -Z panic-abort-tests in Cargo by alexcrichton · Pull Request #7460 · rust-lang/cargo (original) (raw)

Sorry for the delay, back now though!

I hadn't though too too much about stabilizing this option honestly, I just wanted to make sure we at least tried to prove it out in Cargo before we stabilize it in rustc to make sure it works. I suspect the stabilization here will be pretty tricky and it probably won't end up looking like this PR in the long run.

I'm not certain that Cargo would correctly handle different configurations of tests today. For example if you configure dev to panic=abort and test to panic=unwind I think that does that it says on the tin and then trivially causes a compilation error since you can't mix them.

I think the best way we'll want to implement this is long-term we just ignore the test profile panic configuration, reading whatever dev or release is. I don't think there's any use case to building only tests in panic=abort, and otherwise panic=abort forces everything to be such and panic=unwind is the default anyway.

The biggest thing I'm worried about is if we've accidentally conditioned users the wrong way, but I had forgotten about this warning. Given that we've always warned we can probably reasonly assume no one has panic configuration for tests, and I think that means we just need to probably keep ignoring panic configuration for tests?

Ok that's a bit rambly, but how about:

And... I think that'd do it?