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

Identical target names within different crates in a workspace have colliding docs paths #15139

Open
vlovich opened this issue Feb 3, 2025 · 2 comments
Labels
C-bug Category: bug S-needs-info Status: Needs more info, such as a reproduction or more background for a feature request.

Comments

@vlovich
Copy link

vlovich commented Feb 3, 2025

Problem

The lib target the_engine in package library v0.1.0 (/home/runner/work/the-engine/the-engine/library) has the same output filename as the bin target the-engine in package executable v0.1.0 (/home/runner/work/the-engine/the-engine/binary).
Colliding filename is: /home/runner/work/the-engine/the-engine/target/doc/the_engine/index.html

While this directs to #6313, it looks to actually just be a Cargo bug since it's weird to require separate crates within a workspace to guarantee unique target names. Indeed, if I want libthe-engine.so and an executable the-engine (or the-engine.dll and the-engine.exe on Windows), it seems reasonable I should be able to do so within the same workspace. It looks like the root of the problem is that cargo doc uses the name of the workspace rather than also including the name of the crate.

Steps

  1. Create a workspace with a lib and a bin crate
  2. Give the crates separate names but add a [[bin]] to the bin crate that aliases the name of the lib crate
  3. cargo doc --all

Possible Solution(s)

No response

Notes

The reason I think this is a bug is because a crate within a workspace should not have too much of an observable difference in behavior from a crate outside the workspace that does the same thing. Yet in this case the lack of namespacing by crate by cargo doc within a workspace results in a difference of behavior that you wouldn't observe with a crate hosted in its own repository.

Version

This is what I have running locally but in CI it's 1.84.1 running on Ubuntu 22.04

cargo 1.84.0 (66221abde 2024-11-19)
release: 1.84.0
commit-hash: 66221abdeca2002d318fde6efff516aab091df0e
commit-date: 2024-11-19
host: x86_64-unknown-linux-gnu
libgit2: 1.8.1 (sys:0.19.0 vendored)
libcurl: 8.9.0-DEV (sys:0.4.74+curl-8.9.0 vendored ssl:OpenSSL/1.1.1w)
ssl: OpenSSL 1.1.1w  11 Sep 2023
os: Arch Linux Rolling Release [64-bit]
@vlovich vlovich added C-bug Category: bug S-triage Status: This issue is waiting on initial triage. labels Feb 3, 2025
@weihanglo
Copy link
Member

To help us understand the actual problem without misinterpreting it, would you mind writing a simple shell script for creating a minimal reproducible example?

@weihanglo weihanglo added S-needs-info Status: Needs more info, such as a reproduction or more background for a feature request. and removed S-triage Status: This issue is waiting on initial triage. labels Feb 3, 2025
@ehuss
Copy link
Contributor

ehuss commented Feb 4, 2025

I believe this is covered in #6313, in the point "rustdoc in a workspace where multiple crates have the same name." We currently don't have the ability to organize rustdoc's directories in such a way to deconflict them. That will require design and implementation work in rustdoc to be able to pass in the mapping information it needs to discover the proper directories.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug S-needs-info Status: Needs more info, such as a reproduction or more background for a feature request.
Projects
None yet
Development

No branches or pull requests

3 participants