fix(cli): gate Linux-only self-update symbols behind cfg(unix) - #2572
Open
1688mengdie wants to merge 1 commit into
Open
fix(cli): gate Linux-only self-update symbols behind cfg(unix)#25721688mengdie wants to merge 1 commit into
1688mengdie wants to merge 1 commit into
Conversation
The CLI self-update module installs only on Linux: install_archive has a #[cfg(not(unix))] stub twin and every consumer of GzDecoder, Cursor, Archive, DEPRECATION_WARNING, find_package_dir, validate_entrypoint_pair, validate_plugin_host_resources and copy_plugin_host_resources lives in the #[cfg(unix)] install path. On Windows builds rustc therefore reports these symbols as unused/dead code (unused import `flate2::read::GzDecoder`, `std::io::Cursor`, `tar::Archive`, unused const `DEPRECATION_WARNING`, dead functions `find_package_dir`, `validate_entrypoint_pair`, `validate_plugin_host_resources`, `copy_plugin_host_resources` in the upstream CI build logs). Gate exactly these eight symbols with #[cfg(unix)] so Windows builds no longer emit the warnings while the Linux install path stays unchanged. Adopted-from: taiji 8082098 (import/const gate hunks) and taiji 931acc0 (validate/copy_plugin_host_resources gate hunks). Test: cargo check --locked -p bitfun-cli on Windows, exit 0, no remaining warnings for the self_update module. AI: implemented with AI assistance, lightly tested (cargo check only).
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.
Summary
Fixes #2566
Gate the eight Linux-only symbols of the CLI self-update module behind
#[cfg(unix)]: the importsflate2::read::GzDecoder/std::io::Cursor/tar::Archive(lines 2/8/12), theDEPRECATION_WARNINGconst, and thefind_package_dir/validate_entrypoint_pair/validate_plugin_host_resources/copy_plugin_host_resourceshelpers.The module only performs a real installation on Linux (
install_archiveis behind#[cfg(unix)]with a#[cfg(not(unix))]stub twin), so on Windows builds rustc reported all eight symbols as unused imports / dead code in the CI logs (see issue #2566 for the run evidence with file:line and rule names).Type and Areas
Type: bug fix (build warnings cleanup)
Areas: Rust CLI
Motivation / Impact
No direct user-facing change. The Linux self-update path is untouched; Windows/non-Unix builds stop emitting 8 unused-import/dead-code warnings that currently pollute every full CI run of
main. This also keeps the codebase ready in case a-D warningsgate is ever introduced.Verification
cargo check --locked -p bitfun-clion Windows: exit 0, warnings for the self_update module gone (baseline 19 warnings for the crate down to 11; the remaining ones are other symbols covered by separate PRs).grep -c '#\[cfg(unix)\]' src/apps/cli/src/self_update.rsreports 9 (8 new gates + the pre-existinginstall_archivegate); cross-platform live paths (spawn_detached_install,update_from_configured_sources) are untouched.Reviewer Notes
#[cfg(unix)]above declarations whose consumers are all inside the#[cfg(unix)]install path.#[allow]suppression is introduced.Checklist