-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
array_vec! doesn't seem to work in all cases until you reorder macros' match arms. #142
Comments
yeah this is some macro rules nonsense stuff for sure. I'd like to say "we just swap the match arm order", but we do have to be careful here because we could maybe break working code. what i would like to see as a solution here is a PR with the macros fixed, and also with several test cases added to help codify the macro's intended usage to avoid future weird macro breaks. |
Hmm... I think I can write up a PR for that! |
Hmmm... Just swapping the rules in the macro around breaks other tests.... Looks like this issue isn't as simple as it seems... The only thing that works for now is adding a distinct symbol to the "fully explicit" variant, but it's clearly not what we want, since It seems Rust can't decide whether struct T(i32);
#[macro_export]
macro_rules! test {
($array_type:ty => $($elem:expr),+ $(,)?) => {};
($($elem:expr),+) => {};
}
fn main() {
test!(T(2));
} This seems to be very wrong, because UPD |
So the issue boils down to Rust macros not doing |
The current
array_vec
macro seems to have problems with some inputs. If you give it the following inputThe compilation will terminate with an error saying
This seems to be an issue even in general cases as shown by this example.
As of this writing, I am not sure if this is because of some kind of bug inside
rustc
or not, so I am opening the issue here for now.The text was updated successfully, but these errors were encountered: