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

Crate naming confusion - use underscores always. E.g. tokio-core and serde_derive #44909

Open
gilescope opened this issue Sep 28, 2017 · 2 comments
Labels
C-feature-request Category: A feature request, i.e: not implemented / a PR. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@gilescope
Copy link
Contributor

We need to make things a bit more consistent: 'extern' crate name should equal crate name in the toml file.

For example: tokio-core and serde_derive are both valid crate names.

But

extern crate tokio-core;

is a compile error as it's not a valid rust name. Instead we have to use underscore:

extern crate tokio_core;

Can we ban new crates being published on crates.io with hyphens so that we only have underscores. (Or alternatively ban underscores and only have hyphens). Worst case, can we ensure that no one can publish a crate called tokio_core if there is already a tokio-core as this is a security risk of someone publishing a malicious crate.

@cuviper
Copy link
Member

cuviper commented Sep 28, 2017

Related discussions:
https://internals.rust-lang.org/t/pre-rfc-resolve-support-for-hyphens-in-crate-names/1459
https://internals.rust-lang.org/t/maybe-pre-rfc-improving---in-cargo-crates-io/5251

Worst case, can we ensure that no one can publish a crate called tokio_core if there is already a tokio-core as this is a security risk of someone publishing a malicious crate.

From the latter link above, it sounds like crates.io already prevents case and -/_ collisions.

@TimNN TimNN added the C-feature-request Category: A feature request, i.e: not implemented / a PR. label Oct 1, 2017
@Enselic
Copy link
Member

Enselic commented Sep 21, 2023

Triage: Here is the corresponding cargo issue: rust-lang/cargo#2775 (available from the above links, but I thought it deserved a mention on its own).

@Enselic Enselic added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Sep 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-feature-request Category: A feature request, i.e: not implemented / a PR. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants