Prevent macro ambiguity errors
The previous macro_rules! parsers failed when an additional modifier was added with ambiguity errors. The error is pretty unclear as to what exactly the cause here is, but this change simplifies the argument parsing code such that the error is avoided.
This commit is contained in:
parent
6e12110812
commit
e2d3e09b9c
4 changed files with 24 additions and 24 deletions
|
@ -253,17 +253,17 @@ macro_rules! handle_cycle_error {
|
|||
$error.emit();
|
||||
Value::from_cycle_error($tcx)
|
||||
}};
|
||||
([fatal_cycle $($rest:tt)*][$tcx:expr, $error:expr]) => {{
|
||||
([(fatal_cycle) $($rest:tt)*][$tcx:expr, $error:expr]) => {{
|
||||
$error.emit();
|
||||
$tcx.sess.abort_if_errors();
|
||||
unreachable!()
|
||||
}};
|
||||
([cycle_delay_bug $($rest:tt)*][$tcx:expr, $error:expr]) => {{
|
||||
([(cycle_delay_bug) $($rest:tt)*][$tcx:expr, $error:expr]) => {{
|
||||
$error.delay_as_bug();
|
||||
Value::from_cycle_error($tcx)
|
||||
}};
|
||||
([$other:ident $(($($other_args:tt)*))* $(, $($modifiers:tt)*)*][$($args:tt)*]) => {
|
||||
handle_cycle_error!([$($($modifiers)*)*][$($args)*])
|
||||
([$other:tt $($modifiers:tt)*][$($args:tt)*]) => {
|
||||
handle_cycle_error!([$($modifiers)*][$($args)*])
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -271,11 +271,11 @@ macro_rules! is_anon {
|
|||
([]) => {{
|
||||
false
|
||||
}};
|
||||
([anon $($rest:tt)*]) => {{
|
||||
([(anon) $($rest:tt)*]) => {{
|
||||
true
|
||||
}};
|
||||
([$other:ident $(($($other_args:tt)*))* $(, $($modifiers:tt)*)*]) => {
|
||||
is_anon!([$($($modifiers)*)*])
|
||||
([$other:tt $($modifiers:tt)*]) => {
|
||||
is_anon!([$($modifiers)*])
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -283,11 +283,11 @@ macro_rules! is_eval_always {
|
|||
([]) => {{
|
||||
false
|
||||
}};
|
||||
([eval_always $($rest:tt)*]) => {{
|
||||
([(eval_always) $($rest:tt)*]) => {{
|
||||
true
|
||||
}};
|
||||
([$other:ident $(($($other_args:tt)*))* $(, $($modifiers:tt)*)*]) => {
|
||||
is_eval_always!([$($($modifiers)*)*])
|
||||
([$other:tt $($modifiers:tt)*]) => {
|
||||
is_eval_always!([$($modifiers)*])
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -295,11 +295,11 @@ macro_rules! hash_result {
|
|||
([][$hcx:expr, $result:expr]) => {{
|
||||
dep_graph::hash_result($hcx, &$result)
|
||||
}};
|
||||
([no_hash $($rest:tt)*][$hcx:expr, $result:expr]) => {{
|
||||
([(no_hash) $($rest:tt)*][$hcx:expr, $result:expr]) => {{
|
||||
None
|
||||
}};
|
||||
([$other:ident $(($($other_args:tt)*))* $(, $($modifiers:tt)*)*][$($args:tt)*]) => {
|
||||
hash_result!([$($($modifiers)*)*][$($args)*])
|
||||
([$other:tt $($modifiers:tt)*][$($args:tt)*]) => {
|
||||
hash_result!([$($modifiers)*][$($args)*])
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue