about summary refs log tree commit diff
diff options
context:
space:
mode:
authorCorey Farwell <coreyf@rwell.org>2017-03-31 11:43:35 -0400
committerGitHub <noreply@github.com>2017-03-31 11:43:35 -0400
commitfe34818606f4fd516b71bd04d7b31d54838e3c28 (patch)
treece64b3255877e78a549465f769cd78b50544e4b6
parent5f1bb8f2d031aeb90060923fd0f387cc2a76b224 (diff)
parent1be84cee75687856c0032ad0fd5ea96945c067b7 (diff)
downloadrust-fe34818606f4fd516b71bd04d7b31d54838e3c28.tar.gz
rust-fe34818606f4fd516b71bd04d7b31d54838e3c28.zip
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).
-rw-r--r--src/libstd/process.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/libstd/process.rs b/src/libstd/process.rs
index d46cf7a26da..7f1a00c707c 100644
--- a/src/libstd/process.rs
+++ b/src/libstd/process.rs
@@ -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() };