Skip to content

Crate renaming allows for invalid characters without a warning #6656

@shepmaster

Description

@shepmaster

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Error and warning messages generated by Cargo itself.C-bugCategory: bugE-easyExperience: Easy

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions