rust-lang / rust-lang/rust

Cargo doc fails for certain crates in a workspace with "no such file or directory (os error 2)"

Open
#126,638 9 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-diagnostics C-bug D-confusing T-rustdoc
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

Problem

I'm working with a few other people on making a programming language in Rust and we've encountered an error in trying to create documentation for our workspace.

This is what we get:

 Documenting chrono v0.4.33
error: failed to render source code for `crates/syntax/src/lib.rs`: "crates/syntax/src/lib.rs": No such file or directory (os error 2)
  --> crates/syntax/src/lib.rs:1:1
   |
1  | / use std::mem;
2  | |
3  | | pub type SyntaxBuilder = eventree::SyntaxBuilder<TreeConfig>;
4  | | pub type SyntaxElement = eventree::SyntaxElement<TreeConfig>;
...  |
96 | |     Error,
97 | | }
   | |_^

 Documenting unicode-normalization v0.1.22
 Documenting itertools v0.13.0
error: could not document `syntax`
warning: build failed, waiting for other jobs to finish...

It's really confusing as it gives no other information.

I've seen other similar-ish issues here but they seem more like cargo itself couldn't be found whereas this is saying that crates/syntax/src/lib.rs couldn't be found (when it exists and the command even shows the contents of the file)

Steps
  1. git clone https://github.com/capy-language/capy
  2. cargo doc
  3. see error
Possible Solution(s)

No response

Notes

rustup update hasn't helped, and this error is replicable on my team member's machine

Version
cargo 1.79.0 (ffa9cf99a 2024-06-03)
release: 1.79.0
commit-hash: ffa9cf99a594e59032757403d4c780b46dc2c43a
commit-date: 2024-06-03
host: aarch64-apple-darwin
libgit2: 1.7.2 (sys:0.18.3 vendored)
libcurl: 8.4.0 (sys:0.4.72+curl-8.6.0 system ssl:(SecureTransport) LibreSSL/3.3.6)
ssl: OpenSSL 1.1.1w  11 Sep 2023
os: Mac OS 14.3.1 [64-bit]

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Clone https://github.com/capy-language/capy and run cargo doc using the reported Cargo 1.79.0 environment to reproduce the missing-file error. Start by tracing how Cargo documents workspace crates and renders source paths; done means explaining the cause and making documentation generation complete successfully for the reported workspace.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
build-system, documentation
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.