Skip to content

cargo-doc overwrites similarly-named library target with binary target #5549

Closed as not planned
@Aehmlo

Description

@Aehmlo

Consider the following Cargo.toml (some contents are redundant, but they're there to be explicit).

[package]
name = "foo"
version = "0.1.0"
authors = ["Some Body <nobody@nowhere.org>"]

[lib]
name = "foo_bar"
path = "src/lib.rs"
doc = true

[[bin]]
name = "foo-bar"
path = "src/main.rs"
doc = true

When cargo doc is run, the resulting documentation has one entry for the crate foo_bar, displaying the documentation extracted from the binary target foo-bar. I presume this has something to do with the the historical "hyphens are underscores in crate names," and I recognize it's quite the edge case, but it just took me about half an hour to figure this out just now and I figured I'd say something about it anyway. It'd be nice if the result would be something more like foo_bar and foo-bar docs, or even something like foo_bar_lib and foo_bar_bin.

I'm using cargo 1.26.0 and rustdoc 1.26.0, though I first noticed the issue using cargo nightly (2018-05-07).

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-layoutArea: target output directory layout, naming, and organizationCommand-docS-triageStatus: This issue is waiting on initial triage.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions