Skip to content

Commit 8a89897

Browse files
committed
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
2 parents 47d029e + 31be255 commit 8a89897

File tree

4 files changed

+21
-12
lines changed

4 files changed

+21
-12
lines changed

core/src/char/methods.rs

+3
Original file line numberDiff line numberDiff line change
@@ -804,6 +804,9 @@ impl char {
804804
/// ```
805805
/// assert!(' '.is_whitespace());
806806
///
807+
/// // line break
808+
/// assert!('\n'.is_whitespace());
809+
///
807810
/// // a non-breaking space
808811
/// assert!('\u{A0}'.is_whitespace());
809812
///

core/src/macros/mod.rs

+8-2
Original file line numberDiff line numberDiff line change
@@ -909,7 +909,10 @@ pub(crate) mod builtin {
909909
/// Inspects an environment variable at compile time.
910910
///
911911
/// This macro will expand to the value of the named environment variable at
912-
/// compile time, yielding an expression of type `&'static str`.
912+
/// compile time, yielding an expression of type `&'static str`. Use
913+
/// [`std::env::var`] instead if you want to read the value at runtime.
914+
///
915+
/// [`std::env::var`]: ../std/env/fn.var.html
913916
///
914917
/// If the environment variable is not defined, then a compilation error
915918
/// will be emitted. To not emit a compile error, use the [`option_env!`]
@@ -950,7 +953,10 @@ pub(crate) mod builtin {
950953
/// expand into an expression of type `Option<&'static str>` whose value is
951954
/// `Some` of the value of the environment variable. If the environment
952955
/// variable is not present, then this will expand to `None`. See
953-
/// [`Option<T>`][Option] for more information on this type.
956+
/// [`Option<T>`][Option] for more information on this type. Use
957+
/// [`std::env::var`] instead if you want to read the value at runtime.
958+
///
959+
/// [`std::env::var`]: ../std/env/fn.var.html
954960
///
955961
/// A compile time error is never emitted when using this macro regardless
956962
/// of whether the environment variable is present or not.

core/src/slice/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -814,7 +814,7 @@ impl<T> [T] {
814814
#[stable(feature = "rust1", since = "1.0.0")]
815815
#[inline]
816816
pub fn chunks(&self, chunk_size: usize) -> Chunks<'_, T> {
817-
assert_ne!(chunk_size, 0);
817+
assert_ne!(chunk_size, 0, "chunks cannot have a size of zero");
818818
Chunks::new(self, chunk_size)
819819
}
820820

@@ -852,7 +852,7 @@ impl<T> [T] {
852852
#[stable(feature = "rust1", since = "1.0.0")]
853853
#[inline]
854854
pub fn chunks_mut(&mut self, chunk_size: usize) -> ChunksMut<'_, T> {
855-
assert_ne!(chunk_size, 0);
855+
assert_ne!(chunk_size, 0, "chunks cannot have a size of zero");
856856
ChunksMut::new(self, chunk_size)
857857
}
858858

core/src/str/mod.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -1832,14 +1832,14 @@ impl str {
18321832
/// Returns a string slice with leading and trailing whitespace removed.
18331833
///
18341834
/// 'Whitespace' is defined according to the terms of the Unicode Derived
1835-
/// Core Property `White_Space`.
1835+
/// Core Property `White_Space`, which includes newlines.
18361836
///
18371837
/// # Examples
18381838
///
18391839
/// Basic usage:
18401840
///
18411841
/// ```
1842-
/// let s = " Hello\tworld\t";
1842+
/// let s = "\n Hello\tworld\t\n";
18431843
///
18441844
/// assert_eq!("Hello\tworld", s.trim());
18451845
/// ```
@@ -1855,7 +1855,7 @@ impl str {
18551855
/// Returns a string slice with leading whitespace removed.
18561856
///
18571857
/// 'Whitespace' is defined according to the terms of the Unicode Derived
1858-
/// Core Property `White_Space`.
1858+
/// Core Property `White_Space`, which includes newlines.
18591859
///
18601860
/// # Text directionality
18611861
///
@@ -1869,8 +1869,8 @@ impl str {
18691869
/// Basic usage:
18701870
///
18711871
/// ```
1872-
/// let s = " Hello\tworld\t";
1873-
/// assert_eq!("Hello\tworld\t", s.trim_start());
1872+
/// let s = "\n Hello\tworld\t\n";
1873+
/// assert_eq!("Hello\tworld\t\n", s.trim_start());
18741874
/// ```
18751875
///
18761876
/// Directionality:
@@ -1894,7 +1894,7 @@ impl str {
18941894
/// Returns a string slice with trailing whitespace removed.
18951895
///
18961896
/// 'Whitespace' is defined according to the terms of the Unicode Derived
1897-
/// Core Property `White_Space`.
1897+
/// Core Property `White_Space`, which includes newlines.
18981898
///
18991899
/// # Text directionality
19001900
///
@@ -1908,8 +1908,8 @@ impl str {
19081908
/// Basic usage:
19091909
///
19101910
/// ```
1911-
/// let s = " Hello\tworld\t";
1912-
/// assert_eq!(" Hello\tworld", s.trim_end());
1911+
/// let s = "\n Hello\tworld\t\n";
1912+
/// assert_eq!("\n Hello\tworld", s.trim_end());
19131913
/// ```
19141914
///
19151915
/// Directionality:

0 commit comments

Comments
 (0)