2017-10-06 15:30:23 -05:00
|
|
|
enum Wrapper {
|
|
|
|
Wrap(i32),
|
|
|
|
}
|
|
|
|
|
|
|
|
use Wrapper::Wrap;
|
|
|
|
|
|
|
|
pub fn main() {
|
|
|
|
let Wrap(x) = &Wrap(3);
|
2023-05-29 10:43:15 -05:00
|
|
|
*x += 1; //~ ERROR cannot assign to `*x`, which is behind a `&` reference
|
2017-10-06 15:30:23 -05:00
|
|
|
|
|
|
|
|
|
|
|
if let Some(x) = &Some(3) {
|
2023-05-29 10:43:15 -05:00
|
|
|
*x += 1; //~ ERROR cannot assign to `*x`, which is behind a `&` reference
|
2017-10-06 15:30:23 -05:00
|
|
|
} else {
|
|
|
|
panic!();
|
|
|
|
}
|
|
|
|
|
|
|
|
while let Some(x) = &Some(3) {
|
2023-05-29 10:43:15 -05:00
|
|
|
*x += 1; //~ ERROR cannot assign to `*x`, which is behind a `&` reference
|
2017-10-06 15:30:23 -05:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|