about summary refs log tree commit diff
path: root/library/core/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-04-07 05:12:08 +0000
committerbors <bors@rust-lang.org>2022-04-07 05:12:08 +0000
commit8cd6080f6c778f6664ea3d12ca7848231707a627 (patch)
tree477e303a44d3cb21547f3f1062943cb9a121bb13 /library/core/src
parent846993ec43c615c64a0496d3eb3c8615830842e4 (diff)
parent939f84ab002b5eac22e1e98ada7344294926e652 (diff)
downloadrust-8cd6080f6c778f6664ea3d12ca7848231707a627.tar.gz
rust-8cd6080f6c778f6664ea3d12ca7848231707a627.zip
Auto merge of #95748 - Dylan-DPC:rollup-t208j51, r=Dylan-DPC
Rollup of 5 pull requests

Successful merges:

 - #95352 ([bootstrap] Print the full relative path to failed tests)
 - #95646 (Mention `std::env::var` in `env!`)
 - #95708 (Update documentation for `trim*` and `is_whitespace` to include newlines)
 - #95714 (Add test for issue #83474)
 - #95725 (Message: Chunks cannot have a size of zero.)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'library/core/src')
-rw-r--r--library/core/src/char/methods.rs3
-rw-r--r--library/core/src/macros/mod.rs10
-rw-r--r--library/core/src/slice/mod.rs4
-rw-r--r--library/core/src/str/mod.rs16
4 files changed, 21 insertions, 12 deletions
diff --git a/library/core/src/char/methods.rs b/library/core/src/char/methods.rs
index 3195205b1b6..6a8df7318cd 100644
--- a/library/core/src/char/methods.rs
+++ b/library/core/src/char/methods.rs
@@ -804,6 +804,9 @@ impl char {
     /// ```
     /// assert!(' '.is_whitespace());
     ///
+    /// // line break
+    /// assert!('\n'.is_whitespace());
+    ///
     /// // a non-breaking space
     /// assert!('\u{A0}'.is_whitespace());
     ///
diff --git a/library/core/src/macros/mod.rs b/library/core/src/macros/mod.rs
index 74c94680e47..83f33ca007a 100644
--- a/library/core/src/macros/mod.rs
+++ b/library/core/src/macros/mod.rs
@@ -909,7 +909,10 @@ pub(crate) mod builtin {
     /// Inspects an environment variable at compile time.
     ///
     /// This macro will expand to the value of the named environment variable at
-    /// compile time, yielding an expression of type `&'static str`.
+    /// compile time, yielding an expression of type `&'static str`. Use
+    /// [`std::env::var`] instead if you want to read the value at runtime.
+    ///
+    /// [`std::env::var`]: ../std/env/fn.var.html
     ///
     /// If the environment variable is not defined, then a compilation error
     /// will be emitted. To not emit a compile error, use the [`option_env!`]
@@ -950,7 +953,10 @@ pub(crate) mod builtin {
     /// expand into an expression of type `Option<&'static str>` whose value is
     /// `Some` of the value of the environment variable. If the environment
     /// variable is not present, then this will expand to `None`. See
-    /// [`Option<T>`][Option] for more information on this type.
+    /// [`Option<T>`][Option] for more information on this type.  Use
+    /// [`std::env::var`] instead if you want to read the value at runtime.
+    ///
+    /// [`std::env::var`]: ../std/env/fn.var.html
     ///
     /// A compile time error is never emitted when using this macro regardless
     /// of whether the environment variable is present or not.
diff --git a/library/core/src/slice/mod.rs b/library/core/src/slice/mod.rs
index 17f6373ecbf..78fad46e793 100644
--- a/library/core/src/slice/mod.rs
+++ b/library/core/src/slice/mod.rs
@@ -814,7 +814,7 @@ impl<T> [T] {
     #[stable(feature = "rust1", since = "1.0.0")]
     #[inline]
     pub fn chunks(&self, chunk_size: usize) -> Chunks<'_, T> {
-        assert_ne!(chunk_size, 0);
+        assert_ne!(chunk_size, 0, "chunks cannot have a size of zero");
         Chunks::new(self, chunk_size)
     }
 
@@ -852,7 +852,7 @@ impl<T> [T] {
     #[stable(feature = "rust1", since = "1.0.0")]
     #[inline]
     pub fn chunks_mut(&mut self, chunk_size: usize) -> ChunksMut<'_, T> {
-        assert_ne!(chunk_size, 0);
+        assert_ne!(chunk_size, 0, "chunks cannot have a size of zero");
         ChunksMut::new(self, chunk_size)
     }
 
diff --git a/library/core/src/str/mod.rs b/library/core/src/str/mod.rs
index 6bfa6a5e015..a1779b78623 100644
--- a/library/core/src/str/mod.rs
+++ b/library/core/src/str/mod.rs
@@ -1832,14 +1832,14 @@ impl str {
     /// Returns a string slice with leading and trailing whitespace removed.
     ///
     /// 'Whitespace' is defined according to the terms of the Unicode Derived
-    /// Core Property `White_Space`.
+    /// Core Property `White_Space`, which includes newlines.
     ///
     /// # Examples
     ///
     /// Basic usage:
     ///
     /// ```
-    /// let s = " Hello\tworld\t";
+    /// let s = "\n Hello\tworld\t\n";
     ///
     /// assert_eq!("Hello\tworld", s.trim());
     /// ```
@@ -1855,7 +1855,7 @@ impl str {
     /// Returns a string slice with leading whitespace removed.
     ///
     /// 'Whitespace' is defined according to the terms of the Unicode Derived
-    /// Core Property `White_Space`.
+    /// Core Property `White_Space`, which includes newlines.
     ///
     /// # Text directionality
     ///
@@ -1869,8 +1869,8 @@ impl str {
     /// Basic usage:
     ///
     /// ```
-    /// let s = " Hello\tworld\t";
-    /// assert_eq!("Hello\tworld\t", s.trim_start());
+    /// let s = "\n Hello\tworld\t\n";
+    /// assert_eq!("Hello\tworld\t\n", s.trim_start());
     /// ```
     ///
     /// Directionality:
@@ -1894,7 +1894,7 @@ impl str {
     /// Returns a string slice with trailing whitespace removed.
     ///
     /// 'Whitespace' is defined according to the terms of the Unicode Derived
-    /// Core Property `White_Space`.
+    /// Core Property `White_Space`, which includes newlines.
     ///
     /// # Text directionality
     ///
@@ -1908,8 +1908,8 @@ impl str {
     /// Basic usage:
     ///
     /// ```
-    /// let s = " Hello\tworld\t";
-    /// assert_eq!(" Hello\tworld", s.trim_end());
+    /// let s = "\n Hello\tworld\t\n";
+    /// assert_eq!("\n Hello\tworld", s.trim_end());
     /// ```
     ///
     /// Directionality: