mirror of
https://github.com/rust-lang/rust.git
synced 2025-06-05 19:58:32 +00:00
12 lines
299 B
Rust
12 lines
299 B
Rust
![]() |
fn main() {
|
||
|
let y = Some(0);
|
||
|
if let Some(x) = y {
|
||
|
x = 2; //~ ERROR cannot assign twice to immutable variable `x`
|
||
|
}
|
||
|
|
||
|
let mut arr = [1, 2, 3];
|
||
|
let [x, ref xs_hold @ ..] = arr;
|
||
|
x = 0; //~ ERROR cannot assign twice to immutable variable `x`
|
||
|
eprintln!("{:?}", arr);
|
||
|
}
|