about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2017-03-31 23:23:49 +0000
committerbors <bors@rust-lang.org>2017-03-31 23:23:49 +0000
commit2f1652870f5900bc41610d808b8bc2d51c901192 (patch)
tree3bd9adab1026631921ab10fca0efe84dc67b53aa /src/libstd
parent40feadb966f825de7aa54a3138416c906b60f54a (diff)
parent54b3f6aa21818318c0cf9c6d7fc2e17d50bfe4d4 (diff)
downloadrust-2f1652870f5900bc41610d808b8bc2d51c901192.tar.gz
rust-2f1652870f5900bc41610d808b8bc2d51c901192.zip
Auto merge of #40972 - frewsxcv:rollup, r=frewsxcv
Rollup of 6 pull requests

- Successful merges: #40703, #40728, #40763, #40871, #40935, #40947
- Failed merges:
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/io/mod.rs12
-rw-r--r--src/libstd/primitive_docs.rs13
2 files changed, 21 insertions, 4 deletions
diff --git a/src/libstd/io/mod.rs b/src/libstd/io/mod.rs
index 5b628d51d15..8ebc5c0a8fe 100644
--- a/src/libstd/io/mod.rs
+++ b/src/libstd/io/mod.rs
@@ -145,6 +145,18 @@
 //! # }
 //! ```
 //!
+//! Note that you cannot use the `?` operator in functions that do not return
+//! a `Result<T, E>` (e.g. `main`). Instead, you can call `.unwrap()` or `match`
+//! on the return value to catch any possible errors:
+//!
+//! ```
+//! use std::io;
+//!
+//! let mut input = String::new();
+//!
+//! io::stdin().read_line(&mut input).unwrap();
+//! ```
+//!
 //! And a very common source of output is standard output:
 //!
 //! ```
diff --git a/src/libstd/primitive_docs.rs b/src/libstd/primitive_docs.rs
index c738dc94406..5b2053e929a 100644
--- a/src/libstd/primitive_docs.rs
+++ b/src/libstd/primitive_docs.rs
@@ -183,9 +183,9 @@ mod prim_unit { }
 /// Working with raw pointers in Rust is uncommon,
 /// typically limited to a few patterns.
 ///
-/// Use the `null` function to create null pointers, and the `is_null` method
+/// Use the [`null`] function to create null pointers, and the [`is_null`] method
 /// of the `*const T` type  to check for null. The `*const T` type also defines
-/// the `offset` method, for pointer math.
+/// the [`offset`] method, for pointer math.
 ///
 /// # Common ways to create raw pointers
 ///
@@ -213,7 +213,7 @@ mod prim_unit { }
 ///
 /// ## 2. Consume a box (`Box<T>`).
 ///
-/// The `into_raw` function consumes a box and returns
+/// The [`into_raw`] function consumes a box and returns
 /// the raw pointer. It doesn't destroy `T` or deallocate any memory.
 ///
 /// ```
@@ -227,7 +227,7 @@ mod prim_unit { }
 /// }
 /// ```
 ///
-/// Note that here the call to `drop` is for clarity - it indicates
+/// Note that here the call to [`drop`] is for clarity - it indicates
 /// that we are done with the given value and it should be destroyed.
 ///
 /// ## 3. Get it from C.
@@ -255,6 +255,11 @@ mod prim_unit { }
 ///
 /// *[See also the `std::ptr` module](ptr/index.html).*
 ///
+/// [`null`]: ../std/ptr/fn.null.html
+/// [`is_null`]: ../std/primitive.pointer.html#method.is_null
+/// [`offset`]: ../std/primitive.pointer.html#method.offset
+/// [`into_raw`]: ../std/boxed/struct.Box.html#method.into_raw
+/// [`drop`]: ../std/mem/fn.drop.html
 #[stable(feature = "rust1", since = "1.0.0")]
 mod prim_pointer { }