Skip to content

Support renaming dependencies in rust_library and rust_binary #171

Open
@acmcarther

Description

@acmcarther

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.

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...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions