about summary refs log tree commit diff
path: root/library/core
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2025-05-16 05:45:37 +0000
committerbors <bors@rust-lang.org>2025-05-16 05:45:37 +0000
commitc79bbfab78dcb0a72aa3b2bc35c00334b58bfe2e (patch)
treed6f39db82b528e67936230e39ad6c460d8904977 /library/core
parent7e19eef048ba58c28c70afbf5f95da4829c15796 (diff)
parent5ce27f572ff4a5ba50146dc70aa5397b24a3f20a (diff)
downloadrust-c79bbfab78dcb0a72aa3b2bc35c00334b58bfe2e.tar.gz
rust-c79bbfab78dcb0a72aa3b2bc35c00334b58bfe2e.zip
Auto merge of #141066 - matthiaskrgr:rollup-e7tyrj5, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - #140791 (std: explain prefer `TryInto` over `TryFrom` when specifying traits bounds on generic function)
 - #140834 (move (or remove) some impl Trait tests)
 - #140910 (Remove `stable` attribute from wasi fs (read_exact|write_all)_at)
 - #140984 (fix doc for UnixStream)
 - #140997 (Add negative test coverage for `-Clink-self-contained` and `-Zlinker-features`)
 - #141003 (Improve ternary operator recovery)
 - #141009 (Migrate to modern datetime API)
 - #141013 (Implement methods to set STARTUPINFO flags for Command API on Windows)
 - #141026 (rustc-dev-guide subtree update)

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'library/core')
-rw-r--r--library/core/src/convert/mod.rs10
1 files changed, 8 insertions, 2 deletions
diff --git a/library/core/src/convert/mod.rs b/library/core/src/convert/mod.rs
index e1b10e1074d..c542a28beb8 100644
--- a/library/core/src/convert/mod.rs
+++ b/library/core/src/convert/mod.rs
@@ -464,8 +464,8 @@ pub trait Into<T>: Sized {
 /// orphaning rules.
 /// See [`Into`] for more details.
 ///
-/// Prefer using [`Into`] over using `From` when specifying trait bounds on a generic function.
-/// This way, types that directly implement [`Into`] can be used as arguments as well.
+/// Prefer using [`Into`] over [`From`] when specifying trait bounds on a generic function
+/// to ensure that types that only implement [`Into`] can be used as well.
 ///
 /// The `From` trait is also very useful when performing error handling. When constructing a function
 /// that is capable of failing, the return type will generally be of the form `Result<T, E>`.
@@ -597,6 +597,9 @@ pub trait From<T>: Sized {
 /// standard library. For more information on this, see the
 /// documentation for [`Into`].
 ///
+/// Prefer using [`TryInto`] over [`TryFrom`] when specifying trait bounds on a generic function
+/// to ensure that types that only implement [`TryInto`] can be used as well.
+///
 /// # Implementing `TryInto`
 ///
 /// This suffers the same restrictions and reasoning as implementing
@@ -636,6 +639,9 @@ pub trait TryInto<T>: Sized {
 /// When the [`!`] type is stabilized [`Infallible`] and [`!`] will be
 /// equivalent.
 ///
+/// Prefer using [`TryInto`] over [`TryFrom`] when specifying trait bounds on a generic function
+/// to ensure that types that only implement [`TryInto`] can be used as well.
+///
 /// `TryFrom<T>` can be implemented as follows:
 ///
 /// ```