Merge branch 'master' into frewsxcv-dyn

This commit is contained in:
Corey Farwell
2018-11-23 14:09:08 -05:00
committed by GitHub
204 changed files with 2037 additions and 1221 deletions

View File

@@ -2026,12 +2026,12 @@ impl<'a, K, V, S> RawEntryMut<'a, K, V, S> {
/// use std::collections::HashMap;
///
/// let mut map: HashMap<&str, u32> = HashMap::new();
/// map.raw_entry_mut().from_key("poneyland").or_insert("poneyland", 12);
///
/// assert_eq!(map["poneyland"], 12);
/// map.raw_entry_mut().from_key("poneyland").or_insert("poneyland", 3);
/// assert_eq!(map["poneyland"], 3);
///
/// *map.raw_entry_mut().from_key("poneyland").or_insert("poneyland", 12).1 += 10;
/// assert_eq!(map["poneyland"], 22);
/// *map.raw_entry_mut().from_key("poneyland").or_insert("poneyland", 10).1 *= 2;
/// assert_eq!(map["poneyland"], 6);
/// ```
#[unstable(feature = "hash_raw_entry", issue = "54043")]
pub fn or_insert(self, default_key: K, default_val: V) -> (&'a mut K, &'a mut V)
@@ -2648,12 +2648,12 @@ impl<'a, K, V> Entry<'a, K, V> {
/// use std::collections::HashMap;
///
/// let mut map: HashMap<&str, u32> = HashMap::new();
/// map.entry("poneyland").or_insert(12);
///
/// assert_eq!(map["poneyland"], 12);
/// map.entry("poneyland").or_insert(3);
/// assert_eq!(map["poneyland"], 3);
///
/// *map.entry("poneyland").or_insert(12) += 10;
/// assert_eq!(map["poneyland"], 22);
/// *map.entry("poneyland").or_insert(10) *= 2;
/// assert_eq!(map["poneyland"], 6);
/// ```
pub fn or_insert(self, default: V) -> &'a mut V {
match self {

View File

@@ -185,7 +185,7 @@
//! [slice]: primitive.slice.html
//! [`atomic`]: sync/atomic/index.html
//! [`collections`]: collections/index.html
//! [`for`]: ../book/first-edition/loops.html#for
//! [`for`]: ../book/ch03-05-control-flow.html#looping-through-a-collection-with-for
//! [`format!`]: macro.format.html
//! [`fs`]: fs/index.html
//! [`io`]: io/index.html
@@ -200,14 +200,14 @@
//! [`sync`]: sync/index.html
//! [`thread`]: thread/index.html
//! [`use std::env`]: env/index.html
//! [`use`]: ../book/first-edition/crates-and-modules.html#importing-modules-with-use
//! [crate root]: ../book/first-edition/crates-and-modules.html#basic-terminology-crates-and-modules
//! [`use`]: ../book/ch07-02-modules-and-use-to-control-scope-and-privacy.html#the-use-keyword-to-bring-paths-into-a-scope
//! [crate root]: ../book/ch07-01-packages-and-crates-for-making-libraries-and-executables.html
//! [crates.io]: https://crates.io
//! [deref-coercions]: ../book/second-edition/ch15-02-deref.html#implicit-deref-coercions-with-functions-and-methods
//! [deref-coercions]: ../book/ch15-02-deref.html#implicit-deref-coercions-with-functions-and-methods
//! [files]: fs/struct.File.html
//! [multithreading]: thread/index.html
//! [other]: #what-is-in-the-standard-library-documentation
//! [primitive types]: ../book/first-edition/primitive-types.html
//! [primitive types]: ../book/ch03-02-data-types.html
#![stable(feature = "rust1", since = "1.0.0")]
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",

View File

@@ -32,7 +32,7 @@
///
/// [`Result`] enum is often a better solution for recovering from errors than
/// using the `panic!` macro. This macro should be used to avoid proceeding using
/// incorrect values, such as from external sources. Detailed information about
/// incorrect values, such as from external sources. Detailed information about
/// error handling is found in the [book].
///
/// The multi-argument form of this macro panics with a string and has the
@@ -45,7 +45,7 @@
/// [`Result`]: ../std/result/enum.Result.html
/// [`format!`]: ../std/macro.format.html
/// [`compile_error!`]: ../std/macro.compile_error.html
/// [book]: ../book/second-edition/ch09-01-unrecoverable-errors-with-panic.html
/// [book]: ../book/ch09-00-error-handling.html
///
/// # Current implementation
///
@@ -839,8 +839,8 @@ mod builtin {
/// boolean expression evaluation of configuration flags. This frequently
/// leads to less duplicated code.
///
/// The syntax given to this macro is the same syntax as [the `cfg`
/// attribute](../book/first-edition/conditional-compilation.html).
/// The syntax given to this macro is the same syntax as the `cfg`
/// attribute.
///
/// # Examples
///
@@ -915,7 +915,7 @@ mod builtin {
/// Unsafe code relies on `assert!` to enforce run-time invariants that, if
/// violated could lead to unsafety.
///
/// Other use-cases of `assert!` include [testing] and enforcing run-time
/// Other use-cases of `assert!` include testing and enforcing run-time
/// invariants in safe code (whose violation cannot result in unsafety).
///
/// # Custom Messages
@@ -926,7 +926,6 @@ mod builtin {
///
/// [`panic!`]: macro.panic.html
/// [`debug_assert!`]: macro.debug_assert.html
/// [testing]: ../book/second-edition/ch11-01-writing-tests.html#checking-results-with-the-assert-macro
/// [`std::fmt`]: ../std/fmt/index.html
///
/// # Examples

View File

@@ -22,7 +22,7 @@
/// `bool` implements various traits, such as [`BitAnd`], [`BitOr`], [`Not`], etc.,
/// which allow us to perform boolean operations using `&`, `|` and `!`.
///
/// [`if`] always demands a `bool` value. [`assert!`], being an important macro in testing,
/// `if` always demands a `bool` value. [`assert!`], being an important macro in testing,
/// checks whether an expression returns `true`.
///
/// ```
@@ -31,7 +31,6 @@
/// ```
///
/// [`assert!`]: macro.assert.html
/// [`if`]: ../book/first-edition/if.html
/// [`BitAnd`]: ops/trait.BitAnd.html
/// [`BitOr`]: ops/trait.BitOr.html
/// [`Not`]: ops/trait.Not.html
@@ -695,7 +694,7 @@ mod prim_str { }
/// assert_eq!(tuple.2, 'c');
/// ```
///
/// For more about tuples, see [the book](../book/first-edition/primitive-types.html#tuples).
/// For more about tuples, see [the book](../book/ch03-02-data-types.html#the-tuple-type).
///
/// # Trait implementations
///