Add missing enum for crate-type in cargo.json - #6280
Open
lsh4711 wants to merge 2 commits into
Open
Conversation
Contributor
|
Thanks for the PR! This section of the codebase is owned by @ya7010 - if they write a comment saying "LGTM" then it will be merged. |
lsh4711
force-pushed
the
cargo-crate-type-enum
branch
from
August 31, 2026 20:12
cfb2e6e to
a97e4b7
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the cargo.json schema to make the crate-type values for Cargo targets enumerable, so editors can offer completions and validators can flag typos/invalid crate types.
Changes:
- Add the missing
enumlist forcrate-typeitems, aligned with the existingx-taplo.docs.enumValuesdocumentation.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+1273
to
+1281
| "enum": [ | ||
| "bin", | ||
| "lib", | ||
| "rlib", | ||
| "dylib", | ||
| "cdylib", | ||
| "staticlib", | ||
| "proc-macro" | ||
| ], |
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.
The
crate-typefield incargo.jsoncarriesx-taplo.docs.enumValueswith descriptions for all seven crate types, but the correspondingenumarray was never present.Because there are no enum values to attach them to, the descriptions are unused: editors offer no completion candidates for
crate-type, and typos such ascrate-type = ["cdylibb"]are not reported.This adds the
enumarray, matching the seven values already documented in the field description and in theenumValueslist (and their order):Verified locally with Even Better TOML (taplo): completion now offers the seven values, each showing its own description from
enumValues, and invalid values are flagged.Note that
cargoitself models crate types as an open set (CrateType::Other(String)insrc/compiler/crate_type.rs) and forwards unknown values torustc, so a futurerustccrate type would be reported as invalid until this list is updated. Given that the seven values are already hard-coded in the description andenumValues, that trade-off seems acceptable — but happy to drop this if you would rather keep the field open.