Skip to content

Add missing enum for crate-type in cargo.json - #6280

Open
lsh4711 wants to merge 2 commits into
SchemaStore:masterfrom
lsh4711:cargo-crate-type-enum
Open

Add missing enum for crate-type in cargo.json#6280
lsh4711 wants to merge 2 commits into
SchemaStore:masterfrom
lsh4711:cargo-crate-type-enum

Conversation

@lsh4711

@lsh4711 lsh4711 commented Aug 31, 2026

Copy link
Copy Markdown

The crate-type field in cargo.json carries x-taplo.docs.enumValues with descriptions for all seven crate types, but the corresponding enum array 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 as crate-type = ["cdylibb"] are not reported.

This adds the enum array, matching the seven values already documented in the field description and in the enumValues list (and their order):

bin, lib, rlib, dylib, cdylib, staticlib, proc-macro

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 cargo itself models crate types as an open set (CrateType::Other(String) in src/compiler/crate_type.rs) and forwards unknown values to rustc, so a future rustc crate type would be reported as invalid until this list is updated. Given that the seven values are already hard-coded in the description and enumValues, that trade-off seems acceptable — but happy to drop this if you would rather keep the field open.

Copilot AI lite review requested due to automatic review settings August 31, 2026 20:11
@github-actions

Copy link
Copy Markdown
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
lsh4711 force-pushed the cargo-crate-type-enum branch from cfb2e6e to a97e4b7 Compare August 31, 2026 20:12

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 enum list for crate-type items, aligned with the existing x-taplo.docs.enumValues documentation.

💡 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"
],
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants