Auto merge of #5461 - matklad:meta-rename, r=alexcrichton
authorbors <bors@rust-lang.org>
Sat, 5 May 2018 21:32:18 +0000 (21:32 +0000)
committerbors <bors@rust-lang.org>
Sat, 5 May 2018 21:32:18 +0000 (21:32 +0000)
commitd0d3cb5ac963eb8c3f83d079b6a547992cac2cc4
tree60fdac8d239a6c95867142a041fc5290afb35b98
parent757112c39f8a5a4f6ffa0b7e29d23a56f03fb931
parenta312c55dcbf5bd814ee2002c92270aaa3dc25c45
Auto merge of #5461 - matklad:meta-rename, r=alexcrichton

Support crate renames in `cargo metadata`

This adds information about (currently unstable) crate renames to metadata. Unfortunately, we already expose dependencies as a list of package ids (which are strings), so we can't easily add a `rename` field easily. For this reason, I've added a parallel `deps` key, which basically deprecates `dependencies` field.

So, the new format looks like this

```JavaScript
{
    "dependencies": [
        "bar 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
        "bar 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)"
    ],
    "deps": [
        {
            "extern_crate_name": "baz", // this one is actually renamed
            "id": "bar 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)"
        },
        {
            "extern_crate_name": "bar",
            "id": "bar 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)"
        }
    ],
    "features": [],
    "id": "foo 0.5.0 (path+file://[..])"
},
```

Questions:

* Is there a better name for `extern_crate_name`? This name is precise, but it's longer than I like, and might become opaque in meaning if we remove `extern crate` from the language :)
* Should we feature gate this (i.e, only produce `deps` if we have a feature in `Cargo.toml`)? I think the answer is yes, but that'll require threading `Features` to `Workspace`...

r? @alexcrichton