Fix hotpatch cascade replaying workspace crates not built for the active target - #5746
Open
humdrum00001010 wants to merge 1 commit into
Open
Conversation
…t from the hotpatch cascade `patch_rebuild()`'s cascade walk uses `workspace_dependents_of()`, which returns reverse-dependents from the whole-workspace, target-agnostic Cargo metadata graph. A crate can be a workspace dependent of a changed crate without ever being part of the served build's target/crate graph (e.g. a native-only sibling of a wasm32 app), in which case it has no captured rustc invocation to replay and `compile_workspace_hotpatch()` hard-errors with "Missing rustc args for replay". Filter the cascade to only follow dependents that were actually captured in the fat build's `workspace_rustc_args`, via a new `WorkspaceRustcArgs::contains_crate` helper (covered by unit tests) that mirrors the `.lib`/`.bin` lookup `workspace_hotpatch_replay_args()` already does. Fixes DioxusLabs#5540
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
patch_rebuild()'s hot-patch cascade walksworkspace_dependents_of(), which returns reverse-dependents from the whole-workspace, target-agnostic Cargo metadata graph. A workspace member can depend on a changed crate without ever being part of the served build's target/crate graph (e.g. a native-only sibling of a wasm32 app, or an unrelated_tests/example binary in the same workspace) - in that case it has no captured rustc invocation to replay, andcompile_workspace_hotpatch()hard-errors withMissing rustc args for replay: '<crate>', leaving the builder in a failed state untildx serveis restarted.Filter the cascade to only follow dependents that were actually captured in the fat build's
workspace_rustc_args, via a newWorkspaceRustcArgs::contains_cratehelper (unit tested) that mirrors the.lib/.binlookupworkspace_hotpatch_replay_args()already does. This keepsworkspace_dependents_of()itself target-agnostic for its other callers, and a crate can no longer reachlink.rsin a state that lookup would reject.Verified manually with a 3-crate workspace (wasm app + shared lib + native-only sibling depending on the shared lib): before the fix, editing the shared lib crashed the hot-patch rebuild with
Missing rustc args for replay: 'native_ffi'; after the fix the same edit hot-patches successfully.This addresses the same root cause as #5596 (closed as a duplicate of #5540) - see the repro/analysis posted on #5540. (see comments)
Closes #5540