Skip to content

Opt into c2rust per item#66

Merged
chrysn merged 4 commits into
mainfrom
minimal-c2rust-alternative
May 13, 2026
Merged

Opt into c2rust per item#66
chrysn merged 4 commits into
mainfrom
minimal-c2rust-alternative

Conversation

@chrysn

@chrysn chrysn commented Apr 30, 2026

Copy link
Copy Markdown
Member

#55 and its sibling #65 are limited by even IWYU pulling in lots of idioms.

Maybe we can get rid of what was probably a mistake in 2020: including everything (which was done because the items we need are all static functions or macros, and there's no "public" declaration).

While this will initially break everything, later commits can go through
the actually used parts and make them opt-in.
@chrysn chrysn self-assigned this Apr 30, 2026
@chrysn chrysn force-pushed the minimal-c2rust-alternative branch from f578aa8 to 8f8e257 Compare April 30, 2026 09:29
chrysn added a commit to chrysn-pull-requests/RIOT that referenced this pull request May 1, 2026
chrysn added a commit to RIOT-OS/rust-riot-wrappers that referenced this pull request May 12, 2026
… as I'm not sure whether the -sys tests really cover all the same tests (should all move to murdock)
chrysn added a commit to chrysn-pull-requests/RIOT that referenced this pull request May 12, 2026
chrysn added a commit to chrysn-pull-requests/RIOT that referenced this pull request May 12, 2026
@chrysn chrysn changed the title Alternative approach to making c2rust use more minimal: Per-item opt-in Opt into c2rust per item May 13, 2026
chrysn added a commit that referenced this pull request May 13, 2026
@chrysn chrysn marked this pull request as ready for review May 13, 2026 12:15
@chrysn

chrysn commented May 13, 2026

Copy link
Copy Markdown
Member Author

I've given this some testing through RIOT-OS/rust-riot-wrappers#154 and trying it on the riot-examples, so I think this is the right path -- and now that 0.8 is in main, it is becoming mergeable.

The implementation is not too confidence-inspiring (creating a single non-static function just to pull the static functions into the translation), but it kind'a fits the style of the c2rust parts in that … well, it works even though it's not pretty.

The bindgen patch doesn't really fit with the rest (although it fits the theme of making things work for native again); are reviewers OK with that or should I split the PR?

@chrysn chrysn requested review from Teufelchen1 and maribu May 13, 2026 12:20
@chrysn chrysn merged commit 28c8806 into main May 13, 2026
4 checks passed
@chrysn chrysn deleted the minimal-c2rust-alternative branch May 13, 2026 13:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants