Normalize crate names when reading Cargo.toml #4383
Labels
A-crate-dependencies
Area: [dependencies] of any kind
A-interacts-with-crates.io
Area: interaction with registries
C-feature-request
Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`
This seeks to address two problems.
-
vs_
The Rust community tends to use
-
and_
as word separators in package/crate names. However, the allowance of both characters, and the fact that-
is invalid in a crate name in Rust source, has created something of a messy situation. For some crates, users need to write-
in their Cargo.toml and_
in their Rust source (tokio-core
,rustc-serialize
,num-traits
). For others,_
is used in both places (lazy_static
,serde_derive
,symbolic_expressions
). This creates a point of confusion and imposes additional cognitive overhead.Proposal: teach Cargo to treat these characters as equivalent when reading crate names from Cargo.toml, normalizing them to
_
(matching their representation in Rust source).According to @Manishearth:
cAsE senSITIvIty
What was that one package called?
inflector
? Oh, no, it'sInflector
. But crates.io will recognize any ofinflector
,Inflector
, or eveninFLeCtOr
. And in Rust source, you're expected to writeextern crate inflector
.Proposal: internally lowercase crate names read from Cargo.toml and treat case variations as equivalent. Since Rust only allows ASCII crate names, there's no need to deal with any of the oddities of Unicode case normalization.
The text was updated successfully, but these errors were encountered: