1 // issue-52240: Can turn immutable into mut with `ref mut` 2 3 enum Foo { 4 Bar(i32), 5 } 6 main()7fn main() { 8 let arr = vec!(Foo::Bar(0)); 9 if let (Some(Foo::Bar(ref mut val)), _) = (&arr.get(0), 0) { 10 //~^ ERROR cannot borrow data in a `&` reference as mutable 11 *val = 9001; 12 } 13 match arr[0] { 14 Foo::Bar(ref s) => println!("{}", s) 15 } 16 } 17