Skip to content

crates.io feature validation inconsistent with cargo/rustc #1395

Closed
@iliekturtles

Description

@iliekturtles

crates.io's feature validation is inconsistent and rejects features with "." even though these features are accepted by cargo/rustc. This validation isn't applied when using cargo publish --dry-run.

$ 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

This appears to be the check:

if !Crate::valid_feature_name(&s) {

As a workaround I was able to change the 1.20.0 feature to 1_20_0.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions