@@ -11,57 +11,52 @@ fn main() {
11
11
const SIZE : usize = 128 ;
12
12
const HALF_SIZE : usize = SIZE / 2 ;
13
13
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 ] ;
16
16
17
17
// 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 > ( ) ) } ;
19
19
//~^ ERROR: found a count of bytes instead of a count of elements of `T`
20
20
unsafe { copy_nonoverlapping ( x. as_ptr ( ) , y. as_mut_ptr ( ) , size_of_val ( & x[ 0 ] ) ) } ;
21
21
//~^ ERROR: found a count of bytes instead of a count of elements of `T`
22
22
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 > ( ) ) } ;
24
24
//~^ 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 > ( ) ) } ;
26
26
//~^ 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 > ( ) ) } ;
28
28
//~^ 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 > ( ) ) } ;
30
30
//~^ ERROR: found a count of bytes instead of a count of elements of `T`
31
31
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 > ( ) ) } ;
33
33
//~^ ERROR: found a count of bytes instead of a count of elements of `T`
34
34
unsafe { copy ( x. as_ptr ( ) , y. as_mut_ptr ( ) , size_of_val ( & x[ 0 ] ) ) } ;
35
35
//~^ ERROR: found a count of bytes instead of a count of elements of `T`
36
36
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 ) } ;
43
38
//~^ ERROR: found a count of bytes instead of a count of elements of `T`
44
39
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 ) ;
46
41
//~^ 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 ) ;
48
43
//~^ ERROR: found a count of bytes instead of a count of elements of `T`
49
44
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 ) } ;
51
46
//~^ 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 ) } ;
53
48
//~^ ERROR: found a count of bytes instead of a count of elements of `T`
54
49
55
- unsafe { y. as_mut_ptr ( ) . sub ( size_of :: < u8 > ( ) ) } ;
50
+ unsafe { y. as_mut_ptr ( ) . sub ( size_of :: < u16 > ( ) ) } ;
56
51
//~^ 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 > ( ) ) ;
58
53
//~^ 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 > ( ) ) } ;
60
55
//~^ 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 > ( ) ) ;
62
57
//~^ 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 ) } ;
64
59
//~^ 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 ) ;
66
61
//~^ ERROR: found a count of bytes instead of a count of elements of `T`
67
62
}
0 commit comments