about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2018-08-12 21:52:22 +0000
committerbors <bors@rust-lang.org>2018-08-12 21:52:22 +0000
commit5a0d2961ce88f7db90b13771d1e8fc3b50ded7b1 (patch)
treeced0be3c60e37e3c4dd697e2a9da8148c48fddc1 /src/libstd
parent0aa8d0320266b5579428312095fe49af05ada972 (diff)
parent3959dca205003ecc4f3f7b3f4ad26eec33a6bdf8 (diff)
downloadrust-5a0d2961ce88f7db90b13771d1e8fc3b50ded7b1.tar.gz
rust-5a0d2961ce88f7db90b13771d1e8fc3b50ded7b1.zip
Auto merge of #53297 - GuillaumeGomez:rollup, r=GuillaumeGomez
Rollup of 15 pull requests

Successful merges:

 - #52955 (Update compiler test documentation)
 - #53019 (Don't collect() when size_hint is useless)
 - #53025 (Consider changing assert! to debug_assert! when it calls visit_with)
 - #53059 (Remove explicit returns where unnecessary)
 - #53165 ( Add aarch64-unknown-netbsd target)
 - #53210 (Deny future duplication of rustc-ap-syntax)
 - #53223 (A few cleanups for rustc_data_structures)
 - #53230 ([nll] enable feature(nll) on various crates for bootstrap: part 4)
 - #53231 (Add let keyword doc)
 - #53240 (Add individual documentation for <integer>`.swap_bytes`/.`reverse_bits`)
 - #53253 (Remove unwanted console log)
 - #53264 (Show that Command can be reused and remodified)
 - #53267 (Fix styles)
 - #53273 (Add links to std::char::REPLACEMENT_CHARACTER from docs.)
 - #53283 (wherein we suggest float for integer literals where a float was expected)

Failed merges:

