]> git.lizzy.rs Git - rust.git/blob - src/test/ui/issues/issue-8851.rs
Merge commit '97e504549371d7640cf011d266e3c17394fdddac' into sync_cg_clif-2021-12-20
[rust.git] / src / test / ui / issues / issue-8851.rs
1 // run-pass
2 #![allow(dead_code)]
3 // after fixing #9384 and implementing hygiene for match bindings,
4 // this now fails because the insertion of the 'y' into the match
5 // doesn't cause capture. Making this macro hygienic (as I've done)
6 // could very well make this test case completely pointless....
7
8 // pretty-expanded FIXME #23616
9
10 enum T {
11     A(isize),
12     B(usize)
13 }
14
15 macro_rules! test {
16     ($id:ident, $e:expr) => (
17         fn foo(t: T) -> isize {
18             match t {
19                 T::A($id) => $e,
20                 T::B($id) => $e
21             }
22         }
23     )
24 }
25
26 test!(y, 10 + (y as isize));
27
28 pub fn main() {
29     foo(T::A(20));
30 }