You've already forked comprehensive-rust
mirror of
https://github.com/google/comprehensive-rust.git
synced 2025-06-18 07:07:35 +02:00
Fix example to build and run (#838)
This commit is contained in:
@ -5,6 +5,7 @@ By default, a panic will cause the stack to unwind. The unwinding can be caught:
|
|||||||
```rust,editable
|
```rust,editable
|
||||||
use std::panic;
|
use std::panic;
|
||||||
|
|
||||||
|
fn main() {
|
||||||
let result = panic::catch_unwind(|| {
|
let result = panic::catch_unwind(|| {
|
||||||
println!("hello!");
|
println!("hello!");
|
||||||
});
|
});
|
||||||
@ -14,6 +15,7 @@ let result = panic::catch_unwind(|| {
|
|||||||
panic!("oh no!");
|
panic!("oh no!");
|
||||||
});
|
});
|
||||||
assert!(result.is_err());
|
assert!(result.is_err());
|
||||||
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
* This can be useful in servers which should keep running even if a single
|
* This can be useful in servers which should keep running even if a single
|
||||||
|
Reference in New Issue
Block a user