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

rustdoc-scrape-examples creates dead links and suppresses --no-deps #91605

Closed
mejrs opened this issue Dec 6, 2021 · 4 comments · Fixed by #92146
Closed

rustdoc-scrape-examples creates dead links and suppresses --no-deps #91605

mejrs opened this issue Dec 6, 2021 · 4 comments · Fixed by #92146
Labels
C-bug Category: This is a bug. requires-nightly This issue requires a nightly compiler in some way. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@mejrs
Copy link
Contributor

mejrs commented Dec 6, 2021

I tried rendering docs for a crate with:

cargo +nightly doc -Z unstable-options -Z rustdoc-scrape-examples=examples --open --no-deps

That puts this in the sidebar:

image

In this case, cfg_if and indoc are dependencies (which I don't want to document). And decorator is the name of one of the examples, this is a dead link.

Meta

rustc 1.57.0 (f1edd0429 2021-11-29)
binary: rustc
commit-hash: f1edd0429582dd29cccacaf50fd134b05593bd9c
commit-date: 2021-11-29
host: x86_64-pc-windows-msvc
release: 1.57.0
LLVM version: 13.0.0

rustdoc 1.57.0 (f1edd0429 2021-11-29)
@mejrs mejrs added the C-bug Category: This is a bug. label Dec 6, 2021
@jyn514 jyn514 added the T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. label Dec 6, 2021
@jyn514
Copy link
Member

jyn514 commented Dec 6, 2021

cc @willcrichton - running on dependencies seems like a cargo bug, but showing them in the sidebar seems like it's an issue in rustdoc.

@jyn514 jyn514 added the requires-nightly This issue requires a nightly compiler in some way. label Dec 6, 2021
@willcrichton
Copy link
Contributor

Thanks for the report @mejrs! I will take a look this week.

@willcrichton
Copy link
Contributor

Ok, I have fixed the issue where examples show up in the crates list. willcrichton@b7de797

However, I wasn't able to reproduce the issue with non-examples appearing in the crates list. Specifically, my setup was:

# Cargo.toml
[package]
name = "doc-test"
version = "0.1.0"
edition = "2021"

[dependencies]
cfg-if = "*"
// src/lib.rs
pub fn heyo(){
  cfg_if::cfg_if! { if #[cfg(unix)] {} else {} }
}
// examples/ex.rs
fn main() {
  cfg_if::cfg_if! { if #[cfg(unix)] {} else {} }
  doc_test::heyo();
}

I could not get cfg_if to appear in the sidebar when using --no-deps.

@mejrs
Copy link
Contributor Author

mejrs commented Dec 12, 2021

Thanks 😃

However, I wasn't able to reproduce the issue with non-examples appearing in the crates list.

I tried some more things, and I think what happened is that I used it without --no-deps at first, and then without clearing the target/docs folder, did it with --no-deps, which apparently doesn't remove the dependencies from the sidebar.

So I guess that part of the issue is about --no-deps not working quite right when these artefacts already exist, and unrelated to rustdoc-scrape-examples.

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. requires-nightly This issue requires a nightly compiler in some way. 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.

3 participants