summaryrefslogtreecommitdiffstats
path: root/tests/ui/borrowck/issue-91206.rs
blob: 67407c1eae3cfe2bf2144e0e97609146d26de3b2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
struct TestClient;

impl TestClient {
    fn get_inner_ref(&self) -> &Vec<usize> {
        todo!()
    }
}

fn main() {
    let client = TestClient;
    let inner = client.get_inner_ref();
    //~^ NOTE consider changing this binding's type to be
    inner.clear();
    //~^ ERROR cannot borrow `*inner` as mutable, as it is behind a `&` reference [E0596]
    //~| NOTE `inner` is a `&` reference, so the data it refers to cannot be borrowed as mutable
}