mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-26 00:34:06 +00:00
Start regression tests for types.rs
This commit is contained in:
parent
f0d0fc69de
commit
0f4c40b229
10
tests/ui/types.rs
Normal file
10
tests/ui/types.rs
Normal 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
8
tests/ui/types.stderr
Normal 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`
|
||||
|
Loading…
Reference in New Issue
Block a user