We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents c66eaee + 0f4c40b commit 7e21663Copy full SHA for 7e21663
tests/ui/types.rs
@@ -0,0 +1,10 @@
1
+// should not warn on lossy casting in constant types
2
+// because not supported yet
3
+const C : i32 = 42;
4
+const C_I64 : i64 = C as i64;
5
+
6
+fn main() {
7
+ // should suggest i64::from(c)
8
+ let c : i32 = 42;
9
+ let c_i64 : i64 = c as i64;
10
+}
tests/ui/types.stderr
@@ -0,0 +1,8 @@
+error: casting i32 to i64 may become silently lossy if types change
+ --> $DIR/types.rs:9:23
+ |
+9 | let c_i64 : i64 = c as i64;
+ | ^^^^^^^^ help: try: `i64::from(c)`
+ = note: `-D cast-lossless` implied by `-D warnings`
0 commit comments