rust/src/test/ui/nll/borrowed-match-issue-45045.rs

19 lines
310 B
Rust
Raw Normal View History

2018-01-15 10:14:47 -06:00
// Regression test for issue #45045
enum Xyz {
A,
B,
}
fn main() {
let mut e = Xyz::A;
let f = &mut e;
let g = f;
2018-09-13 16:04:09 -05:00
match e {
2018-01-15 10:14:47 -06:00
Xyz::A => println!("a"),
//~^ cannot use `e` because it was mutably borrowed [E0503]
Xyz::B => println!("b"),
};
*g = Xyz::B;
}