Fix lalrpop-util missing the "lexer" feature under Cargo resolver v2 - #63
Open
KoenZandvlietAltius wants to merge 1 commit into
Open
Conversation
core/Cargo.toml requests lalrpop's "lexer" feature only under [build-dependencies] (used to generate the parser from the grammar), but [dependencies]'s lalrpop-util (used by the generated code itself) doesn't request the same feature. Cargo's older resolver unified build- and normal-dependency features, masking this; resolver v2 (the default for any consumer on edition 2021+) correctly keeps them separate, so consumers depending on scallop-core directly fail with: error[E0433]: cannot find `lexer` in `__lalrpop_util` This doesn't surface building scallop-core inside this repo's own workspace, only when embedded as a dependency by a resolver-v2 consumer. Verified: reproduced the failure by depending on scallop-core from a resolver-v2 project, confirmed this one-line fix resolves it, and confirmed reverting it reproduces the exact same 17 errors again.
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.
Problem
Consuming
scallop-coreas a plain Rust dependency from a project using Cargo's resolver v2 (the default for any crate on edition 2021+) fails to compile:Cause
core/Cargo.tomlrequestslalrpop's"lexer"feature only under[build-dependencies](used to generate the parser code from the grammar), but[dependencies]'slalrpop-util(used by the generated code itself, at normal compile time) doesn't request that same feature:Under Cargo's older resolver, build- and normal-dependency features were unified, so this went unnoticed. Resolver v2 correctly keeps them separate, so the generated
grammar.rscan no longer find__lalrpop_util::lexer::MatcherBuilder. This doesn't surface when buildingscallop-coreinside this repo's own workspace, only when it's pulled in as a dependency by a resolver-v2 consumer.Fix
Verification
Found while embedding
scallop-coreas a Rust dependency in another project. Confirmed withcargo tree -i lalrpop-util, which shows the crate resolved twice — once with the feature (via thelalrpopbuild-dependency), once without (viascallop-core's own direct dependency). Verified both directions against that consuming project: reverting this change reproduces the exact 17E0433/E0432errors again, and applying it resolves them cleanly.