-
Notifications
You must be signed in to change notification settings - Fork 279
Fix the reorganize_definitions refactoring #1364
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
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
e715943
to
6aa13a0
Compare
e3fb41a
to
c717e17
Compare
6aa13a0
to
6d527b1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Several questions inline; everything else looks good.
6d527b1
to
8edb5f0
Compare
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
#[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)) | ||
}; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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).
9804b07
to
9b5ba1b
Compare
Some fixes to the
reorganize_definitions
transform for c2rust-refactor to make it work again.