Closed
Description
Using this code on nightly:
#![feature(nll)]
enum E {
Variant(i32),
}
fn main() {
let e = E::Variant(5);
match e {
E::Variant(ref some_name) => *some_name += 10,
}
}
I get this error message:
error[E0594]: cannot assign to data in a `&` reference
--> src/main.rs:10:38
|
10 | E::Variant(ref some_name) => *some_name += 10,
| ------------- ^^^^^^^^^^^^^^^^
| |
| help: consider changing this to be a mutable reference: `&mut ef some_name`
error: aborting due to previous error
For more information about this error, try `rustc --explain E0594`.
The correct suggestion is ref mut some_name
.
Meta
rustc --version --verbose
:
rustc 1.28.0-nightly (b907d9665 2018-06-13)
binary: rustc
commit-hash: b907d966528a6859ec847a2a4d32f092a5be6584
commit-date: 2018-06-13
host: x86_64-unknown-linux-gnu
release: 1.28.0-nightly
LLVM version: 6.0