We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f0d0fc6 commit 0f4c40bCopy full SHA for 0f4c40b
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