Skip to content

Commit 20f0542

Browse files
authoredMar 9, 2022
Rollup merge of rust-lang#92541 - asquared31415:from-docs, r=m-ou-se
Mention intent of `From` trait in its docs This pr is a docs modification to add to the documentation of the `From` trait a note about its intent as a perfect conversion. This is already stated in the `TryFrom` docs so this is simply adding that information in a more visible way.
2 parents fe6ad3c + 9054fbb commit 20f0542

File tree

1 file changed

+2
-1
lines changed
  • library/core/src/convert

1 file changed

+2
-1
lines changed
 

‎library/core/src/convert/mod.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,8 @@ pub trait Into<T>: Sized {
300300
/// that encapsulate multiple error types. See the "Examples" section and [the book][book] for more
301301
/// details.
302302
///
303-
/// **Note: This trait must not fail**. If the conversion can fail, use [`TryFrom`].
303+
/// **Note: This trait must not fail**. The `From` trait is intended for perfect conversions.
304+
/// If the conversion can fail or is not perfect, use [`TryFrom`].
304305
///
305306
/// # Generic Implementations
306307
///

0 commit comments

Comments
 (0)