summaryrefslogtreecommitdiffstats
path: root/src/test/ui/typeck/assign-non-lval-derefmut.fixed
blob: 0c23199af22706526f6a4acf73b8cb12622dcf53 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// run-rustfix

fn main() {
    let x = std::sync::Mutex::new(1usize);
    *x.lock().unwrap() = 2;
    //~^ ERROR invalid left-hand side of assignment
    *x.lock().unwrap() += 1;
    //~^ ERROR binary assignment operation `+=` cannot be applied to type `MutexGuard<'_, usize>`

    let mut y = x.lock().unwrap();
    *y = 2;
    //~^ ERROR mismatched types
    *y += 1;
    //~^ ERROR binary assignment operation `+=` cannot be applied to type `MutexGuard<'_, usize>`
}