Start regression tests for types.rs

This commit is contained in:
Darren Tsung 2017-12-23 10:15:11 -08:00
parent f0d0fc69de
commit 0f4c40b229
2 changed files with 18 additions and 0 deletions

10
tests/ui/types.rs Normal file
View File

@ -0,0 +1,10 @@
// should not warn on lossy casting in constant types
// because not supported yet
const C : i32 = 42;
const C_I64 : i64 = C as i64;
fn main() {
// should suggest i64::from(c)
let c : i32 = 42;
let c_i64 : i64 = c as i64;
}

8
tests/ui/types.stderr Normal file
View File

@ -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`