Skip to content

Conversation

@kkysen
Copy link
Contributor

@kkysen kkysen commented Nov 10, 2025

Most of the changes from #1414 with #1451 split out. In combination with #1451, supersedes #1414.

kkysen added a commit that referenced this pull request Nov 10, 2025
@kkysen kkysen force-pushed the kkysen/reorganize-definitions-prereqs branch from fc57cd9 to 8e391d8 Compare November 10, 2025 17:45
@kkysen kkysen requested a review from fw-immunant November 10, 2025 18:34
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.

@fw-immunant, this is your own code, so I'm not sure if it makes sense for you to review, but it LGTM modulo a few cleanups I added in the last commit.

@fw-immunant
Copy link
Contributor

fw-immunant commented Nov 10, 2025

We should probably avoid entirely disabling the caching of zero values; I think I noticed c2rust-transpile taking significantly longer after that change. I believe the rest of these fixes were ready to merge.

@fw-immunant
Copy link
Contributor

Cleanups in the final commit look good.

this closure is called when exporting types, and a convert_type method already exists
other exports from the submodule (for types it defines via enum/struct definitions) are already added to this set, but reexports were not.

this meant that if we organized imports of std/core types into a submodule (which the transpiler itself does when `--reorganize-definitions` is passed), these imports would then be missing from the main module.
these will have `use`s added unconditionally with the stdlib path if the main module uses them directly, so in order to allow deduplication without tracing through reexports, we should have the main module import these from their original (stdlib) location, not the reexported one
@kkysen kkysen force-pushed the kkysen/reorganize-definitions-prereqs branch from 8e391d8 to ed6ed73 Compare November 11, 2025 00:05
@kkysen
Copy link
Contributor Author

kkysen commented Nov 11, 2025

We should probably avoid entirely disabling the caching of zero values; I think I noticed c2rust-transpile taking significantly longer after that change. I believe the rest of these fixes were ready to merge.

I removed 828c6974b from this PR for now. I'll fix that in its own PR, and I also split out the non-enable-by-default parts of --reorganize-definitions in #1454 so that it can merge without these fixes. Is this PR good to go now?

@fw-immunant
Copy link
Contributor

We should probably avoid entirely disabling the caching of zero values; I think I noticed c2rust-transpile taking significantly longer after that change. I believe the rest of these fixes were ready to merge.

I removed 828c6974b from this PR for now. I'll fix that in its own PR, and I also split out the non-enable-by-default parts of --reorganize-definitions in #1454 so that it can merge without these fixes. Is this PR good to go now?

The only hesitation I have about merging this as-is is that the codepaths it alters are not tested by CI, because they only apply when --reorganize-definitions is passed to the transpiler.

@kkysen
Copy link
Contributor Author

kkysen commented Nov 11, 2025

They already passed in CI before, though. And we have other refactorer code that isn't tested in CI yet, still a WIP.

kkysen added a commit that referenced this pull request Nov 11, 2025
This is split off from #1451, but doesn't enable
`--reorganize-definitions` by default, so it shouldn't need the fixes in
#1452 yet, of which the disabling caching of zero values needs to be
fixed. Also, I'm not sure if we should enable `--reorganize-definitions`
by default, since `c2rust-refactor` won't be installed by default.
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