Skip to content

Some internal rustdoc links broke #81037

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
tesuji opened this issue Jan 15, 2021 · 6 comments
Closed

Some internal rustdoc links broke #81037

tesuji opened this issue Jan 15, 2021 · 6 comments
Assignees
Labels
A-docs Area: Documentation for any part of the project, including the compiler, standard library, and tools C-bug Category: This is a bug. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.

Comments

@tesuji
Copy link
Contributor

tesuji commented Jan 15, 2021

/// see [`SpecFromIter`] for details.

warning: unresolved link to `SpecFromIter`
 --> library/alloc/src/vec/spec_from_iter_nested.rs:8:10
  |
8 | /// see [`SpecFromIter`] for details.
  |          ^^^^^^^^^^^^^^ no item named `SpecFromIter` in scope
  |
  = note: `#[warn(broken_intra_doc_links)]` on by default
  = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`

And in stdarch submodule:

warning: unresolved link to `B,W`
   --> library/std/src/../../stdarch/crates/std_detect/src/detect/macros.rs:57:19
    |
57  |                   $(#[$feature_comment])*
    |                     ^^^^^^^^^^^^^^^^^^^
    | 
   ::: library/std/src/../../stdarch/crates/std_detect/src/detect/arch/x86.rs:18:1
    |
18  | / features! {
19  | |     @TARGET: x86;
20  | |     @MACRO_NAME: is_x86_feature_detected;
21  | |     @MACRO_ATTRS:
...   |
195 | |     /// RTM, Intel (Restricted Transactional Memory)
196 | | }
    | |_- in this macro invocation
    |
    = note: `#[warn(broken_intra_doc_links)]` on by default
    = note: the link appears in this line:
            
            AVX-512 BITALG (Support for VPOPCNT[B,W] and VPSHUFBITQMB)
                                                ^^^
    = note: no item named `B,W` in scope
    = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`
    = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

@rustbot label: T-rustdoc C-bug E-easy

@rustbot rustbot added C-bug Category: This is a bug. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Jan 15, 2021
@tesuji tesuji changed the title Some internally rustdoc links broke Some internal rustdoc links broke Jan 15, 2021
@jyn514
Copy link
Member

jyn514 commented Jan 15, 2021

@lzutao those warnings are denied on CI, so they shouldn't ever be happening. How did you compile the standard library?

@jyn514 jyn514 added T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. A-docs Area: Documentation for any part of the project, including the compiler, standard library, and tools E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example and removed T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Jan 15, 2021
@tesuji
Copy link
Contributor Author

tesuji commented Jan 16, 2021

I pass --document-private-items flag to rustdoc. Maybe this helps emitting these errors
when the doc are not build in normal cases.

@jyn514
Copy link
Member

jyn514 commented Jan 16, 2021

I still can't reproduce:

> RUSTDOCFLAGS=--document-private-items x.py doc --stage 0 library/std
 Documenting std v0.0.0 (/home/joshua/rustc3/library/std)
    Finished release [optimized + debuginfo] target(s) in 7.54s

Can you please post the full command line you're using?

@tesuji
Copy link
Contributor Author

tesuji commented Jan 16, 2021

If that helps, sure:

STD_DATE=$(rustc -Vv | grep commit-date | awk '{print $2}')
export RUSTDOCFLAGS="--document-private-items --crate-version \"${STD_DATE}\" --html-in-header ${PWD}/in-head.html"
cargo doc --manifest-path library/std/Cargo.toml

@jyn514
Copy link
Member

jyn514 commented Jan 16, 2021

I can reproduce with that, thanks.

I looked at the code that's failing and I'm surprised it worked with my RUSTDOCFLAGS command, SpecFromIter isn't in scope at all. It should be an easy fix, just use super::SpecFromIter instead.

@CPerezz
Copy link
Contributor

CPerezz commented Jan 18, 2021

Happy to fix that if hasn't been addressed yet.

@rustbot claim

CPerezz added a commit to CPerezz/stdarch that referenced this issue Jan 18, 2021
I saw in rust-lang/rust#81037
that when you document private items with rustdoc the
`x86 AVX-512 BITALG` feature comment does not contain
scape characters in the message and therefore rustdoc
was emiting warnings.

This fixes it.
Amanieu pushed a commit to rust-lang/stdarch that referenced this issue Jan 18, 2021
I saw in rust-lang/rust#81037
that when you document private items with rustdoc the
`x86 AVX-512 BITALG` feature comment does not contain
scape characters in the message and therefore rustdoc
was emiting warnings.

This fixes it.
m-ou-se added a commit to m-ou-se/rust that referenced this issue Jan 20, 2021
…n514

Fix broken links with `--document-private-items` in the standard library

As it was suggested in rust-lang#81037 `SpecFromIter` is not
in the scope and therefore we get a warning when we try to
do document private intems in `rust/library/alloc/`.

This addresses rust-lang#81037 by adding the trait in the scope as `@jyn514`
suggested and also adding an `allow(unused_imports)` flag so that
the compiler does not complain, Since the trait is not used
per se in the code, it's just needed to have properly documented
docs.
m-ou-se added a commit to m-ou-se/rust that referenced this issue Jan 20, 2021
…n514

Fix broken links with `--document-private-items` in the standard library

As it was suggested in rust-lang#81037 `SpecFromIter` is not
in the scope and therefore we get a warning when we try to
do document private intems in `rust/library/alloc/`.

This addresses rust-lang#81037 by adding the trait in the scope as ``@jyn514``
suggested and also adding an `allow(unused_imports)` flag so that
the compiler does not complain, Since the trait is not used
per se in the code, it's just needed to have properly documented
docs.
JohnTitor added a commit to JohnTitor/rust that referenced this issue Jan 21, 2021
…n514

Fix broken links with `--document-private-items` in the standard library

As it was suggested in rust-lang#81037 `SpecFromIter` is not
in the scope and therefore we get a warning when we try to
do document private intems in `rust/library/alloc/`.

This addresses rust-lang#81037 by adding the trait in the scope as ```@jyn514```
suggested and also adding an `allow(unused_imports)` flag so that
the compiler does not complain, Since the trait is not used
per se in the code, it's just needed to have properly documented
docs.
@bors bors closed this as completed in 9abd80c Jan 21, 2021
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-docs Area: Documentation for any part of the project, including the compiler, standard library, and tools C-bug Category: This is a bug. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants