]>
Commit | Line | Data |
---|---|---|
b7449926 | 1 | // run-pass |
c34b1796 | 2 | // Regression test for #23698: The reassignment checker only cared |
b7449926 | 3 | // about the last assignment in a match arm body |
c34b1796 AL |
4 | |
5 | // Use an extra function to make sure no extra assignments | |
6 | // are introduced by macros in the match statement | |
7 | fn check_eq(x: i32, y: i32) { | |
8 | assert_eq!(x, y); | |
9 | } | |
10 | ||
11 | #[allow(unused_assignments)] | |
12 | fn main() { | |
13 | let mut x = Box::new(1); | |
14 | match x { | |
15 | y => { | |
16 | x = Box::new(2); | |
17 | let _tmp = 1; // This assignment used to throw off the reassignment checker | |
18 | check_eq(*y, 1); | |
19 | } | |
20 | } | |
21 | } |