2021-07-25 14:23:48 +00:00
|
|
|
#![allow(unconditional_recursion)]
|
|
|
|
|
2018-10-01 15:46:04 +00:00
|
|
|
struct Struct;
|
|
|
|
|
|
|
|
impl Struct {
|
|
|
|
fn bar(self: &mut Self) {
|
2018-10-01 17:20:57 +00:00
|
|
|
(&mut self).bar();
|
|
|
|
//~^ ERROR cannot borrow `self` as mutable, as it is not declared as mutable [E0596]
|
2021-07-25 14:23:48 +00:00
|
|
|
//~^^ HELP try removing `&mut` here
|
2018-10-01 15:46:04 +00:00
|
|
|
}
|
|
|
|
|
2021-07-25 14:23:48 +00:00
|
|
|
fn imm(self) { //~ HELP consider changing this to be mutable
|
2018-10-01 17:20:57 +00:00
|
|
|
(&mut self).bar();
|
|
|
|
//~^ ERROR cannot borrow `self` as mutable, as it is not declared as mutable [E0596]
|
2018-10-01 15:46:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
fn mtbl(mut self) {
|
|
|
|
(&mut self).bar();
|
|
|
|
}
|
|
|
|
|
|
|
|
fn immref(&self) {
|
2018-10-01 17:20:57 +00:00
|
|
|
(&mut self).bar();
|
|
|
|
//~^ ERROR cannot borrow `self` as mutable, as it is not declared as mutable [E0596]
|
|
|
|
//~^^ ERROR cannot borrow data in a `&` reference as mutable [E0596]
|
2018-10-01 15:46:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
fn mtblref(&mut self) {
|
|
|
|
(&mut self).bar();
|
2018-10-01 17:20:57 +00:00
|
|
|
//~^ ERROR cannot borrow `self` as mutable, as it is not declared as mutable [E0596]
|
2021-07-25 14:23:48 +00:00
|
|
|
//~^^ HELP try removing `&mut` here
|
2018-10-01 15:46:04 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-07-25 14:23:48 +00:00
|
|
|
fn main() {}
|