]> git.lizzy.rs Git - rust.git/commitdiff
Change `Into` docs to refer only to older versions of rust
authorOhad Ravid <ohad.rv@gmail.com>
Tue, 29 Oct 2019 18:12:37 +0000 (19:12 +0100)
committerOhad Ravid <ohad.rv@gmail.com>
Thu, 31 Oct 2019 16:11:22 +0000 (17:11 +0100)
src/libcore/convert.rs

index 3cd2337ee59a579dc8743f28fdfed50b402f598d..9e1501649a227d0764892789460d71ce6dfe0246 100644 (file)
@@ -220,11 +220,11 @@ pub trait AsMut<T: ?Sized> {
 ///
 /// # Implementing [`Into`] for conversions to external types
 ///
-/// If the destination type is not part of the current crate
-/// then you can't implement [`From`] directly.
+/// Prior to Rust 1.40, if the destination type was not part of the current crate
+/// then you couldn't implement [`From`] directly.
 /// For example, take this code:
 ///
-/// ```compile_fail
+/// ```
 /// struct Wrapper<T>(Vec<T>);
 /// impl<T> From<Wrapper<T>> for Vec<T> {
 ///     fn from(w: Wrapper<T>) -> Vec<T> {
@@ -232,9 +232,8 @@ pub trait AsMut<T: ?Sized> {
 ///     }
 /// }
 /// ```
-/// This will fail to compile because we cannot implement a trait for a type
-/// if both the trait and the type are not defined by the current crate.
-/// This is due to Rust's orphaning rules. To bypass this, you can implement [`Into`] directly:
+/// This will fail to compile in older versions of the language because Rust's orphaning rules
+/// used to be a little bit more strict. To bypass this, you could implement [`Into`] directly:
 ///
 /// ```
 /// struct Wrapper<T>(Vec<T>);