rust/src/test/ui/rfc-2005-default-binding-mode/enum.rs

23 lines
385 B
Rust
Raw Normal View History

enum Wrapper {
Wrap(i32),
}
use Wrapper::Wrap;
pub fn main() {
let Wrap(x) = &Wrap(3);
2017-11-20 12:13:27 +00:00
*x += 1; //~ ERROR cannot assign to immutable
if let Some(x) = &Some(3) {
2017-11-20 12:13:27 +00:00
*x += 1; //~ ERROR cannot assign to immutable
} else {
panic!();
}
while let Some(x) = &Some(3) {
2017-11-20 12:13:27 +00:00
*x += 1; //~ ERROR cannot assign to immutable
break;
}
}