2016-05-01 18:18:04 +00:00
|
|
|
// forbid-output: &mut mut self
|
|
|
|
|
|
|
|
struct Struct;
|
|
|
|
|
|
|
|
impl Struct {
|
|
|
|
fn foo(&mut self) {
|
2017-11-20 12:13:27 +00:00
|
|
|
(&mut self).bar(); //~ ERROR cannot borrow
|
2021-07-25 14:23:48 +00:00
|
|
|
//~^ HELP try removing `&mut` here
|
2016-05-01 18:18:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// In this case we could keep the suggestion, but to distinguish the
|
|
|
|
// two cases is pretty hard. It's an obscure case anyway.
|
|
|
|
fn bar(self: &mut Self) {
|
2018-09-12 01:35:08 +00:00
|
|
|
//~^ WARN function cannot return without recursing
|
2021-07-25 14:23:48 +00:00
|
|
|
//~^^ HELP a `loop` may express intention better if this is on purpose
|
2017-11-20 12:13:27 +00:00
|
|
|
(&mut self).bar(); //~ ERROR cannot borrow
|
2021-07-25 14:23:48 +00:00
|
|
|
//~^ HELP try removing `&mut` here
|
2016-05-01 18:18:04 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main () {}
|