-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Support macro invocations in match branch position #2654
Comments
Do you mean macros expanding to multiple |
Multiple match arms would be nice, yeah. |
@petrochenkov That just supports or-patterns; but afaik you cannot generate match arms ( |
This would be useful for this crate: https:/mcmah309/error_set Currently users have to do this if they want to handle disjointedness with a macro let val = coerce!(setx => {
Ok(val) => val,
Err(SetX::X) => {}, // handle disjointedness
{ Err(SetX) => return Err(SetY) } // terminal coercion
}); But this would be a lot better if it was possible let val = match setx {
Ok(val) => val,
Err(SetX::X) => {}, // handle disjointedness
coerce!(Err(SetX) => return Err(SetY)) // terminal coercion
}; |
Sorry if there's already and issue for this, but I couldn't find one.
On many occasions I've wanted to use macros to generate
match
branches. eg.Is there a reason not to support this?
The text was updated successfully, but these errors were encountered: