Fix the reorganize_definitions refactoring#1364
Merged
Conversation
f0c9f2a to
5d6a751
Compare
b0a8be1 to
a3464ac
Compare
e527293 to
7968d29
Compare
cae38e2 to
da612cb
Compare
7968d29 to
17261ed
Compare
da612cb to
073e366
Compare
1720b7c to
5c20a5e
Compare
4a917b1 to
b998b55
Compare
657816b to
7f25d95
Compare
36fd226 to
c351a8f
Compare
7f25d95 to
28e3158
Compare
c351a8f to
71e9d3d
Compare
28e3158 to
1fb194a
Compare
71e9d3d to
c42bdd0
Compare
3b6b204 to
0f281b4
Compare
0f281b4 to
e715943
Compare
ahomescu
commented
Oct 7, 2025
e715943 to
6aa13a0
Compare
e3fb41a to
c717e17
Compare
6aa13a0 to
6d527b1
Compare
fw-immunant
reviewed
Oct 7, 2025
Contributor
fw-immunant
left a comment
There was a problem hiding this comment.
Several questions inline; everything else looks good.
c717e17 to
2ec9dfd
Compare
8edb5f0 to
b6d2c9e
Compare
2ec9dfd to
7bd3b4e
Compare
b6d2c9e to
cd518be
Compare
7bd3b4e to
a77dce1
Compare
cd518be to
9804b07
Compare
a77dce1 to
51fbbcd
Compare
kkysen
reviewed
Oct 9, 2025
kkysen
reviewed
Oct 9, 2025
kkysen
reviewed
Oct 9, 2025
kkysen
reviewed
Oct 9, 2025
Comment on lines
+11
to
31
| #[macro_export] | ||
| macro_rules! match_or_else { | ||
| ([$e:expr] $($arm_pat:pat => $arm_body:expr),*; $or_else:expr) => { | ||
| match $e { | ||
| $( $arm_pat => $arm_body, )* | ||
| ref x @ _ => $or_else(x), | ||
| } | ||
| }; | ||
| } | ||
|
|
||
| #[macro_export] | ||
| macro_rules! expect { | ||
| ([$e:expr] $arm_pat:pat => $arm_body:expr) => { | ||
| $crate::match_or!([$e] $arm_pat => $arm_body; | ||
| panic!("expected {}", stringify!($arm_pat))) | ||
| $crate::match_or_else!([$e] $arm_pat => $arm_body; | ||
| |x| panic!("expected {}, got {:?}", stringify!($arm_pat), x)) | ||
| }; | ||
| ([$e:expr] $($arm_pat:pat => $arm_body:expr),*) => { | ||
| $crate::match_or!([$e] $($arm_pat => $arm_body),*; | ||
| panic!("expected one of: {}", stringify!($($arm_pat),*))) | ||
| $crate::match_or_else!([$e] $($arm_pat => $arm_body),*; | ||
| |x| panic!("expected one of: {}, got {:?}", stringify!($($arm_pat),*), x)) | ||
| }; | ||
| } |
Contributor
There was a problem hiding this comment.
What do we need this for? Especially if it's not used, I'd rather not add to expect! given that assert_matches! does the same and is much more standardized.
Contributor
Author
There was a problem hiding this comment.
expect! is used in a ton of places in the project, it would be nice to get rid of it but that's a separate side project. While it's in use, I thought it would be useful for it to output better error messages (and I needed that during development).
kkysen
reviewed
Oct 9, 2025
kkysen
reviewed
Oct 9, 2025
kkysen
reviewed
Oct 9, 2025
9804b07 to
9b5ba1b
Compare
fw-immunant
approved these changes
Oct 14, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Some fixes to the
reorganize_definitionstransform for c2rust-refactor to make it work again.