Problem
[package]
name = "example"
version = "0.1.0"
edition = "2018"
[dependencies]
"haha this isn't a valid name 馃悰" = { package = "libc", version = "0.1" }
$ cargo build --verbose
Fresh libc v0.1.12
Compiling xz v0.1.0 (/private/tmp/xz)
Running `rustc --edition=2018 --crate-name xz src/main.rs --color always --crate-type bin --emit=dep-info,link -C debuginfo=2 -C metadata=7ea0f6c7f3b6b365 -C extra-filename=-7ea0f6c7f3b6b365 --out-dir /private/tmp/xz/target/debug/deps -C incremental=/private/tmp/xz/target/debug/incremental -L dependency=/private/tmp/xz/target/debug/deps --extern 'haha this isn'\''t a valid name 馃悰=/private/tmp/xz/target/debug/deps/liblibc-aee2768e37366de4.rlib'`
Possible Solution(s)
I'd expect a warning when the key names are not valid Rust identifiers.
Notes
$ cargo --version --verbose
cargo 1.32.0 (8610973aa 2019-01-02)
release: 1.32.0
commit-hash: 8610973aaf48615ba7dc9a38a9a2795ba6f36a31
commit-date: 2019-01-02
Oh dear, that's definitely a bug!
Is it too heavy handed to add a call to valid_package_name() here? We actually allow dependencies named "!", only failing to resolve.
I would probably validate during toml parsing (somewhere like here).
I'd like to take this!
Most helpful comment
I'd like to take this!