]> git.lizzy.rs Git - rust.git/blob - src/test/ui/nll/borrowed-match-issue-45045.rs
Auto merge of #103600 - compiler-errors:early-binder-nits, r=spastorino
[rust.git] / src / test / ui / nll / borrowed-match-issue-45045.rs
1 // Regression test for issue #45045
2
3 enum Xyz {
4     A,
5     B,
6 }
7
8 fn main() {
9     let mut e = Xyz::A;
10     let f = &mut e;
11     let g = f;
12     match e {
13         //~^ cannot use `e` because it was mutably borrowed [E0503]
14         Xyz::A => println!("a"),
15         Xyz::B => println!("b"),
16     };
17     *g = Xyz::B;
18 }