2016-05-01 20:18:04 +02:00
|
|
|
// forbid-output: &mut mut self
|
|
|
|
|
|
|
|
struct Struct;
|
|
|
|
|
|
|
|
impl Struct {
|
|
|
|
fn foo(&mut self) {
|
2017-11-20 13:13:27 +01:00
|
|
|
(&mut self).bar(); //~ ERROR cannot borrow
|
2021-07-25 10:23:48 -04:00
|
|
|
//~^ HELP try removing `&mut` here
|
2016-05-01 20:18:04 +02: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-11 21:35:08 -04:00
|
|
|
//~^ WARN function cannot return without recursing
|
2021-07-25 10:23:48 -04:00
|
|
|
//~^^ HELP a `loop` may express intention better if this is on purpose
|
2017-11-20 13:13:27 +01:00
|
|
|
(&mut self).bar(); //~ ERROR cannot borrow
|
2021-07-25 10:23:48 -04:00
|
|
|
//~^ HELP try removing `&mut` here
|
2016-05-01 20:18:04 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main () {}
|