2018-08-30 12:18:55 +00:00
|
|
|
// run-pass
|
2018-09-25 21:51:35 +00:00
|
|
|
#![allow(dead_code)]
|
2014-06-27 00:41:43 +00: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 20:13:15 +00:00
|
|
|
// pretty-expanded FIXME #23616
|
|
|
|
|
2013-12-17 01:04:02 +00:00
|
|
|
enum T {
|
2015-03-26 00:06:52 +00:00
|
|
|
A(isize),
|
|
|
|
B(usize)
|
2013-12-17 01:04:02 +00:00
|
|
|
}
|
|
|
|
|
2015-01-02 22:44:21 +00:00
|
|
|
macro_rules! test {
|
2014-06-27 00:41:43 +00:00
|
|
|
($id:ident, $e:expr) => (
|
2015-03-26 00:06:52 +00:00
|
|
|
fn foo(t: T) -> isize {
|
2013-12-17 01:04:02 +00:00
|
|
|
match t {
|
2014-11-06 08:05:53 +00:00
|
|
|
T::A($id) => $e,
|
|
|
|
T::B($id) => $e
|
2013-12-17 01:04:02 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
)
|
2015-01-02 22:44:21 +00:00
|
|
|
}
|
2013-12-17 01:04:02 +00:00
|
|
|
|
2015-03-26 00:06:52 +00:00
|
|
|
test!(y, 10 + (y as isize));
|
2013-12-17 01:04:02 +00:00
|
|
|
|
|
|
|
pub fn main() {
|
2014-11-06 08:05:53 +00:00
|
|
|
foo(T::A(20));
|
2013-12-17 01:04:02 +00:00
|
|
|
}
|