Skip to content

Commit 1331757

Browse files
authored
Add warning for unsafe methods
1 parent a6708bf commit 1331757

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/types/cast.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ fn main() {
7070
// nan as u8 is 0
7171
println!("nan as u8 is {}", f32::NAN as u8);
7272
73-
// This behavior incures a small runtime cost and can be avoided with unsafe methods:
73+
// This behavior incures a small runtime cost and can be avoided with unsafe methods, however the results might overflow and return **unsound values**. Use these methods wisely:
7474
unsafe {
7575
// 300.0 is 44
7676
println!("300.0 is {}", 300.0_f32.to_int_unchecked::<u8>());

0 commit comments

Comments
 (0)