Skip to content

Cargo feature name validation inconsistent with crates.io #5554

Closed as not planned
@iliekturtles

Description

@iliekturtles

See rust-lang/crates.io#1395 for original discussion. tl;dr: crates.io validation is working as desired and Cargo needs to be stricter.

Cargo's feature name validation is inconsistent with crates.io and should reject feature names that are not "mostly rust identifiers." Currently Cargo will accept feature names that are rejected by crates.io during cargo publish and cargo publish --dry-run doesn't detect the issue.

$ cargo publish
...
   Uploading uom v0.18.0 (file:///S:/uom)
error: api errors: invalid upload request: invalid value: string "1.20.0", expected a valid feature name
 containing only letters, numbers, hyphens, or underscores at line 1 column 931

Cargo should reject the feature name 1.20.0 prior to attempting to publish.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-featuresArea: features — conditional compilationA-interacts-with-crates.ioArea: interaction with registriesC-feature-requestCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`Command-publish

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions