1 // Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
11 #![feature(macro_rules)]
31 macro_rules! indirect(
37 macro_rules! ident_pat(
43 fn f(c: Option<char>) -> uint {
52 assert_eq!(1u, f(Some('x')));
53 assert_eq!(2u, f(Some('y')));
54 assert_eq!(3u, f(None));
56 assert_eq!(1i, match Some('x') {
57 Some(char_x!()) => 1i,
61 assert_eq!(1i, match Some('x') {
62 some!(char_x!()) => 1i,
66 assert_eq!(1i, match Some('x') {
72 let ident_pat!(x) = 2i;