r? @ghost
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/ffi/c_str.rs7
-rw-r--r--src/libstd/ffi/os_str.rs4
-rw-r--r--src/libstd/keyword_docs.rs32
-rw-r--r--src/libstd/lib.rs1
-rw-r--r--src/libstd/os/raw/mod.rs6
-rw-r--r--src/libstd/path.rs4
-rw-r--r--src/libstd/process.rs33
-rw-r--r--src/libstd/sys/windows/ext/ffi.rs3
8 files changed, 81 insertions, 9 deletions
diff --git a/src/libstd/ffi/c_str.rs b/src/libstd/ffi/c_str.rs
index b2777f5c485..2b87094926c 100644
--- a/src/libstd/ffi/c_str.rs
+++ b/src/libstd/ffi/c_str.rs
@@ -1175,9 +1175,9 @@ impl CStr {
     /// If the contents of the `CStr` are valid UTF-8 data, this
     /// function will return a [`Cow`]`::`[`Borrowed`]`(`[`&str`]`)`
     /// with the the corresponding [`&str`] slice. Otherwise, it will
-    /// replace any invalid UTF-8 sequences with `U+FFFD REPLACEMENT
-    /// CHARACTER` and return a [`Cow`]`::`[`Owned`]`(`[`String`]`)`
-    /// with the result.
+    /// replace any invalid UTF-8 sequences with
+    /// [`U+FFFD REPLACEMENT CHARACTER`][U+FFFD] and return a
+    /// [`Cow`]`::`[`Owned`]`(`[`String`]`)` with the result.
     ///
     /// > **Note**: This method is currently implemented to check for validity
     /// > after a constant-time cast, but it is planned to alter its definition
@@ -1189,6 +1189,7 @@ impl CStr {
     /// [`Owned`]: ../borrow/enum.Cow.html#variant.Owned
     /// [`str`]: ../primitive.str.html
     /// [`String`]: ../string/struct.String.html
+    /// [U+FFFD]: ../char/constant.REPLACEMENT_CHARACTER.html
     ///
     /// # Examples
     ///
diff --git a/src/libstd/ffi/os_str.rs b/src/libstd/ffi/os_str.rs
index 9e501a84e05..6bcd62dbd59 100644
--- a/src/libstd/ffi/os_str.rs
+++ b/src/libstd/ffi/os_str.rs
@@ -520,10 +520,12 @@ impl OsStr {
 
     /// Converts an `OsStr` to a [`Cow`]`<`[`str`]`>`.
     ///
-    /// Any non-Unicode sequences are replaced with U+FFFD REPLACEMENT CHARACTER.
+    /// Any non-Unicode sequences are replaced with
+    /// [`U+FFFD REPLACEMENT CHARACTER`][U+FFFD].
     ///
     /// [`Cow`]: ../../std/borrow/enum.Cow.html
     /// [`str`]: ../../std/primitive.str.html
+    /// [U+FFFD]: ../../std/char/constant.REPLACEMENT_CHARACTER.html
     ///
     /// # Examples
     ///
diff --git a/src/libstd/keyword_docs.rs b/src/libstd/keyword_docs.rs
index 01bd3edaee9..4f6bda6cfe3 100644
--- a/src/libstd/keyword_docs.rs
+++ b/src/libstd/keyword_docs.rs
@@ -1,4 +1,4 @@
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
 // file at the top-level directory of this distribution and at
 // http://rust-lang.org/COPYRIGHT.
 //
@@ -26,3 +26,33 @@
 ///
 /// [book]: https://doc.rust-lang.org/book/second-edition/ch03-03-how-functions-work.html
 mod fn_keyword { }
+
+#[doc(keyword = "let")]
+//
+/// The `let` keyword.
+///
+/// The `let` keyword is used to declare a variable.
+///
+/// Example:
+///
+/// ```rust
+/// # #![allow(unused_assignments)]
+/// let x = 3; // We create a variable named `x` with the value `3`.
+/// ```
+///
+/// By default, all variables are **not** mutable. If you want a mutable variable,
+/// you'll have to use the `mut` keyword.
+///
+/// Example:
+///
+/// ```rust
+/// # #![allow(unused_assignments)]
+/// let mut x = 3; // We create a mutable variable named `x` with the value `3`.
+///
+/// x += 4; // `x` is now equal to `7`.
+/// ```
+///
+/// For more information about the `let` keyword, take a look at the [Rust Book][book].
+///
+/// [book]: https://doc.rust-lang.org/book/second-edition/ch03-01-variables-and-mutability.html
+mod let_keyword { }
diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs
index 0bc968b6c5c..5d463225ae9 100644
--- a/src/libstd/lib.rs
+++ b/src/libstd/lib.rs
@@ -273,6 +273,7 @@
 #![feature(macro_vis_matcher)]
 #![feature(needs_panic_runtime)]
 #![feature(never_type)]
+#![cfg_attr(not(stage0), feature(nll))]
 #![feature(exhaustive_patterns)]
 #![feature(on_unimplemented)]
 #![feature(optin_builtin_traits)]
diff --git a/src/libstd/os/raw/mod.rs b/src/libstd/os/raw/mod.rs
index 4b8dda493b0..dc33747c05b 100644
--- a/src/libstd/os/raw/mod.rs
+++ b/src/libstd/os/raw/mod.rs
@@ -29,7 +29,8 @@ use fmt;
           all(target_os = "android", any(target_arch = "aarch64",
                                          target_arch = "arm")),
           all(target_os = "l4re", target_arch = "x86_64"),
-          all(target_os = "netbsd", any(target_arch = "arm",
+          all(target_os = "netbsd", any(target_arch = "aarch64",
+                                        target_arch = "arm",
                                         target_arch = "powerpc")),
           all(target_os = "openbsd", target_arch = "aarch64"),
           all(target_os = "fuchsia", target_arch = "aarch64")))]
@@ -43,7 +44,8 @@ use fmt;
               all(target_os = "android", any(target_arch = "aarch64",
                                              target_arch = "arm")),
               all(target_os = "l4re", target_arch = "x86_64"),
-              all(target_os = "netbsd", any(target_arch = "arm",
+              all(target_os = "netbsd", any(target_arch = "aarch64",
+                                            target_arch = "arm",
                                             target_arch = "powerpc")),
               all(target_os = "openbsd", target_arch = "aarch64"),
               all(target_os = "fuchsia", target_arch = "aarch64"))))]
