Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/attributes/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ fn mytest() {

The `cfg_panic` feature makes it possible to exercise different lines of code depending on the panic strategy.
The possible value is either `unwind` or `abort`.
Copy link
Member

Choose a reason for hiding this comment

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

Should this say make clear that code compiled with #[cfg(panic = "unwind")] being true may still aborting on panic if any crate is compiled with -Cpanic=abort?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a good thing to point out. Note, I'm not as familiar with crates so i don't know too much about this but I'll take your word for it.

I updated the file, let me know what you think :)


The following is a playful example on choosing the right beverage.

```rust
Expand Down Expand Up @@ -124,6 +125,9 @@ fn main() {
}
```

Note that when the code is compiled with a certain panic strategy it still might do something different if a crate was compiled with a different strategy.
For instance, if `#[cfg(panic = "unwind")]` is set to `true` and a crate is compiled with`-C panic=abort`.

[_MetaListNameValueStr_]: ../attributes.md#meta-item-attribute-syntax
[_MetaNameValueStr_]: ../attributes.md#meta-item-attribute-syntax
[`Termination`]: ../../std/process/trait.Termination.html
Expand Down