Skip to content

Commit 14bb695

Browse files
authored
Added cfg panic to conditional-compilation section
1 parent 09eadce commit 14bb695

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/conditional-compilation.md

+13
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,19 @@ fn on_32bit_unix() {
253253
fn needs_not_foo() {
254254
// ...
255255
}
256+
257+
// This function is only included when the panic strategy is set to unwind
258+
#[cfg(panic = "unwind")]
259+
fn when_unwinding() {
260+
// ...
261+
}
262+
263+
// This function is only included when the panic strategy is not set to unwind
264+
#[cfg(not(panic="unwind"))]
265+
fn when_aborting() {
266+
// ...
267+
}
268+
256269
```
257270

258271
The `cfg` attribute is allowed anywhere attributes are allowed.

0 commit comments

Comments
 (0)