@@ -11,57 +11,52 @@ fn main() {
1111    const  SIZE :  usize  = 128 ; 
1212    const  HALF_SIZE :  usize  = SIZE  / 2 ; 
1313    const  DOUBLE_SIZE :  usize  = SIZE  *  2 ; 
14-     let  mut  x = [ 2u8 ;  SIZE ] ; 
15-     let  mut  y = [ 2u8 ;  SIZE ] ; 
14+     let  mut  x = [ 2u16 ;  SIZE ] ; 
15+     let  mut  y = [ 2u16 ;  SIZE ] ; 
1616
1717    // Count is size_of (Should trigger the lint) 
18-     unsafe  {  copy_nonoverlapping :: < u8 > ( x. as_ptr ( ) ,  y. as_mut_ptr ( ) ,  size_of :: < u8 > ( ) )  } ; 
18+     unsafe  {  copy_nonoverlapping :: < u16 > ( x. as_ptr ( ) ,  y. as_mut_ptr ( ) ,  size_of :: < u16 > ( ) )  } ; 
1919    //~^ ERROR: found a count of bytes instead of a count of elements of `T` 
2020    unsafe  {  copy_nonoverlapping ( x. as_ptr ( ) ,  y. as_mut_ptr ( ) ,  size_of_val ( & x[ 0 ] ) )  } ; 
2121    //~^ ERROR: found a count of bytes instead of a count of elements of `T` 
2222
23-     unsafe  {  x. as_ptr ( ) . copy_to ( y. as_mut_ptr ( ) ,  size_of :: < u8 > ( ) )  } ; 
23+     unsafe  {  x. as_ptr ( ) . copy_to ( y. as_mut_ptr ( ) ,  size_of :: < u16 > ( ) )  } ; 
2424    //~^ ERROR: found a count of bytes instead of a count of elements of `T` 
25-     unsafe  {  x. as_ptr ( ) . copy_to_nonoverlapping ( y. as_mut_ptr ( ) ,  size_of :: < u8 > ( ) )  } ; 
25+     unsafe  {  x. as_ptr ( ) . copy_to_nonoverlapping ( y. as_mut_ptr ( ) ,  size_of :: < u16 > ( ) )  } ; 
2626    //~^ ERROR: found a count of bytes instead of a count of elements of `T` 
27-     unsafe  {  y. as_mut_ptr ( ) . copy_from ( x. as_ptr ( ) ,  size_of :: < u8 > ( ) )  } ; 
27+     unsafe  {  y. as_mut_ptr ( ) . copy_from ( x. as_ptr ( ) ,  size_of :: < u16 > ( ) )  } ; 
2828    //~^ ERROR: found a count of bytes instead of a count of elements of `T` 
29-     unsafe  {  y. as_mut_ptr ( ) . copy_from_nonoverlapping ( x. as_ptr ( ) ,  size_of :: < u8 > ( ) )  } ; 
29+     unsafe  {  y. as_mut_ptr ( ) . copy_from_nonoverlapping ( x. as_ptr ( ) ,  size_of :: < u16 > ( ) )  } ; 
3030    //~^ ERROR: found a count of bytes instead of a count of elements of `T` 
3131
32-     unsafe  {  copy ( x. as_ptr ( ) ,  y. as_mut_ptr ( ) ,  size_of :: < u8 > ( ) )  } ; 
32+     unsafe  {  copy ( x. as_ptr ( ) ,  y. as_mut_ptr ( ) ,  size_of :: < u16 > ( ) )  } ; 
3333    //~^ ERROR: found a count of bytes instead of a count of elements of `T` 
3434    unsafe  {  copy ( x. as_ptr ( ) ,  y. as_mut_ptr ( ) ,  size_of_val ( & x[ 0 ] ) )  } ; 
3535    //~^ ERROR: found a count of bytes instead of a count of elements of `T` 
3636
37-     unsafe  {  y. as_mut_ptr ( ) . write_bytes ( 0u8 ,  size_of :: < u8 > ( )  *  SIZE )  } ; 
38-     //~^ ERROR: found a count of bytes instead of a count of elements of `T` 
39-     unsafe  {  write_bytes ( y. as_mut_ptr ( ) ,  0u8 ,  size_of :: < u8 > ( )  *  SIZE )  } ; 
40-     //~^ ERROR: found a count of bytes instead of a count of elements of `T` 
41- 
42-     unsafe  {  swap_nonoverlapping ( y. as_mut_ptr ( ) ,  x. as_mut_ptr ( ) ,  size_of :: < u8 > ( )  *  SIZE )  } ; 
37+     unsafe  {  swap_nonoverlapping ( y. as_mut_ptr ( ) ,  x. as_mut_ptr ( ) ,  size_of :: < u16 > ( )  *  SIZE )  } ; 
4338    //~^ ERROR: found a count of bytes instead of a count of elements of `T` 
4439
45-     slice_from_raw_parts_mut ( y. as_mut_ptr ( ) ,  size_of :: < u8 > ( )  *  SIZE ) ; 
40+     slice_from_raw_parts_mut ( y. as_mut_ptr ( ) ,  size_of :: < u16 > ( )  *  SIZE ) ; 
4641    //~^ ERROR: found a count of bytes instead of a count of elements of `T` 
47-     slice_from_raw_parts ( y. as_ptr ( ) ,  size_of :: < u8 > ( )  *  SIZE ) ; 
42+     slice_from_raw_parts ( y. as_ptr ( ) ,  size_of :: < u16 > ( )  *  SIZE ) ; 
4843    //~^ ERROR: found a count of bytes instead of a count of elements of `T` 
4944
50-     unsafe  {  from_raw_parts_mut ( y. as_mut_ptr ( ) ,  size_of :: < u8 > ( )  *  SIZE )  } ; 
45+     unsafe  {  from_raw_parts_mut ( y. as_mut_ptr ( ) ,  size_of :: < u16 > ( )  *  SIZE )  } ; 
5146    //~^ ERROR: found a count of bytes instead of a count of elements of `T` 
52-     unsafe  {  from_raw_parts ( y. as_ptr ( ) ,  size_of :: < u8 > ( )  *  SIZE )  } ; 
47+     unsafe  {  from_raw_parts ( y. as_ptr ( ) ,  size_of :: < u16 > ( )  *  SIZE )  } ; 
5348    //~^ ERROR: found a count of bytes instead of a count of elements of `T` 
5449
55-     unsafe  {  y. as_mut_ptr ( ) . sub ( size_of :: < u8 > ( ) )  } ; 
50+     unsafe  {  y. as_mut_ptr ( ) . sub ( size_of :: < u16 > ( ) )  } ; 
5651    //~^ ERROR: found a count of bytes instead of a count of elements of `T` 
57-     y. as_ptr ( ) . wrapping_sub ( size_of :: < u8 > ( ) ) ; 
52+     y. as_ptr ( ) . wrapping_sub ( size_of :: < u16 > ( ) ) ; 
5853    //~^ ERROR: found a count of bytes instead of a count of elements of `T` 
59-     unsafe  {  y. as_ptr ( ) . add ( size_of :: < u8 > ( ) )  } ; 
54+     unsafe  {  y. as_ptr ( ) . add ( size_of :: < u16 > ( ) )  } ; 
6055    //~^ ERROR: found a count of bytes instead of a count of elements of `T` 
61-     y. as_mut_ptr ( ) . wrapping_add ( size_of :: < u8 > ( ) ) ; 
56+     y. as_mut_ptr ( ) . wrapping_add ( size_of :: < u16 > ( ) ) ; 
6257    //~^ ERROR: found a count of bytes instead of a count of elements of `T` 
63-     unsafe  {  y. as_ptr ( ) . offset ( size_of :: < u8 > ( )  as  isize )  } ; 
58+     unsafe  {  y. as_ptr ( ) . offset ( size_of :: < u16 > ( )  as  isize )  } ; 
6459    //~^ ERROR: found a count of bytes instead of a count of elements of `T` 
65-     y. as_mut_ptr ( ) . wrapping_offset ( size_of :: < u8 > ( )  as  isize ) ; 
60+     y. as_mut_ptr ( ) . wrapping_offset ( size_of :: < u16 > ( )  as  isize ) ; 
6661    //~^ ERROR: found a count of bytes instead of a count of elements of `T` 
6762} 
0 commit comments