3 // Make sure casts between thin-pointer <-> fat pointer obey RFC401
5 let a: &[i32] = &[1, 2, 3];
6 let b: Box<[i32]> = Box::new([1, 2, 3]);
7 let p = a as *const [i32];
10 a as usize; //~ ERROR casting
11 a as isize; //~ ERROR casting
12 a as i16; //~ ERROR casting `&[i32]` as `i16` is invalid
13 a as u32; //~ ERROR casting `&[i32]` as `u32` is invalid
14 b as usize; //~ ERROR non-primitive cast
19 q as *const [i32]; //~ ERROR cannot cast
22 let t: *mut (dyn Trait + 'static) = 0 as *mut _;
23 //~^ ERROR cannot cast `usize` to a pointer that is wide
24 let mut fail: *const str = 0 as *const str;
25 //~^ ERROR cannot cast `usize` to a pointer that is wide
26 let mut fail2: *const str = 0isize as *const str;
27 //~^ ERROR cannot cast `isize` to a pointer that is wide
31 let s = 0 as *const T;
32 //~^ ERROR cannot cast `usize` to a pointer that may be wide