about summary refs log tree commit diff
path: root/src/libcore
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2020-07-16 07:01:59 +0000
committerbors <bors@rust-lang.org>2020-07-16 07:01:59 +0000
commit4cd0ee9343da86d9770bf0a514a682d240e0dce8 (patch)
treeb47df8dd7e6cd3c15ea3dc06e71037ddf1c32e42 /src/libcore
parente2e29de5e8a2908260d54182638241ff086a26c2 (diff)
parenta77813b8d0866a474a9a853d5a479ebc052bef06 (diff)
Auto merge of #74388 - Manishearth:rollup-i7iueu8, r=Manishearth
Rollup of 7 pull requests

Successful merges:

 - #73421 (Clarify effect of orphan rule changes on From/Into)
 - #74037 (Update reference to CONTRIBUTING.md)
 - #74203 (Enforce the static symbol order.)
 - #74295 (Add and fix BTreeMap comments)
 - #74352 (Use local links in the alloc docs.)
 - #74377 (Move libstd's default feature to libtest)
 - #74381 (Update docs for str::as_bytes_mut.)

Failed merges:

r? @ghost
Diffstat (limited to 'src/libcore')
-rw-r--r--src/libcore/convert/mod.rs11
-rw-r--r--src/libcore/str/mod.rs11
2 files changed, 14 insertions, 8 deletions
diff --git a/src/libcore/convert/mod.rs b/src/libcore/convert/mod.rs
index 8ff1ced53b0..94f7ff5c1f7 100644
--- a/src/libcore/convert/mod.rs
+++ b/src/libcore/convert/mod.rs
@@ -18,8 +18,9 @@
 //! [`TryFrom<T>`][`TryFrom`] rather than [`Into<U>`][`Into`] or [`TryInto<U>`][`TryInto`],
 //! as [`From`] and [`TryFrom`] provide greater flexibility and offer
 //! equivalent [`Into`] or [`TryInto`] implementations for free, thanks to a
-//! blanket implementation in the standard library. Only implement [`Into`] or [`TryInto`]
-//! when a conversion to a type outside the current crate is required.
+//! blanket implementation in the standard library. When targeting a version prior to Rust 1.41, it
+//! may be necessary to implement [`Into`] or [`TryInto`] directly when converting to a type
+//! outside the current crate.
 //!
 //! # Generic Implementations
 //!
@@ -298,8 +299,10 @@ pub trait Into<T>: Sized {
 /// because implementing `From` automatically provides one with an implementation of [`Into`]
 /// thanks to the blanket implementation in the standard library.
 ///
-/// Only implement [`Into`] if a conversion to a type outside the current crate is required.
-/// `From` cannot do these type of conversions because of Rust's orphaning rules.
+/// Only implement [`Into`] when targeting a version prior to Rust 1.41 and converting to a type
+/// outside the current crate.
+/// `From` was not able to do these types of conversions in earlier versions because of Rust's
+/// orphaning rules.
 /// See [`Into`] for more details.
 ///
 /// Prefer using [`Into`] over using `From` when specifying trait bounds on a generic function.
diff --git a/src/libcore/str/mod.rs b/src/libcore/str/mod.rs
index 393911675c7..86e8d5c42b7 100644
--- a/src/libcore/str/mod.rs
+++ b/src/libcore/str/mod.rs
@@ -2374,11 +2374,14 @@ impl str {
         unsafe { Slices { str: self }.slice }
     }
 
-    /// Converts a mutable string slice to a mutable byte slice. To convert the
-    /// mutable byte slice back into a mutable string slice, use the
-    /// [`str::from_utf8_mut`] function.
+    /// Converts a mutable string slice to a mutable byte slice.
     ///
-    /// [`str::from_utf8_mut`]: ./str/fn.from_utf8_mut.html
+    /// # Safety
+    ///
+    /// The caller must ensure that the content of the slice is valid UTF-8
+    /// before the borrow ends and the underlying `str` is used.
+    ///
+    /// Use of a `str` whose contents are not valid UTF-8 is undefined behavior.
     ///
     /// # Examples
     ///