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