Skip to content

'cargo doc --open' seemingly does nothing if target is different from forced-target #11728

Open
@dramforever

Description

@dramforever

Problem

Currently if you have a forced-target (with -Zper-package-target) that's not the default, cargo doc --open builds the docs in target/{target_name}/doc but doesn't open it, which is confusing.

Steps

$ cargo doc --open
 Documenting forced-target v0.1.0 (/home/dram/tmp/cargo-doc-forced-target)
    Finished dev [unoptimized + debuginfo] target(s) in 0.20s
$ # Nothing opens

Possible Solution(s)

cargo doc --target riscv64gc-unknown-none-elf --open works. Maybe we can have cargo doc default to that for forced-target?

I originally encountered this in a workspace. I don't really know how this should interact with workspaces, but I think it should at least work if I explicitly choose cargo doc -p forced_target or use e.g. a --bin from it

Notes

No response

Version

cargo 1.69.0-nightly (82c3bb79e 2023-02-04)
release: 1.69.0-nightly
commit-hash: 82c3bb79e3a19a5164e33819ef81bfc2c984bc56
commit-date: 2023-02-04
host: x86_64-unknown-linux-gnu
libgit2: 1.5.0 (sys:0.16.0 vendored)
libcurl: 7.86.0-DEV (sys:0.4.59+curl-7.86.0 vendored ssl:OpenSSL/1.1.1q)
os: NixOS 23.5.0 [64-bit]

Metadata

Metadata

Assignees

Labels

C-bugCategory: bugCommand-docS-acceptedStatus: Issue or feature is accepted, and has a team member available to help mentor or reviewZ-per-package-targetNightly: per-package-target

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions