mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-04 20:54:13 +00:00
23 lines
469 B
Rust
23 lines
469 B
Rust
enum Wrapper {
|
|
Wrap(i32),
|
|
}
|
|
|
|
use Wrapper::Wrap;
|
|
|
|
pub fn main() {
|
|
let Wrap(x) = &Wrap(3);
|
|
*x += 1; //~ ERROR cannot assign to `*x`, which is behind a `&` reference
|
|
|
|
|
|
if let Some(x) = &Some(3) {
|
|
*x += 1; //~ ERROR cannot assign to `*x`, which is behind a `&` reference
|
|
} else {
|
|
panic!();
|
|
}
|
|
|
|
while let Some(x) = &Some(3) {
|
|
*x += 1; //~ ERROR cannot assign to `*x`, which is behind a `&` reference
|
|
break;
|
|
}
|
|
}
|