Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cargo doc fails for bin+lib projects with - in the name #13628

Closed
MaxVerevkin opened this issue Mar 22, 2024 · 1 comment · Fixed by #13640
Closed

cargo doc fails for bin+lib projects with - in the name #13628

MaxVerevkin opened this issue Mar 22, 2024 · 1 comment · Fixed by #13640
Assignees
Labels
C-bug Category: bug S-triage Status: This issue is waiting on initial triage.

Comments

@MaxVerevkin
Copy link

Problem

A project with both binary and library targets and with "-" in the name causes cargo doc to print a huge warning. Current stable version (1.77) works and documents the library. Current nightly (cargo 1.79.0-nightly (d438c80 2024-03-19) documents the binary.

Projects without "-" in their name are not affected.

sh-5.2$ ls src
lib.rs	main.rs
sh-5.2$ cargo +stable doc
 Documenting test-proj v0.1.0 (/tmp/testproj)
    Finished dev [unoptimized + debuginfo] target(s) in 0.25s
   Generated /tmp/testproj/target/doc/test_proj/index.html
sh-5.2$ cargo +nightly doc
warning: output filename collision.
The bin target `test-proj` in package `test-proj v0.1.0 (/tmp/testproj)` has the same output filename as the lib target `test_proj` in package `test-proj v0.1.0 (/tmp/testproj)`.
Colliding filename is: /tmp/testproj/target/doc/test_proj/index.html
The output filenames should be unique.
This is a known bug where multiple crates with the same name use
the same path; see <https://github.com/rust-lang/cargo/issues/6313>.
If this looks unexpected, it may be a bug in Cargo. Please file a bug report at
https://github.com/rust-lang/cargo/issues/ with as much information as you
can provide.
cargo 1.79.0-nightly (d438c80c4 2024-03-19) running on `x86_64-unknown-linux-gnu` target `x86_64-unknown-linux-gnu`
First unit: Unit { pkg: Package { id: PackageId { name: "test-proj", version: "0.1.0", source: "/tmp/testproj" }, ..: ".." }, target: TargetInner { name: "test-proj", doc: true, ..: with_path("/tmp/testproj/src/main.rs", Edition2021) }, profile: Profile { ..: default_dev() }, kind: Host, mode: Doc { deps: true, json: false }, features: [], artifact: false, artifact_target_for_features: None, is_std: false, dep_hash: 3508259363715858619 }
Second unit: Unit { pkg: Package { id: PackageId { name: "test-proj", version: "0.1.0", source: "/tmp/testproj" }, ..: ".." }, target: TargetInner { name_inferred: true, ..: lib_target("test_proj", ["lib"], "/tmp/testproj/src/lib.rs", Edition2021) }, profile: Profile { ..: default_dev() }, kind: Host, mode: Doc { deps: true, json: false }, features: [], artifact: false, artifact_target_for_features: None, is_std: false, dep_hash: 2202906307356721367 }
 Documenting test-proj v0.1.0 (/tmp/testproj)
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.52s
   Generated /tmp/testproj/target/doc/test_proj/index.html and 1 other file

Steps

No response

Possible Solution(s)

No response

Notes

No response

Version

No response

@MaxVerevkin MaxVerevkin added C-bug Category: bug S-triage Status: This issue is waiting on initial triage. labels Mar 22, 2024
@ehuss ehuss self-assigned this Mar 25, 2024
@ehuss
Copy link
Contributor

ehuss commented Mar 25, 2024

Thanks for the report! I have posted #13640 with a fix.

@bors bors closed this as completed in c56140f Mar 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug S-triage Status: This issue is waiting on initial triage.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants