rust/src/test/ui/array-not-vector.rs
2018-12-25 21:08:33 -07:00

15 lines
371 B
Rust

fn main() {
let _x: i32 = [1, 2, 3];
//~^ ERROR mismatched types
//~| expected type `i32`
//~| found type `[{integer}; 3]`
//~| expected i32, found array of 3 elements
let x: &[i32] = &[1, 2, 3];
let _y: &i32 = x;
//~^ ERROR mismatched types
//~| expected type `&i32`
//~| found type `&[i32]`
//~| expected i32, found slice
}