Skip to content

Comments

refactor: tests: compile and format old and new .rs snapshot tests#1609

Merged
kkysen merged 17 commits intomasterfrom
kkysen/refactor-tests-compile-fmt
Feb 25, 2026
Merged

refactor: tests: compile and format old and new .rs snapshot tests#1609
kkysen merged 17 commits intomasterfrom
kkysen/refactor-tests-compile-fmt

Conversation

@kkysen
Copy link
Contributor

@kkysen kkysen commented Feb 24, 2026

This also checks that the before (old) and after (new) .rs files for the refactor snapshot tests are well-formatted and compile, with options to disable each of them.

Some of these tests have compile errors, so we have the option to disable them. For example, rename_unnamed.rs has src loc annotations that are rustc errors. test_reflect.rs produces type annotations that aren't correct syntax, so that doesn't compile. And for formatting, sometimes what we want to test, like reorder_derives.rs, is obviated if we format it first.

Base automatically changed from kkysen/c2rust-rust-tools to master February 24, 2026 01:27
This refactors `test_refactor` into a `fn refactor`/`struct RefactorTest` builder.
…st-refactor`'s snapshot tests

This means that if we say we expect an error but it doesn't, then panic.
…missing `unsafe` block around `std::mem::uninitialized()`
…/ `#[repr(uN)]`s

`#[repr(uN)]` isn't allowed on `struct`s, so this is just a compile error.
…l(c2rust)]` and enable compiling `rename_unnamed.rs`

`rename_unnamed.rs` had compile errors due to the `#[header_src = "..."]`s and `#![register_tool(c2rust)]`,
but these aren't actually needed for `rename_unnamed`, just for `reorganize_definitions`.
So we can remove that and enable checking `rename_unnamed.rs` (old and new) with `rustc`.
@kkysen kkysen force-pushed the kkysen/refactor-tests-compile-fmt branch from a8dc496 to eb35127 Compare February 24, 2026 01:32
@kkysen kkysen requested a review from ahomescu February 24, 2026 01:39
@kkysen kkysen merged commit 06ae194 into master Feb 25, 2026
11 checks passed
@kkysen kkysen deleted the kkysen/refactor-tests-compile-fmt branch February 25, 2026 00:45
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.

2 participants