Skip to content

features2 in index broke cargo backward compatibility #6135

Closed
@Turbo87

Description

@Turbo87

Current Behavior

According to https://www.reddit.com/r/rust/comments/11348jp/comment/j8o4nn6/ ripgrep can no longer be built by older cargo versions (e.g. 1.13).

Expected Behavior

Older cargo versions should be able to still build ripgrep

Steps To Reproduce

according to the Reddit thread:

clone the ripgrep repo and run cargo +1.13.0 b --verbose

Environment

No response

Anything else?

We have identified that the issue is related to how we introduced features2 to the index. ripgrep appears to use clap and in v4.0.0-rc.1 clap started to use the dep: prefix, causing the index to use features2 field.

The way clap used it and crates.io split the features map into features and features2 resulted in the following:

{
  "features": {
    "unstable-doc": [
      "derive"
    ]
  },
  "features2": {
    "derive": [
      "dep:clap_derive",
      "dep:once_cell"
    ]
  }
}

You can see that the unstable-doc feature depends on the derive feature. But since derive is in features2 the old cargo version thinks that the feature does not exist.

When splitting the feature maps we should have recursively moved the unstable-doc feature to features2 too, because it depends on a feature which is itself in features2.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    Status

    For next meeting

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions