Skip to content

Conversation

ahomescu
Copy link
Contributor

Some fixes to the reorganize_definitions transform for c2rust-refactor to make it work again.

@ahomescu ahomescu changed the base branch from master to ahomescu/restore_refactor September 16, 2025 21:47
@ahomescu ahomescu force-pushed the ahomescu/fix_reorganize_definitions branch from f0c9f2a to 5d6a751 Compare September 17, 2025 03:58
@ahomescu ahomescu force-pushed the ahomescu/restore_refactor branch from b0a8be1 to a3464ac Compare September 17, 2025 03:58
@ahomescu ahomescu force-pushed the ahomescu/fix_reorganize_definitions branch 3 times, most recently from e527293 to 7968d29 Compare September 18, 2025 02:08
@ahomescu ahomescu force-pushed the ahomescu/restore_refactor branch from cae38e2 to da612cb Compare September 18, 2025 02:09
@ahomescu ahomescu force-pushed the ahomescu/fix_reorganize_definitions branch from 7968d29 to 17261ed Compare September 18, 2025 02:11
@ahomescu ahomescu force-pushed the ahomescu/restore_refactor branch from da612cb to 073e366 Compare September 18, 2025 02:11
@ahomescu ahomescu force-pushed the ahomescu/fix_reorganize_definitions branch 3 times, most recently from 1720b7c to 5c20a5e Compare September 18, 2025 02:46
@ahomescu ahomescu force-pushed the ahomescu/restore_refactor branch from 4a917b1 to b998b55 Compare September 18, 2025 02:46
@ahomescu ahomescu force-pushed the ahomescu/fix_reorganize_definitions branch 2 times, most recently from 657816b to 7f25d95 Compare September 18, 2025 05:32
@ahomescu ahomescu force-pushed the ahomescu/restore_refactor branch from 36fd226 to c351a8f Compare September 18, 2025 05:32
@ahomescu ahomescu force-pushed the ahomescu/fix_reorganize_definitions branch from 7f25d95 to 28e3158 Compare September 18, 2025 05:42
@ahomescu ahomescu force-pushed the ahomescu/restore_refactor branch from c351a8f to 71e9d3d Compare September 18, 2025 05:43
@ahomescu ahomescu force-pushed the ahomescu/fix_reorganize_definitions branch from 28e3158 to 1fb194a Compare September 18, 2025 06:07
@ahomescu ahomescu force-pushed the ahomescu/restore_refactor branch from 71e9d3d to c42bdd0 Compare September 18, 2025 06:08
@ahomescu ahomescu force-pushed the ahomescu/fix_reorganize_definitions branch 3 times, most recently from 3b6b204 to 0f281b4 Compare September 19, 2025 02:54
@ahomescu ahomescu force-pushed the ahomescu/fix_reorganize_definitions branch from 0f281b4 to e715943 Compare October 3, 2025 21:22
@ahomescu ahomescu requested a review from fw-immunant October 7, 2025 18:20
@ahomescu ahomescu force-pushed the ahomescu/fix_reorganize_definitions branch from e715943 to 6aa13a0 Compare October 7, 2025 22:26
@ahomescu ahomescu force-pushed the ahomescu/restore_refactor branch from e3fb41a to c717e17 Compare October 7, 2025 22:26
@ahomescu ahomescu force-pushed the ahomescu/fix_reorganize_definitions branch from 6aa13a0 to 6d527b1 Compare October 7, 2025 22:46
Copy link
Contributor

@fw-immunant fw-immunant left a 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.

@ahomescu ahomescu force-pushed the ahomescu/fix_reorganize_definitions branch from 6d527b1 to 8edb5f0 Compare October 8, 2025 23:03
@ahomescu ahomescu force-pushed the ahomescu/restore_refactor branch from c717e17 to 2ec9dfd Compare October 8, 2025 23:03
@ahomescu ahomescu force-pushed the ahomescu/fix_reorganize_definitions branch from 8edb5f0 to b6d2c9e Compare October 8, 2025 23:10
@ahomescu ahomescu force-pushed the ahomescu/restore_refactor branch from 2ec9dfd to 7bd3b4e Compare October 8, 2025 23:10
@ahomescu ahomescu force-pushed the ahomescu/fix_reorganize_definitions branch from b6d2c9e to cd518be Compare October 8, 2025 23:14
@ahomescu ahomescu force-pushed the ahomescu/restore_refactor branch from 7bd3b4e to a77dce1 Compare October 8, 2025 23:14
@ahomescu ahomescu force-pushed the ahomescu/fix_reorganize_definitions branch from cd518be to 9804b07 Compare October 8, 2025 23:20
@ahomescu ahomescu force-pushed the ahomescu/restore_refactor branch from a77dce1 to 51fbbcd Compare October 8, 2025 23:20
Base automatically changed from ahomescu/restore_refactor to master October 8, 2025 23:57
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))
};
}
Copy link
Contributor

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.

Copy link
Contributor Author

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).

@ahomescu ahomescu force-pushed the ahomescu/fix_reorganize_definitions branch from 9804b07 to 9b5ba1b Compare October 14, 2025 21:01
@ahomescu ahomescu merged commit 5acd0c8 into master Oct 14, 2025
5 checks passed
@ahomescu ahomescu deleted the ahomescu/fix_reorganize_definitions branch October 14, 2025 22:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants