2019-10-30 11:34:00 -05:00
|
|
|
// run-pass
|
|
|
|
|
|
|
|
// Test that failing macro matchers will not cause pre-expansion errors
|
|
|
|
// even though they use a feature that is pre-expansion gated.
|
|
|
|
|
2022-04-17 10:00:10 -05:00
|
|
|
#[allow(unused_macro_rules)]
|
2019-10-30 11:34:00 -05:00
|
|
|
macro_rules! m {
|
2023-02-27 07:07:44 -06:00
|
|
|
($e:expr) => {
|
|
|
|
0
|
|
|
|
}; // This fails on the input below due to `, foo`.
|
|
|
|
($e:expr,) => {
|
|
|
|
1
|
|
|
|
}; // This also fails to match due to `foo`.
|
|
|
|
(do yeet $e:expr, foo) => {
|
|
|
|
2
|
|
|
|
}; // Successful matcher, we should get `2`.
|
2019-10-30 11:34:00 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
2023-02-27 07:07:44 -06:00
|
|
|
assert_eq!(2, m!(do yeet 42, foo));
|
2019-10-30 11:34:00 -05:00
|
|
|
}
|