You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/error/abort_unwind.md
+5-5
Original file line number
Diff line number
Diff line change
@@ -1,11 +1,11 @@
1
1
# `abort` and `unwind`
2
2
3
-
The previous section illustrates the error handling mechanism `panic`. The `cfg_panic` feature makes it possible to execute different code depending on the panic strategy. The current values available are `unwind` and `abort`.
3
+
The previous section illustrates the error handling mechanism `panic`. Different code paths can be conditionally compiled based on the panic setting. The current values available are `unwind` and `abort`.
4
4
5
5
6
6
Building on the prior lemonade example, we explicitly use the panic strategy to execise different lines of code.
7
7
8
-
```rust,editable,ignore,mdbook-runnable
8
+
```rust,editable,mdbook-runnable
9
9
10
10
fn drink(beverage: &str) {
11
11
// You shouldn't drink too much sugary beverages.
@@ -24,7 +24,7 @@ fn main() {
24
24
25
25
Here is another example focusing on rewriting `drink()` and explicitly use the `unwind` keyword.
26
26
27
-
```rust,editable,ignore
27
+
```rust,editable
28
28
29
29
#[cfg(panic = "unwind")]
30
30
fn ah(){ println!("Spit it out!!!!");}
@@ -45,7 +45,7 @@ fn main() {
45
45
46
46
The panic strategy can be set from the command line by using `abort` or `unwind`.
0 commit comments