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

Documentation PR for cfg_panic #1157

Merged
merged 10 commits into from
Mar 15, 2022
Merged
Changes from all commits
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
16 changes: 16 additions & 0 deletions src/conditional-compilation.md
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,15 @@ production. For example, it controls the behavior of the standard library's
Set when the crate being compiled is being compiled with the `proc_macro`
[crate type].

### `panic`

Key-value option set depending on the panic strategy. Note that more values may be added in the future.

Example values:

* `"abort"`
* `"unwind"`

## Forms of conditional compilation

### The `cfg` attribute
Expand Down Expand Up @@ -253,6 +262,13 @@ fn on_32bit_unix() {
fn needs_not_foo() {
// ...
}

// This function is only included when the panic strategy is set to unwind
#[cfg(panic = "unwind")]
fn when_unwinding() {
// ...
}

```

The `cfg` attribute is allowed anywhere attributes are allowed.
Expand Down