about summary refs log tree commit diff
path: root/tests/ui/typeck/pointer-arith-assign.fixed
blob: 907208579e7c6992e0c0de6766b8bb1e24e78e58 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
//@ run-rustfix
#![allow(dead_code)]
#![allow(unused_variables)]
#![allow(unused_assignments)]

fn test_add_assign_raw_pointer() {
    let mut arr = [0u8; 10];
    let mut _ptr = arr.as_mut_ptr();

    _ptr = _ptr.wrapping_add(2); //~ ERROR binary assignment operation `+=` cannot be applied to type `*mut u8` [E0368]
}

fn test_sub_assign_raw_pointer() {
    let mut arr = [0u8; 10];
    let mut _ptr = arr.as_mut_ptr();

    _ptr = _ptr.wrapping_sub(2); //~ ERROR binary assignment operation `-=` cannot be applied to type `*mut u8` [E0368]
}

fn main() {}