mirror of
https://github.com/sunface/rust-by-practice.git
synced 2025-08-12 06:24:44 +00:00
@@ -1,7 +1,7 @@
|
||||
# panic!
|
||||
The simplest error handling mechanism is to use `panic`. It just prints an error message and starts unwinding the stack, finally exit the current thread:
|
||||
|
||||
- if panic occured in `main` thread, then the program will be exited.
|
||||
- if panic occurred in `main` thread, then the program will be exited.
|
||||
- if in spawned thread, then this thread will be terminated, but the program won't
|
||||
|
||||
|
||||
@@ -16,13 +16,13 @@ fn drink(beverage: &str) {
|
||||
__
|
||||
}
|
||||
|
||||
println!("Excercise Failed if printing out this line!");
|
||||
println!("Exercise Failed if printing out this line!");
|
||||
}
|
||||
|
||||
fn main() {
|
||||
drink(__);
|
||||
|
||||
println!("Excercise Failed if printing out this line!");
|
||||
println!("Exercise Failed if printing out this line!");
|
||||
}
|
||||
```
|
||||
|
||||
|
Reference in New Issue
Block a user