Skip to content

Replay the tip package's lib target when hot-patching a lib+bin package - #5779

Open
pauldemarco wants to merge 1 commit into
DioxusLabs:mainfrom
pauldemarco:fix/hotpatch-tip-lib-replay
Open

Replay the tip package's lib target when hot-patching a lib+bin package#5779
pauldemarco wants to merge 1 commit into
DioxusLabs:mainfrom
pauldemarco:fix/hotpatch-tip-lib-replay

Conversation

@pauldemarco

Copy link
Copy Markdown

Fixes #5778.

When the tip package has both a [lib] and a [[bin]], edits to lib code produce an empty patch that reports success: workspace_hotpatch_replay_order excludes the tip package from the replay set, cargo_build only contributes the bin unit's objects, and the lib rlib never reaches the patch link. Full mechanism and the regression history (#4160 implemented by #5291, removed in the #5479 refactor) are in the issue.

The change makes the tip eligible for replay exactly when the captured rustc args contain a {tip}.lib entry. Gating on the captured args rather than the manifest means eligibility uses the same key the replay and rlib lookups will ask for. workspace_hotpatch_replay_args already prefers {crate}.lib over {crate}.bin, and the topo sort handles the tip node since nothing in the workspace depends on it.

Tested against a real lib+bin workspace (bevy app, ~45k lines in the lib, thin main.rs):

  • before: replaying crates: [], patch .so with ~1,900 symbols, none from the app; edits never apply while the CLI logs success
  • after: replaying crates: ["myapp"], ~127,000 symbols including the edited functions by name, edits apply in about 2s, repeatedly, and reverting the edit patches back

Bin-only tips are unaffected: tip_has_lib is false when no {tip}.lib args were captured, so the filter behaves exactly as before.

The tip package is excluded from the workspace hotpatch replay on the
theory that cargo_build compiles it separately. That covers the bin
target, but when the tip also has a lib target (src/lib.rs + a thin
src/main.rs), the lib is consumed as an rlib and never replayed: the
replay set comes back empty, workspace_hotpatch_link_rlibs contributes
nothing, and the patch is linked from the bin's unchanged objects. The
result is an empty patch that reports success, so edits to lib code
silently never apply.

Make the tip eligible for replay when the captured rustc args contain a
{tip}.lib entry. workspace_hotpatch_replay_args already prefers the .lib
key, and the topo sort handles the tip node since nothing in the
workspace depends on it.

This restores what DioxusLabs#5291 added for DioxusLabs#4160; the compile_workspace_deps
path that handled lib+bin tips was removed in the DioxusLabs#5479 refactor.
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.

Hot-patching produces an empty patch when the tip package has both a lib and a bin (regression from #5479)

1 participant