File tree 1 file changed +5
-2
lines changed
1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -484,8 +484,11 @@ pub trait Into<T>: Sized {
484
484
/// a `From` implementation, the general expectation is that the conversions
485
485
/// should typically be restricted as follows:
486
486
///
487
- /// * The conversion is *lossless*: it cannot fail and it's possible to recover
488
- /// the original value. For example, `i32: From<u16>` exists, where the original
487
+ /// * The conversion is *infallible*: if the conversion can fail, use `TryFrom`
488
+ /// instead; don't provide a `From` impl that panics.
489
+ ///
490
+ /// * The conversion is *lossless*: semantically, it should not lose or discard
491
+ /// information. For example, `i32: From<u16>` exists, where the original
489
492
/// value can be recovered using `u16: TryFrom<i32>`. And `String: From<&str>`
490
493
/// exists, where you can get something equivalent to the original value via
491
494
/// `Deref`. But `From` cannot be used to convert from `u32` to `u16`, since
You can’t perform that action at this time.
0 commit comments