Skip to content

transpile: save platform-specific .rs files, too #1291

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

kkysen
Copy link
Contributor

@kkysen kkysen commented Jul 21, 2025

We already save platform-specific .snap files for snapshot tests, but the .rs files still clash, and we aren't checking them in for all platforms. This moves the .rs files to .{platform}.rs. And since the crate name can't have a . in it, we need to explicitly set the crate name to the file stem now.

This also cleans up some other little stuff. dummy.c isn't needed anymore since we now have 2 other platform-specific snapshots. Also, set the .rlib path with -o explicitly instead of guessing what the output file will be named.

kkysen added 3 commits July 21, 2025 03:24
Since `-o /dev/null` doesn't work since intermediates are created in the same directly,
we compile to the normal `.rlib` output path and then delete it.
This just makes that explicit with `-o` so it's more obviously correct,
and we can name the `.rlib` anything we want as well.
We already save platform-specific `.snap` files for snapshot tests,
but the `.rs` files still clash, and we aren't checking them in for all platforms.
This moves the `.rs` files to `.{platform}.rs`.
And since the crate name can't have a `.` in it,
we need to explicitly set the crate name to the file stem now.
@kkysen kkysen requested a review from fw-immunant July 21, 2025 10:27
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.

Is there any major benefit to having these .rs files checked in? They seem redundant with the .snap files. I would prefer fewer files and less redundancy if possible.

Copy link
Contributor Author

@kkysen kkysen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any major benefit to having these .rs files checked in? They seem redundant with the .snap files. I would prefer fewer files and less redundancy if possible.

I originally checked them in because they were easier for local review. *.rs files are easier to work with (syntax highlighting, etc.), but now that I think about it, that doesn't necessarily mean they need to be checked in, just generated. The one significant advantage I've still seen is that diff tools like delta and GitHub's review are better at syntax highlighting *.rs diffs that are recognized as Rust vs. *.snap diffs that are not. So it does help with review.

That said, if we want to stop checking in the generated *.rs files, I'd prefer to do that in a separate PR. There are a few other small changes here, and even if we don't check them in locally, it's still helpful to have them correctly named.

@fw-immunant
Copy link
Contributor

A separate PR is fine. Could it precede this one to simplify the diffstats for everything that's in flight?

Copy link
Contributor Author

@kkysen kkysen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A separate PR is fine. Could it precede this one to simplify the diffstats for everything that's in flight?

I'd prefer the opposite. Otherwise I'll have to go back and modify each commit.

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