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
Prev Previous commit
Next Next commit
Added cfg panic to conditional-compilation section
  • Loading branch information
cchiw authored Mar 14, 2022
commit 14bb695ab22335e7232d99e562624529c895d0ef
13 changes: 13 additions & 0 deletions src/conditional-compilation.md
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,19 @@ 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() {
// ...
}

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

```

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