Closed
Description
Code
fn x(a: &char) {
let &b = a;
b.make_ascii_uppercase();
}
Current output
error[E0596]: cannot borrow `b` as mutable, as it is not declared as mutable
--> src/lib.rs:3:5
|
3 | b.make_ascii_uppercase();
| ^ cannot borrow as mutable
|
help: consider changing this to be mutable
|
2 | let &mut b = a;
| +++
Desired output
No response
Rationale and extra context
Applying the suggestion gives
error[[E0308]](https://doc.rust-lang.org/nightly/error_codes/E0308.html): mismatched types
--> src/lib.rs:2:9
|
2 | let &mut b = a;
| ^^^^^^ - this expression has type `&char`
| |
| types differ in mutability
| help: to declare a mutable variable use: `mut b`
|
= note: expected reference `&char`
found mutable reference `&mut _`
Other cases
No response
Anything else?
No response