fix(core): emit compile_error for --no-default-features (#659)#661
Open
gustav-fff wants to merge 1 commit into
Open
fix(core): emit compile_error for --no-default-features (#659)#661gustav-fff wants to merge 1 commit into
gustav-fff wants to merge 1 commit into
Conversation
`fff-search` supports two mutually exclusive backend features (`ripgrep` default, or `zlob`) but internal cfg gates keyed off `cfg(not(feature = "zlob"))`, meaning the ripgrep code compiled even when the `ripgrep` feature (and its `ignore`/`globset` deps) was off. Building with `--no-default-features` produced a wall of "unresolved crate" errors. Tighten the gates to `all(not(feature = "zlob"), feature = "ripgrep")` and add a top-level `compile_error!` when neither backend is enabled, so the failure is a single actionable message instead of 15 cascading errors. Refs #659
Collaborator
Author
|
[triage-bot] CI note: Honk-Honk 🪿 |
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.
Closes #659
Root cause
fff-searchhas two mutually exclusive backend features (ripgrepdefault,zlob), but internal cfg gates for ripgrep-only code usedcfg(not(feature = "zlob"))instead ofcfg(feature = "ripgrep")— seecrates/fff-core/src/ignore.rs:42,crates/fff-core/src/walk/mod.rs:16,crates/fff-core/src/constraints.rs:172/443/556/580. With--no-default-featuresneither feature is set, so the ripgrep branches were compiled but theignore/globsetdeps (gated ondep:ignore/dep:globsetbehind theripgrepfeature) were absent, yielding 15 cascading "unresolved module or unlinked crate" errors.Fix
all(not(feature = "zlob"), feature = "ripgrep")so the ripgrep code is skipped when the ripgrep feature is off.compile_error!incrates/fff-core/src/lib.rswhen neither backend feature is enabled, so the failure is a single actionable message instead of a cascade.Steps to reproduce
Setup:
git clone https://github.com/dmtrKovalenko/fff.git cd fffTrigger (on pre-fix
main):Expected: build succeeds, or
cargoemits a clear diagnostic identifying the required feature.Actual (pre-fix): 15 errors, first ones:
How verified
Top of
--no-default-featuresoutput after the fix:Automated triage via Gustav. Honk-Honk 🪿