Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Permit '+' in feature name, as in "c++20" #2510

Merged
merged 1 commit into from
May 15, 2020
Merged

Permit '+' in feature name, as in "c++20" #2510

merged 1 commit into from
May 15, 2020

Conversation

dtolnay
Copy link
Member

@dtolnay dtolnay commented May 12, 2020

Up front: I am familiar with the several discussions linked by rust-lang/crates-io-cargo-teams#41 (comment), and the conversation beginning at #1331 (comment). This PR is not motivated by attempting to match whatever behavior Cargo currently has. Instead, it's a small thing I think we can decide now whether to allow. But it's necessary to say no corresponding Cargo change is required to accommodate this crates.io change.

This PR updates feature validation during publish to accept e.g. "c++20" and "dependency/c++20". We continue to not accept "c++20/feature" as the prefix before the slash would normally refer to a crate name of a dependency and a '+' would not be allowed in those.

I am interested in using such feature names in https://github.com/dtolnay/cxx.

In a Cargo.toml plusses appear as:

[features]
default = ["c++20"]
"c++20" = ["my-dependency/c++20"]

To give some slight further justification for why this particular ascii character above other possible characters we might allow: + is pretty common in OS package names in a way that no other currently disallowed character is. Some examples pulled arbitrarily from apt-cache pkgnames | rg '\+':

The actual names of the projects contain +; various ones in the descriptions in the above links are styled as ARPACK++, Memtest86+, Magics++, Paw++, MinSat+, SWISH++, Vera++, Voro++. When binding to something like this behind a feature, using + in the feature name is the most intuitive.

We permit "c++20" and "dependency/c++20". But we do not permit "c++20/feature".

In a Cargo.toml these would appear as:

    [features]
    default = ["c++20"]
    "c++20" = ["my-dependency/c++20"]
@rust-highfive
Copy link

r? @smarnach

(rust_highfive has picked a reviewer for you, use r? to override)

@jtgeibel
Copy link
Member

no corresponding Cargo change is required to accommodate this crates.io change.

If cargo already supports this, then I see no issue and the implementation looks good to me. Do you know if older versions of cargo will also handle this correctly? I've added this to the agenda for our team meeting on Friday to get broader consensus for the change.

@dtolnay
Copy link
Member Author

dtolnay commented May 14, 2020

Thanks @jtgeibel. Yes, every version of Cargo from 1.0.0 to present is able to handle this correctly.

Copy link
Contributor

@smarnach smarnach left a comment

Choose a reason for hiding this comment

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

Thanks for the implementation and the cleanup. This looks all good to me.

We discussed this in the team meeting, and nobody voiced any concerns about this change, so I'm merging this now, and it will go to production soon.

@smarnach
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented May 15, 2020

📌 Commit 5f842f7 has been approved by smarnach

@bors
Copy link
Contributor

bors commented May 15, 2020

⌛ Testing commit 5f842f7 with merge efaa8f8...

@bors
Copy link
Contributor

bors commented May 15, 2020

☀️ Test successful - checks-travis
Approved by: smarnach
Pushing efaa8f8 to master...

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.

5 participants