diff --git a/src/libstd/path.rs b/src/libstd/path.rs
index 688a7e99f10..ca8be75fab5 100644
--- a/src/libstd/path.rs
+++ b/src/libstd/path.rs
@@ -1737,9 +1737,11 @@ impl Path {
 
     /// Converts a `Path` to a [`Cow<str>`].
     ///
-    /// Any non-Unicode sequences are replaced with U+FFFD REPLACEMENT CHARACTER.
+    /// Any non-Unicode sequences are replaced with
+    /// [`U+FFFD REPLACEMENT CHARACTER`][U+FFFD].
     ///
     /// [`Cow<str>`]: ../borrow/enum.Cow.html
+    /// [U+FFFD]: ../char/constant.REPLACEMENT_CHARACTER.html
     ///
     /// # Examples
     ///
diff --git a/src/libstd/process.rs b/src/libstd/process.rs
index 39692836866..53babd449a9 100644
--- a/src/libstd/process.rs
+++ b/src/libstd/process.rs
@@ -381,6 +381,39 @@ impl fmt::Debug for ChildStderr {
 ///
 /// let hello = output.stdout;
 /// ```
+///
+/// `Command` can be reused to spawn multiple processes. The builder methods
+/// change the command without needing to immediately spawn the process.
+///
+/// ```no_run
+/// use std::process::Command;
+///
+/// let mut echo_hello = Command::new("sh");
+/// echo_hello.arg("-c")
+///           .arg("echo hello");
+/// let hello_1 = echo_hello.output().expect("failed to execute process");
+/// let hello_2 = echo_hello.output().expect("failed to execute process");
+/// ```
+///
+/// Similarly, you can call builder methods after spawning a process and then
+/// spawn a new process with the modified settings.
+///
+/// ```no_run
+/// use std::process::Command;
+///
+/// let mut list_dir = Command::new("ls");
+///
+/// // Execute `ls` in the current directory of the program.
+/// list_dir.status().expect("process failed to execute");
+///
+/// println!("");
+///
+/// // Change `ls` to execute in the root directory.
+/// list_dir.current_dir("/");
+///
+/// // And then execute `ls` again but in the root directory.
+/// list_dir.status().expect("process failed to execute");
+/// ```
 #[stable(feature = "process", since = "1.0.0")]
 pub struct Command {
     inner: imp::Command,
diff --git a/src/libstd/sys/windows/ext/ffi.rs b/src/libstd/sys/windows/ext/ffi.rs
index 98d43552489..bae0d02786a 100644
--- a/src/libstd/sys/windows/ext/ffi.rs
+++ b/src/libstd/sys/windows/ext/ffi.rs
@@ -31,7 +31,7 @@
 //!
 //! If Rust code *does* need to look into those strings, it can
 //! convert them to valid UTF-8, possibly lossily, by substituting
-//! invalid sequences with U+FFFD REPLACEMENT CHARACTER, as is
+//! invalid sequences with [`U+FFFD REPLACEMENT CHARACTER`][U+FFFD], as is
 //! conventionally done in other Rust APIs that deal with string
 //! encodings.
 //!
@@ -65,6 +65,7 @@
 //! [`from_wide`]: trait.OsStringExt.html#tymethod.from_wide
 //! [`encode_wide`]: trait.OsStrExt.html#tymethod.encode_wide
 //! [`collect`]: ../../../iter/trait.Iterator.html#method.collect
+//! [U+FFFD]: ../../../char/constant.REPLACEMENT_CHARACTER.html
 
 #![stable(feature = "rust1", since = "1.0.0")]