summaryrefslogtreecommitdiffstats
path: root/src/test/ui/regions/regions-adjusted-lvalue-op.rs
blob: 5aa5a3ecb244a5daf3cdc2e4ebc34fcf086c8c84 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// check that we link regions in mutable place ops correctly - issue #41774

struct Data(i32);

trait OhNo {
    fn oh_no(&mut self, other: &Vec<Data>) { loop {} }
}

impl OhNo for Data {}
impl OhNo for [Data] {}

fn main() {
    let mut v = vec![Data(0)];
    v[0].oh_no(&v); //~ ERROR cannot borrow `v` as immutable because
    (*v).oh_no(&v); //~ ERROR cannot borrow `v` as immutable because
}