Description
With the "2018" edition, Rust library and binary root source files no longer include extern crate
statements. This removes the original mechanism by which an external crate dependency can be renamed.
Cargo has implemented dependency renaming. This feature first appeared in this commit:
rust-lang/cargo@79942fe. In the most recent implementation (as of time of writing) this field is renamed multiple times before entering the link_to function where linking actually happens.
- RegistryDependency.package -> Dependency.explicit_name_in_toml
- Dependency.explicit_name_in_toml -> BuildContext.extern_crate_name
I suspect our only real option here will be to add a param "rename_deps" (bikeshed welcome) that maps from string -> string:
rust_library(
name = "foo",
deps = [
"//bar",
]
rename_deps = { "bar": "baz" }
)
EDIT: 2018-12-11 ~11:00PST:
"rename_deps" is not equivalent to the Cargo implementation. Cargo implements this via a field on the dependency itself, meaning that it is theoretically possible to use this feature to include two "foo" crates which are independently renamed to something else. I have no idea how we'd replicate this while following the rust_library.deps
convention...