From: raph Date: Wed, 29 Mar 2017 13:59:22 +0000 (+0200) Subject: Add example to std::process::abort X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;h=022bae8a4a9254fbdb4217e86927809f0ad996d6;p=rust.git Add example to std::process::abort --- diff --git a/src/libstd/process.rs b/src/libstd/process.rs index d46cf7a26da..32b52d1f77a 100644 --- a/src/libstd/process.rs +++ b/src/libstd/process.rs @@ -1056,6 +1056,19 @@ pub fn exit(code: i32) -> ! { /// will be run. If a clean shutdown is needed it is recommended to only call /// this function at a known point where there are no more destructors left /// to run. +/// +/// # Examples +/// ``` +/// use std::process; +/// +/// fn main() { +/// println!("aborting"); +/// +/// process::abort(); +/// +/// // execution never gets here +/// } +/// ``` #[stable(feature = "process_abort", since = "1.17.0")] pub fn abort() -> ! { unsafe { ::sys::abort_internal() };