You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
test.rs:6:14: 6:17 error: cannot borrow immutable local variable `key` as mutable
test.rs:6 get(&mut key);
^~~
test.rs:5:9: 5:20 note: use `ref mut mut key` here to make mutable
test.rs:5 let ref mut key = v[0];
^~~~~~~~~~~
error: aborting due to previous error
The suggestion use ref mut mut key here to make mutable seems bogus. I noticed this, as I had originally written let mut key = v[0]; and rustc had suggested to put mut ref.
I would expect the output to suggest me to not use ref mut and instead let mut key = &mut v[0], or to invoke get(key) and declare let ref mut key.
Interestingly, if you run this on play.rust-lang.org the error message is the following:
error: cannot borrow immutable local variable `key` as mutable
--> <anon>:6:14
5 |> let ref mut key = v[0];
|> ----------- use `mut ref mut key` here to make mutable
6 |> get(&mut key);
|> ^^^ cannot borrow mutably
Here, the suggestion is use mut ref mut key here to make mutable.
Uh oh!
There was an error while loading. Please reload this page.
Compiling this code:
leads to this resulting error output on nightly:
The suggestion
use
ref mut mut keyhere to make mutable
seems bogus. I noticed this, as I had originally writtenlet mut key = v[0];
and rustc had suggested to putmut ref
.I would expect the output to suggest me to not use
ref mut
and insteadlet mut key = &mut v[0]
, or to invokeget(key)
and declarelet ref mut key
.Interestingly, if you run this on play.rust-lang.org the error message is the following:
Here, the suggestion is
use
mut ref mut keyhere to make mutable
.Meta
No backtrace available because the compiler halts the build.
The text was updated successfully, but these errors were encountered: