]> git.lizzy.rs Git - rust.git/blob - src/test/ui/borrowck/issue-85765.rs
Auto merge of #87284 - Aaron1011:remove-paren-special, r=petrochenkov
[rust.git] / src / test / ui / borrowck / issue-85765.rs
1 fn main() {
2     let mut test = Vec::new();
3     let rofl: &Vec<Vec<i32>> = &mut test;
4     //~^ HELP consider changing this to be a mutable reference
5     rofl.push(Vec::new());
6     //~^ ERROR cannot borrow `*rofl` as mutable, as it is behind a `&` reference
7     //~| NOTE `rofl` is a `&` reference, so the data it refers to cannot be borrowed as mutable
8
9     let mut mutvar = 42;
10     let r = &mutvar;
11     //~^ HELP consider changing this to be a mutable reference
12     *r = 0;
13     //~^ ERROR cannot assign to `*r`, which is behind a `&` reference
14     //~| NOTE `r` is a `&` reference, so the data it refers to cannot be written
15 }