Skip to content

Commit 652e420

Browse files
committed
remove example which was never UB from AsPrimitive docs
1 parent 7d26cec commit 652e420

File tree

1 file changed

+3
-12
lines changed

1 file changed

+3
-12
lines changed

src/cast.rs

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -753,24 +753,15 @@ impl<T: NumCast> NumCast for Wrapping<T> {
753753
/// # Safety
754754
///
755755
/// **In Rust versions before 1.45.0**, some uses of the `as` operator were not entirely safe.
756-
/// In particular, it was undefined behavior if:
757-
///
758-
/// - A truncated floating point value cannot fit in the target integer
759-
/// type ([#10184](https://github.com/rust-lang/rust/issues/10184));
756+
/// In particular, it was undefined behavior if
757+
/// a truncated floating point value could not fit in the target integer
758+
/// type ([#10184](https://github.com/rust-lang/rust/issues/10184)).
760759
///
761760
/// ```ignore
762761
/// # use num_traits::AsPrimitive;
763762
/// let x: u8 = (1.04E+17).as_(); // UB
764763
/// ```
765764
///
766-
/// - Or a floating point value does not fit in another floating
767-
/// point type ([#15536](https://github.com/rust-lang/rust/issues/15536)).
768-
///
769-
/// ```ignore
770-
/// # use num_traits::AsPrimitive;
771-
/// let x: f32 = (1e300f64).as_(); // UB
772-
/// ```
773-
///
774765
pub trait AsPrimitive<T>: 'static + Copy
775766
where
776767
T: 'static + Copy,

0 commit comments

Comments
 (0)