2018-08-30 07:18:55 -05:00
|
|
|
// run-pass
|
2018-09-25 16:51:35 -05:00
|
|
|
#![allow(dead_code)]
|
2014-06-26 19:41:43 -05:00
|
|
|
// after fixing #9384 and implementing hygiene for match bindings,
|
|
|
|
// this now fails because the insertion of the 'y' into the match
|
|
|
|
// doesn't cause capture. Making this macro hygienic (as I've done)
|
|
|
|
// could very well make this test case completely pointless....
|
|
|
|
|
2015-03-22 15:13:15 -05:00
|
|
|
// pretty-expanded FIXME #23616
|
|
|
|
|
2013-12-16 19:04:02 -06:00
|
|
|
enum T {
|
2015-03-25 19:06:52 -05:00
|
|
|
A(isize),
|
|
|
|
B(usize)
|
2013-12-16 19:04:02 -06:00
|
|
|
}
|
|
|
|
|
2015-01-02 16:44:21 -06:00
|
|
|
macro_rules! test {
|
2014-06-26 19:41:43 -05:00
|
|
|
($id:ident, $e:expr) => (
|
2015-03-25 19:06:52 -05:00
|
|
|
fn foo(t: T) -> isize {
|
2013-12-16 19:04:02 -06:00
|
|
|
match t {
|
2014-11-06 02:05:53 -06:00
|
|
|
T::A($id) => $e,
|
|
|
|
T::B($id) => $e
|
2013-12-16 19:04:02 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
)
|
2015-01-02 16:44:21 -06:00
|
|
|
}
|
2013-12-16 19:04:02 -06:00
|
|
|
|
2015-03-25 19:06:52 -05:00
|
|
|
test!(y, 10 + (y as isize));
|
2013-12-16 19:04:02 -06:00
|
|
|
|
|
|
|
pub fn main() {
|
2014-11-06 02:05:53 -06:00
|
|
|
foo(T::A(20));
|
2013-12-16 19:04:02 -06:00
|
|
|
}
|