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 --open fails when there are bugs in my code #15152

Open
TheKnarf opened this issue Feb 7, 2025 · 2 comments
Open

cargo doc --open fails when there are bugs in my code #15152

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

Comments

@TheKnarf
Copy link

TheKnarf commented Feb 7, 2025

Problem

cargo doc --open fails when there are bugs in my code,
but I need access to the documentation to fix the bugs...

Steps

  1. Update some dependencies
  2. There are breaking changes
  3. Try to run cargo doc --open to look through documentation
  4. It doesn't work... and as such I don't get to fix my code

Possible Solution(s)

No response

Notes

No response

Version

cargo version --verbose
cargo 1.84.0 (66221abde 2024-11-19)
release: 1.84.0
commit-hash: 66221abdeca2002d318fde6efff516aab091df0e
commit-date: 2024-11-19
host: x86_64-apple-darwin
libgit2: 1.8.1 (sys:0.19.0 vendored)
libcurl: 8.7.1 (sys:0.4.74+curl-8.9.0 system ssl:(SecureTransport) LibreSSL/3.3.6)
ssl: OpenSSL 1.1.1w  11 Sep 2023
os: Mac OS 15.2.0 [64-bit]
@TheKnarf TheKnarf added C-bug Category: bug S-triage Status: This issue is waiting on initial triage. labels Feb 7, 2025
@weihanglo
Copy link
Member

rustdoc requires your code to pass typecheck, i.e. cargo check in order to generate docs.

If you have network access, you shall be able to open crate doc directly from docs.rs.
If not, if you're looking for docs for a dependency, you should be able to open them directly, for example cargo doc -p serde --open.

@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 7, 2025
@epage
Copy link
Contributor

epage commented Feb 7, 2025

To add to that --open means to open documentation for a selected package which is implicitly the package you are in or the whole workspace.

I can also see people being annoyed with --open opening things on error as they may want to go back and fix things first.

You can always work around this by opening the documentation directly. If you forgot the path, you can stash your changes and then generate/open the docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug Command-doc 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