1 extern "C" {
write(fildes: i32, buf: *const i8, nbyte: u64) -> i642     fn write(fildes: i32, buf: *const i8, nbyte: u64) -> i64;
3 }
4 
5 #[inline(always)]
size_of<T>(_: T) -> usize6 fn size_of<T>(_: T) -> usize {
7     ::std::mem::size_of::<T>()
8 }
9 
10 macro_rules! write {
11     ($arr:expr) => {{
12         #[allow(non_upper_case_globals)]
13         const stdout: i32 = 1;
14         unsafe {
15             write(stdout, $arr.as_ptr() as *const i8,
16                   $arr.len() * size_of($arr[0])); //~ ERROR mismatched types
17         }
18     }}
19 }
20 
21 macro_rules! cast {
22     ($x:expr) => ($x as ()) //~ ERROR non-primitive cast
23 }
24 
main()25 fn main() {
26     let hello = ['H', 'e', 'y'];
27     write!(hello);
28     cast!(2);
29 }
30