1 The left-hand side of a compound assignment expression must be a place
2 expression. A place expression represents a memory location and includes
3 item paths (ie, namespaced variables), dereferences, indexing expressions,
6 Let's start with some erroneous code examples:
9 use std::collections::LinkedList;
11 // Bad: assignment to non-place expression
12 LinkedList::new() += 1;
16 fn some_func(i: &mut i32) {
17 i += 12; // Error : '+=' operation cannot be applied on a reference !
21 And now some working examples:
30 fn some_func(i: &mut i32) {