Skip to content

Conversation

@kkysen
Copy link
Contributor

@kkysen kkysen commented 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.

This partially reverts 2bd339d,
but only the changes to `c2rust-transpile/src/lib.rs`.

We can't move `c2rust-refactor/src/bin/c2rust-refactor.rs`
back to `c2rust/src/bin/c2rust-refactor.rs` because that introduces
a dependency on `c2rust-refactor` from `c2rust`, which we can't have.
`c2rust-refactor` is nightly-pinned, but `c2rust`
(and its dependent `c2rust-transpile`) work on stable.
Otherwise, `cargo install c2rust` won't work anymore.

By keeping the explicit dependency detached,
`--reorganize-definitions` should work if the `c2rust-refactor` binary exists.
Furthermore, with the explicit dependency, the wrong `librustc_driver-*.so` was dependended on,
which broke `c2rust-refactor`'s dynamic dependencies.
Without it, it works.
This should work for suggestions even if `c2rust-refactor` is not installed,
which may be the case since `c2rust` doesn't (and can't) explicitly depend on `c2rust-refactor`.
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.

LGTM.

@kkysen kkysen merged commit 4e79794 into master Nov 11, 2025
5 checks passed
@kkysen kkysen deleted the kkysen/reorganize-definitions-restore branch November 11, 2025 02:59
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