Skip to content

rustdoc on a standalone markdown file fails with an unclear error message #70431

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

Closed
TimotheeGerber opened this issue Mar 26, 2020 · 0 comments · Fixed by #70448
Closed

rustdoc on a standalone markdown file fails with an unclear error message #70431

TimotheeGerber opened this issue Mar 26, 2020 · 0 comments · Fixed by #70448
Labels
C-bug Category: This is a bug. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@TimotheeGerber
Copy link
Contributor

I tried this command:

rustdoc README.md

I expected the command to finish without error and the creation of the file README.html or doc/README.html.

Instead, I got the following error message:

error: doc/README.html: No such file or directory (os error 2)

Indeed, this file does not exist and we expected the command to create it! The error message is not really helping in this case and does not explain that it cannot create the file because the directory doc/ does not exists.

When launched on a standalone markdown file, rustdoc expects the output directory to exist. It is not created if missing (as it is the case when launched on *.rs file or with cargo doc), even if we specify it with --output argument.

I see two solutions to the problem:

  • change the error message and tell the user that the output directory (which default to doc/) does not exist;
  • recursively create the output directory.

I can propose a PR to close this issue. I just need someone to tell me which solutions to code. I think that the second solution would be a better choice as it would be more consistent with the other rustdoc uses case (on *.rs files or with cargo doc) which create the output directory.

Meta

rustc --version --verbose:

rustc 1.44.0-nightly (a5fb9ae5b 2020-03-25)
binary: rustc
commit-hash: a5fb9ae5b2ed3cb011ada9dc1e8633aa0927f279
commit-date: 2020-03-25
host: x86_64-unknown-linux-gnu
release: 1.44.0-nightly
LLVM version: 9.0

This bug is also present on the current stable release (v 1.42).

@TimotheeGerber TimotheeGerber added the C-bug Category: This is a bug. label Mar 26, 2020
@jonas-schievink jonas-schievink added the T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. label Mar 26, 2020
@bors bors closed this as completed in bbd3634 Mar 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants