Crates.io: Cannot publish packages that enable features in dependencies (regression)

Created on 9 Apr 2018  路  6Comments  路  Source: rust-lang/crates.io

Hi, I'm trying to publish a crate that contains the following in its Cargo.toml

[features]
nightly = ["radix_51", "subtle/nightly", "clear_on_drop/nightly"]

to enable nightly features in dependencies. However, it's no longer possible to publish this crate to crates.io, since it fails with:

error: api errors: invalid upload request: invalid value: string "subtle/nightly", expected a valid feature name at line 1 column 2315

This appears to be the error generated by this code, and the same Cargo.toml was accepted up until a few days ago, so my guess is that this is a recent regression?

Most helpful comment

:eyes:

All 6 comments

This regression has been introduced in PR #1331:
Feature Deserializer uses Crate::valid_feature_name() which is now Crate::valid_feature().

A quick fix would be to change src/views/krate_publish.rs:124, but I'm wondering if the distinction between Feature and FeatureName is necessary? @sgrif?

Thanks for looking into this! It would be great if it was possible to deploy the fix.

when fix should be expected? it is not possible to publish packages with re-export features

:eyes:

Sorry for the delay in looking into this. The fix in #1335 is correct. I've added a regression test to #1336, and will get it deployed once it's merged.

I'm wondering if the distinction between Feature and FeatureName is necessary?

It is. A feature is what can appear in foo = { version = "*", features = [...] }. It is between 1 and 2 feature names separated by a slash (technically a crate name followed by a feature name, but that's the same in this case). A feature name is what can appear in [features] as a key. It cannot contain a slash.

It would be great if it was possible to deploy the fix.

I've made sure everyone who can deploy was pinged.

The fix for this has been deployed. You should be able to publish your crate now. If you're seeing any more problems, please open a new issue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dtolnay picture dtolnay  路  6Comments

vrdhn picture vrdhn  路  4Comments

tomaka picture tomaka  路  6Comments

lilianmoraru picture lilianmoraru  路  8Comments

seeekr picture seeekr  路  7Comments