Skip to content

Commit 022bae8

Browse files
authored
Add example to std::process::abort
1 parent abf5592 commit 022bae8

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/libstd/process.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1056,6 +1056,19 @@ pub fn exit(code: i32) -> ! {
10561056
/// will be run. If a clean shutdown is needed it is recommended to only call
10571057
/// this function at a known point where there are no more destructors left
10581058
/// to run.
1059+
///
1060+
/// # Examples
1061+
/// ```
1062+
/// use std::process;
1063+
///
1064+
/// fn main() {
1065+
/// println!("aborting");
1066+
///
1067+
/// process::abort();
1068+
///
1069+
/// // execution never gets here
1070+
/// }
1071+
/// ```
10591072
#[stable(feature = "process_abort", since = "1.17.0")]
10601073
pub fn abort() -> ! {
10611074
unsafe { ::sys::abort_internal() };

0 commit comments

Comments
 (0)