Rollup merge of #40904 - rap2hpoutre:patch-1, r=steveklabnik
Add example to std::process::abort This is a first step in order to complete this issue: https://github.com/rust-lang/rust/issues/29370 I submitted this PR with the help of @steveklabnik More info here: https://github.com/rust-lang/rust/issues/29370#issuecomment-290089330 It's my first PR on Rust, I'm learning how to contribute: Should I ping someone? I will post another PR with a more complicated example soon, I prefer send it separately (cause maybe I made some mistakes).
This commit is contained in:
commit
fe34818606
1 changed files with 14 additions and 0 deletions
|
|
@ -1056,6 +1056,20 @@ 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
|
||||
///
|
||||
/// ```no_run
|
||||
/// 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() };
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue