1 // Suggest not mutably borrowing a mutable reference
2 #![crate_type = "rlib"]
4 pub fn f(b: &mut i32) {
5 //~^ ERROR cannot borrow
7 //~| NOTE the binding is already a mutable borrow
9 //~^ NOTE cannot borrow as mutable
10 //~| HELP try removing `&mut` here
12 //~^ NOTE cannot borrow as mutable
13 //~| HELP try removing `&mut` here
16 pub fn g(b: &mut i32) { //~ NOTE the binding is already a mutable borrow
18 //~^ ERROR cannot borrow
19 //~| NOTE cannot borrow as mutable
20 //~| HELP try removing `&mut` here
23 pub fn h(_: &mut i32) {}
29 impl Foo for &mut String {
33 pub fn baz(f: &mut String) { //~ HELP consider making the binding mutable
34 f.bar(); //~ ERROR cannot borrow `f` as mutable, as it is not declared as mutable
35 //~^ NOTE cannot borrow as mutable