]> git.lizzy.rs Git - rust.git/blob - src/test/ui/nll/issue-51191.rs
Rollup merge of #60685 - dtolnay:spdx, r=nikomatsakis
[rust.git] / src / test / ui / nll / issue-51191.rs
1 #![feature(nll)]
2
3 struct Struct;
4
5 impl Struct {
6     fn bar(self: &mut Self) {
7         //~^ WARN function cannot return without recursing
8         (&mut self).bar();
9         //~^ ERROR cannot borrow `self` as mutable, as it is not declared as mutable [E0596]
10     }
11
12     fn imm(self) {
13         (&mut self).bar();
14         //~^ ERROR cannot borrow `self` as mutable, as it is not declared as mutable [E0596]
15     }
16
17     fn mtbl(mut self) {
18         (&mut self).bar();
19     }
20
21     fn immref(&self) {
22         (&mut self).bar();
23         //~^ ERROR cannot borrow `self` as mutable, as it is not declared as mutable [E0596]
24         //~^^ ERROR cannot borrow data in a `&` reference as mutable [E0596]
25     }
26
27     fn mtblref(&mut self) {
28         (&mut self).bar();
29         //~^ ERROR cannot borrow `self` as mutable, as it is not declared as mutable [E0596]
30     }
31 }
32
33 fn main () {}