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

Warn if linking to a private item #72771

Merged
merged 3 commits into from
Jun 27, 2020
Merged

Warn if linking to a private item #72771

merged 3 commits into from
Jun 27, 2020

Conversation

jyn514
Copy link
Member

@jyn514 jyn514 commented May 30, 2020

@jyn514
Copy link
Member Author

jyn514 commented May 30, 2020

Changes that should be made before merging:

@jyn514
Copy link
Member Author

jyn514 commented May 30, 2020

Output for the example in #72769:

warning: `[crate::g]` public documentation for `f` links to a private item
 --> priv-in-pub.rs:1:22
  |
1 | /// See also [`g()`][crate::g] and [`h()`]
  |                      ^^^^^^^^ this item is private
  |
  = note: `#[warn(intra_doc_link_resolution_failure)]` on by default

warning: `[crate::g]` public documentation for `f` links to a private item
 --> priv-in-pub.rs:1:22
  |
1 | /// See also [`g()`][crate::g] and [`h()`]
  |                      ^^^^^^^^ this item is private

warning: 2 warnings emitted

@rust-highfive
Copy link
Collaborator

The job mingw-check of your PR failed (pretty log, raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
##[section]Starting: Linux mingw-check
##[section]Starting: Initialize job
Agent name: 'Azure Pipelines 3'
Agent machine name: 'fv-az578'
Current agent version: '2.169.1'
##[group]Operating System
16.04.6
LTS
LTS
##[endgroup]
##[group]Virtual Environment
Environment: ubuntu-16.04
Version: 20200517.1
Included Software: https://github.com/actions/virtual-environments/blob/ubuntu16/20200517.1/images/linux/Ubuntu1604-README.md
##[endgroup]
Agent running as: 'vsts'
Prepare build directory.
Set build variables.
Download all required tasks.
Download all required tasks.
Downloading task: Bash (3.163.2)
Checking job knob settings.
   Knob: AgentToolsDirectory = /opt/hostedtoolcache Source: ${AGENT_TOOLSDIRECTORY} 
   Knob: AgentPerflog = /home/vsts/perflog Source: ${VSTS_AGENT_PERFLOG} 
Start tracking orphan processes.
##[section]Finishing: Initialize job
##[section]Starting: Configure Job Name
==============================================================================
---
========================== Starting Command Output ===========================
[command]/bin/bash --noprofile --norc /home/vsts/work/_temp/aa6c75c7-0650-4399-9dfa-ed39bf0e7956.sh

##[section]Finishing: Disable git automatic line ending conversion
##[section]Starting: Checkout rust-lang/rust@refs/pull/72771/merge to s
Task         : Get sources
Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.
Version      : 1.0.0
Author       : Microsoft
---
##[command]git remote add origin https://github.com/rust-lang/rust
##[command]git config gc.auto 0
##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
##[command]git config --get-all http.proxy
##[command]git -c http.extraheader="AUTHORIZATION: basic ***" fetch --force --tags --prune --progress --no-recurse-submodules --depth=2 origin +refs/heads/*:refs/remotes/origin/* +refs/pull/72771/merge:refs/remotes/pull/72771/merge
---
 ---> 3adb0605cc65
Step 6/7 : ENV RUN_CHECK_WITH_PARALLEL_QUERIES 1
 ---> Using cache
 ---> 28dbc326cb7f
Step 7/7 : ENV SCRIPT python3 ../x.py test src/tools/expand-yaml-anchors &&            python3 ../x.py check --target=i686-pc-windows-gnu --host=i686-pc-windows-gnu &&            python3 ../x.py build --stage 0 src/tools/build-manifest &&            python3 ../x.py test --stage 0 src/tools/compiletest &&            python3 ../x.py test src/tools/tidy &&            python3 ../x.py doc --stage 0 src/libstd &&            /scripts/validate-toolstate.sh
 ---> 537a01811900
Successfully built 537a01811900
Successfully tagged rust-ci:latest
Built container sha256:537a018119009dc218456238dec90b5530050db1e2a1e166550c218003f6159d
---
    Checking rustc_feature v0.0.0 (/checkout/src/librustc_feature)
    Checking fmt_macros v0.0.0 (/checkout/src/libfmt_macros)
    Checking rustc_ast_pretty v0.0.0 (/checkout/src/librustc_ast_pretty)
    Checking rustc_hir v0.0.0 (/checkout/src/librustc_hir)
    Checking rustc_query_system v0.0.0 (/checkout/src/librustc_query_system)
    Checking chalk-rust-ir v0.10.0
    Checking rustc_parse v0.0.0 (/checkout/src/librustc_parse)
    Checking rustc_hir_pretty v0.0.0 (/checkout/src/librustc_hir_pretty)
    Checking rustc_ast_lowering v0.0.0 (/checkout/src/librustc_ast_lowering)
---
configure: build.cargo-native-static := True
configure: dist.missing-tools   := True
configure: rust.channel         := nightly
configure: rust.debug-assertions := True
configure: build.configure-args := ['--enable-sccache', '--disable-manage-submodu ...
configure: writing `config.toml` in current directory
configure: 
configure: run `python /checkout/x.py --help`
configure: 
---
Hugepagesize:       2048 kB
DirectMap4k:      133056 kB
DirectMap2M:     3012608 kB
DirectMap1G:     6291456 kB
+ python3 ../x.py test src/tools/expand-yaml-anchors
Ensuring the YAML anchors in the GitHub Actions config were expanded
Ensuring the YAML anchors in the GitHub Actions config were expanded
Building stage0 tool expand-yaml-anchors (x86_64-unknown-linux-gnu)
   Compiling unicode-xid v0.2.0
   Compiling syn v1.0.11
   Compiling linked-hash-map v0.5.2
   Compiling lazy_static v1.4.0
   Compiling lazy_static v1.4.0
   Compiling yaml-rust v0.4.3
   Compiling quote v1.0.2
   Compiling thiserror-impl v1.0.5
   Compiling thiserror v1.0.5
   Compiling yaml-merge-keys v0.4.0
   Compiling expand-yaml-anchors v0.1.0 (/checkout/src/tools/expand-yaml-anchors)
Build completed successfully in 0:00:31
+ python3 ../x.py check --target=i686-pc-windows-gnu --host=i686-pc-windows-gnu
    Finished dev [unoptimized] target(s) in 0.21s
Checking rustdoc artifacts (x86_64-unknown-linux-gnu -> i686-pc-windows-gnu)
---
    Checking rustc_feature v0.0.0 (/checkout/src/librustc_feature)
    Checking fmt_macros v0.0.0 (/checkout/src/libfmt_macros)
    Checking rustc_ast_pretty v0.0.0 (/checkout/src/librustc_ast_pretty)
    Checking rustc_hir v0.0.0 (/checkout/src/librustc_hir)
    Checking chalk-rust-ir v0.10.0
    Checking rustc_query_system v0.0.0 (/checkout/src/librustc_query_system)
    Checking chalk-solve v0.10.0
    Checking rustc_hir_pretty v0.0.0 (/checkout/src/librustc_hir_pretty)
    Checking rustc_parse v0.0.0 (/checkout/src/librustc_parse)
    Checking rustc_ast_lowering v0.0.0 (/checkout/src/librustc_ast_lowering)
---
   Compiling cargo_metadata v0.9.1
   Compiling tidy v0.1.0 (/checkout/src/tools/tidy)
    Finished release [optimized] target(s) in 25.61s
tidy check
tidy error: /checkout/src/librustdoc/passes/collect_intra_doc_links.rs:706: TODO is deprecated; use FIXME
Found 496 error codes
Found 0 error codes with no tests
Done!
some tidy checks failed
some tidy checks failed


command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/tidy" "/checkout/src" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo"


failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test src/tools/tidy
Build completed unsuccessfully in 0:00:35
Build completed unsuccessfully in 0:00:35
== clock drift check ==
  local time: Sat May 30 06:16:23 UTC 2020
  network time: Sat, 30 May 2020 06:16:23 GMT
== end clock drift check ==

##[error]Bash exited with code '1'.
##[section]Finishing: Run build
##[section]Starting: Checkout rust-lang/rust@refs/pull/72771/merge to s
Task         : Get sources
Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.
Version      : 1.0.0
Author       : Microsoft
Author       : Microsoft
Help         : [More Information](https://go.microsoft.com/fwlink/?LinkId=798199)
==============================================================================
Cleaning any cached credential from repository: rust-lang/rust (GitHub)
##[section]Finishing: Checkout rust-lang/rust@refs/pull/72771/merge to s
Cleaning up task key
Start cleaning up orphan processes.
Terminate orphan process: pid (3704) (python)
##[section]Finishing: Finalize Job

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @rust-lang/infra. (Feature Requests)

@jyn514
Copy link
Member Author

jyn514 commented May 30, 2020

My workaround to avoid the bugs from the markdown parser means that we no longer give a warning for each time the same broken link is seen, only the first time. Not sure how to fix this.

/// [Foo::bar], [Foo::bar]
pub fn f() {}
warning: `[Foo::bar]` cannot be resolved, ignoring it.
 --> duplicate-err.rs:1:6
  |
1 | /// [Foo::bar], [Foo::bar]
  |      ^^^^^^^^ cannot be resolved, ignoring
  |
  = note: `#[warn(intra_doc_link_resolution_failure)]` on by default
  = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`

warning: 1 warning emitted

@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-8 of your PR failed (pretty log, raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
##[section]Starting: Linux x86_64-gnu-llvm-8
##[section]Starting: Initialize job
Agent name: 'Azure Pipelines 5'
Agent machine name: 'fv-az578'
Current agent version: '2.169.1'
##[group]Operating System
16.04.6
LTS
LTS
##[endgroup]
##[group]Virtual Environment
Environment: ubuntu-16.04
Version: 20200517.1
Included Software: https://github.com/actions/virtual-environments/blob/ubuntu16/20200517.1/images/linux/Ubuntu1604-README.md
##[endgroup]
Agent running as: 'vsts'
Prepare build directory.
Set build variables.
Download all required tasks.
Download all required tasks.
Downloading task: Bash (3.163.2)
Checking job knob settings.
   Knob: AgentToolsDirectory = /opt/hostedtoolcache Source: ${AGENT_TOOLSDIRECTORY} 
   Knob: AgentPerflog = /home/vsts/perflog Source: ${VSTS_AGENT_PERFLOG} 
Start tracking orphan processes.
##[section]Finishing: Initialize job
##[section]Starting: Configure Job Name
==============================================================================
---
========================== Starting Command Output ===========================
[command]/bin/bash --noprofile --norc /home/vsts/work/_temp/3f41bcf6-518a-4c40-bbea-cb5cf331695e.sh

##[section]Finishing: Disable git automatic line ending conversion
##[section]Starting: Checkout rust-lang/rust@refs/pull/72771/merge to s
Task         : Get sources
Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.
Version      : 1.0.0
Author       : Microsoft
---
##[command]git remote add origin https://github.com/rust-lang/rust
##[command]git config gc.auto 0
##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
##[command]git config --get-all http.proxy
##[command]git -c http.extraheader="AUTHORIZATION: basic ***" fetch --force --tags --prune --progress --no-recurse-submodules --depth=2 origin +refs/heads/*:refs/remotes/origin/* +refs/pull/72771/merge:refs/remotes/pull/72771/merge
---
 ---> cb2676f08729
Step 5/8 : ENV RUST_CONFIGURE_ARGS       --build=x86_64-unknown-linux-gnu       --llvm-root=/usr/lib/llvm-8       --enable-llvm-link-shared       --set rust.thin-lto-import-instr-limit=10
 ---> Using cache
 ---> df25ce111862
Step 6/8 : ENV SCRIPT python2.7 ../x.py test --exclude src/tools/tidy &&            python2.7 ../x.py test src/test/mir-opt --pass=build                                   --target=armv5te-unknown-linux-gnueabi &&            python2.7 ../x.py test src/tools/tidy
 ---> 599b9ac96b27
Step 7/8 : ENV NO_DEBUG_ASSERTIONS=1
 ---> Using cache
 ---> 091087e35a36
---
   Compiling fmt_macros v0.0.0 (/checkout/src/libfmt_macros)
   Compiling chalk-rust-ir v0.10.0
   Compiling rustc_ast_pretty v0.0.0 (/checkout/src/librustc_ast_pretty)
   Compiling rustc_hir v0.0.0 (/checkout/src/librustc_hir)
   Compiling rustc_query_system v0.0.0 (/checkout/src/librustc_query_system)
   Compiling chalk-solve v0.10.0
   Compiling rustc_hir_pretty v0.0.0 (/checkout/src/librustc_hir_pretty)
   Compiling rustc_parse v0.0.0 (/checkout/src/librustc_parse)
   Compiling rustc_ast_lowering v0.0.0 (/checkout/src/librustc_ast_lowering)
---
   Compiling fmt_macros v0.0.0 (/checkout/src/libfmt_macros)
   Compiling chalk-rust-ir v0.10.0
   Compiling rustc_ast_pretty v0.0.0 (/checkout/src/librustc_ast_pretty)
   Compiling rustc_hir v0.0.0 (/checkout/src/librustc_hir)
   Compiling rustc_query_system v0.0.0 (/checkout/src/librustc_query_system)
   Compiling chalk-solve v0.10.0
   Compiling rustc_hir_pretty v0.0.0 (/checkout/src/librustc_hir_pretty)
   Compiling rustc_parse v0.0.0 (/checkout/src/librustc_parse)
   Compiling rustc_ast_lowering v0.0.0 (/checkout/src/librustc_ast_lowering)
---
.................................................................................................... 1700/10272
.................................................................................i.................. 1800/10272
.................................................................................................... 1900/10272
.................................................................................................... 2000/10272
..i..i.............................................................................................. 2100/10272
............................................................................................iiiii... 2200/10272
.................................................................................................... 2400/10272
.................................................................................................... 2500/10272
.................................................................................................... 2600/10272
.................................................................................................... 2700/10272
---
.......................i...............i............................................................ 5200/10272
.................................................................................................... 5300/10272
.......................................................................i............................ 5400/10272
.................................................................i.................................. 5500/10272
.................................................................................ii.ii........i...i. 5600/10272
........................i........................................................................... 5800/10272
................................i................................................................... 5900/10272
......................................................................................ii............ 6000/10272
.........................i.......................................................................... 6100/10272
.........................i.......................................................................... 6100/10272
.................................................................................................... 6200/10272
.................................................................................................... 6300/10272
................................................ii...i..ii............i............................. 6400/10272
.................................................................................................... 6600/10272
.................................................................................................... 6700/10272
.................................................................................................... 6700/10272
.................................................................................i..ii.............. 6800/10272
.................................................................................................... 7000/10272
.................................................................................................... 7100/10272
...................................i................................................................ 7200/10272
.................................................................................................... 7300/10272
---
.................................................................................................... 8200/10272
.................................................................................................... 8300/10272
.......................................................................i............................ 8400/10272
.................................................................................................... 8500/10272
.........................iiiiii.iiiiii.i............................................................ 8600/10272
.................................................................................................... 8800/10272
.................................................................................................... 8900/10272
.................................................................................................... 9000/10272
.................................................................................................... 9100/10272
---
Suite("src/test/codegen") not skipped for "bootstrap::test::Codegen" -- not in ["src/tools/tidy"]
Check compiletest suite=codegen mode=codegen (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)

running 192 tests
iiii......i..............ii.i..........i......................i...........i..i................i....i 100/192
.............i.i.i...iii..iiiiiiiiiiiiiiii.......................iii................ii......

 finished in 5.678
Suite("src/test/codegen-units") not skipped for "bootstrap::test::CodegenUnits" -- not in ["src/tools/tidy"]
Check compiletest suite=codegen-units mode=codegen-units (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
---
Suite("src/test/assembly") not skipped for "bootstrap::test::Assembly" -- not in ["src/tools/tidy"]
Check compiletest suite=assembly mode=assembly (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)

running 21 tests
iiiiiiiiiiiiiiiiiiiii

 finished in 0.148
Suite("src/test/incremental") not skipped for "bootstrap::test::Incremental" -- not in ["src/tools/tidy"]
Check compiletest suite=incremental mode=incremental (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
---
Suite("src/test/debuginfo") not skipped for "bootstrap::test::Debuginfo" -- not in ["src/tools/tidy"]
Check compiletest suite=debuginfo mode=debuginfo (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)

running 115 tests
iiiii..i.....i..i...i..i.i.i..i..i..ii....i.i....ii..........iiii.........i.....i..i.......ii.i.ii.. 100/115
...iiii.....ii.

 finished in 15.423
Suite("src/test/ui-fulldeps") not skipped for "bootstrap::test::UiFullDeps" -- not in ["src/tools/tidy"]
Uplifting stage1 rustc (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
---

   Doc-tests core

running 2577 tests
......iiiii......................................................................................... 100/2577
.................................................................................................ii. 200/2577
......................................i............................................................. 400/2577
..............................................................................................i..i.. 500/2577
..............................................................................................i..i.. 500/2577
................iiii................................................................................ 600/2577
.................................................................................................... 800/2577
.................................................................................................... 900/2577
.................................................................................................... 1000/2577
.................................................................................................... 1100/2577
---

running 1020 tests
i................................................................................................... 100/1020
.................................................................................................... 200/1020
...................iii......i......i...i......i..................................................... 300/1020
.................................................................................................... 400/1020
....................................................i....i......................................ii.. 500/1020
.................................................................................................... 700/1020
.................................................................................................... 700/1020
..............................................iiii.................................................. 800/1020
.................................................................................................... 900/1020
....................................................................iiii............................ 1000/1020
test result: ok. 1000 passed; 0 failed; 20 ignored; 0 measured; 0 filtered out

 finished in 146.216
Set({"src/libterm"}) not skipped for "bootstrap::test::Crate" -- not in ["src/tools/tidy"]
---

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

 finished in 0.976
Set({"/checkout/src/librustc_query_system"}) not skipped for "bootstrap::test::CrateLibrustc" -- not in ["src/tools/tidy"]
Testing rustc_query_system stage1 (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
   Compiling rustc_query_system v0.0.0 (/checkout/src/librustc_query_system)
     Running build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps/rustc_query_system-0f7bb3477fa2da6f

running 0 tests

---
Set({"/checkout/src/librustc_parse"}) not skipped for "bootstrap::doc::Rustc" -- not in ["src/tools/tidy"]
Set({"/checkout/src/librustc_passes"}) not skipped for "bootstrap::doc::Rustc" -- not in ["src/tools/tidy"]
Set({"/checkout/src/librustc_plugin_impl"}) not skipped for "bootstrap::doc::Rustc" -- not in ["src/tools/tidy"]
Set({"/checkout/src/librustc_privacy"}) not skipped for "bootstrap::doc::Rustc" -- not in ["src/tools/tidy"]
Set({"/checkout/src/librustc_query_system"}) not skipped for "bootstrap::doc::Rustc" -- not in ["src/tools/tidy"]
Set({"/checkout/src/librustc_save_analysis"}) not skipped for "bootstrap::doc::Rustc" -- not in ["src/tools/tidy"]
Set({"/checkout/src/librustc_session"}) not skipped for "bootstrap::doc::Rustc" -- not in ["src/tools/tidy"]
Set({"/checkout/src/librustc_span"}) not skipped for "bootstrap::doc::Rustc" -- not in ["src/tools/tidy"]
Set({"/checkout/src/librustc_symbol_mangling"}) not skipped for "bootstrap::doc::Rustc" -- not in ["src/tools/tidy"]
---
Suite("src/test/run-make-fulldeps") not skipped for "bootstrap::test::RunMakeFullDeps" -- not in ["src/tools/tidy"]
Check compiletest suite=run-make-fulldeps mode=run-make (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)

running 211 tests
......................i...ii.......................................................................i 100/211
........................................iiiiii......i..............iii.............................. 200/211
.......ii..

 finished in 65.791
Set({"src/doc/rustdoc"}) not skipped for "bootstrap::test::RustdocBook" -- not in ["src/tools/tidy"]
doc tests for: /checkout/src/doc/rustdoc/src/advanced-features.md
---
doc tests for: /checkout/src/doc/rustc/src/targets/index.md
doc tests for: /checkout/src/doc/rustc/src/what-is-rustc.md
 finished in 4.010
Set({"src/test/rustdoc-js-std"}) not skipped for "bootstrap::test::RustdocJSStd" -- not in ["src/tools/tidy"]
Checking "alias-1" ... OK
Checking "alias-2" ... OK
Checking "alias-3" ... OK
Checking "alias" ... OK
Checking "basic" ... OK
Checking "deduplication" ... OK
Checking "enum-option" ... OK
Checking "filter-crate" ... OK
Checking "fn-forget" ... OK
Checking "from_u" ... OK
Checking "keyword" ... OK
Checking "macro-check" ... OK
Checking "macro-print" ... OK
Checking "multi-query" ... OK
Checking "never" ... OK
Checking "quoted" ... OK
Checking "return-specific-literal" ... OK
Checking "return-specific" ... OK
Checking "should-fail" ... OK
Checking "string-from_ut" ... OK
Checking "struct-vec" ... OK
Checking "vec-new" ... OK
Check compiletest suite=rustdoc-js mode=js-doc-test (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)

running 7 tests
.......
---

31    |
32    = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
33 
- warning: `[Uniooon::X]` cannot be resolved, ignoring it.
-    |
-    |
- LL |       //! , [Uniooon::X] and [Qux::Z].
-    |
-    = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
- 
- 
- warning: `[Qux::Z]` cannot be resolved, ignoring it.
-    |
-    |
- LL |       //! , [Uniooon::X] and [Qux::Z].
-    |
-    = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
- 
- 
50 warning: `[Qux:Y]` cannot be resolved, ignoring it.
52    |

177    = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
178    = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
---


The actual stderr differed from the expected stderr.
Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/rustdoc-ui/intra-links-warning/intra-links-warning.stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args intra-links-warning.rs`
error: 1 errors occurred comparing output.
status: exit code: 0
status: exit code: 0
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustdoc" "/checkout/src/test/rustdoc-ui/intra-links-warning.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/rustdoc-ui/intra-links-warning" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/rustdoc-ui/intra-links-warning/auxiliary"
------------------------------------------

------------------------------------------
stderr:
stderr:
------------------------------------------
warning: `[Foo::baz]` cannot be resolved, ignoring it.
   |
   |
LL |        //! Test with [Foo::baz], [Bar::foo], ...
   |
   = note: `#[warn(intra_doc_link_resolution_failure)]` on by default
   = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`


warning: `[Bar::foo]` cannot be resolved, ignoring it.
  --> /checkout/src/test/rustdoc-ui/intra-links-warning.rs:3:35
   |
LL |        //! Test with [Foo::baz], [Bar::foo], ...
   |
   = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`


warning: `[Uniooon::X]` cannot be resolved, ignoring it.
   |
   |
LL |      //! , [Uniooon::X] and [Qux::Z].
   |
   = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`


warning: `[Qux::Z]` cannot be resolved, ignoring it.
   |
   |
LL |      //! , [Uniooon::X] and [Qux::Z].
   |
   = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`


warning: `[Qux:Y]` cannot be resolved, ignoring it.
   |
   |
LL |        /// [Qux:Y]
   |
   = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`

warning: `[error]` cannot be resolved, ignoring it.
warning: `[error]` cannot be resolved, ignoring it.
  --> /checkout/src/test/rustdoc-ui/intra-links-warning.rs:58:30
   |
LL |  * time to introduce a link [error]*/ //~ WARNING `[error]` cannot be resolved
   |
   = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`

warning: `[error]` cannot be resolved, ignoring it.
warning: `[error]` cannot be resolved, ignoring it.
  --> /checkout/src/test/rustdoc-ui/intra-links-warning.rs:64:30
   |
LL |  * time to introduce a link [error] //~ WARNING `[error]` cannot be resolved
   |
   = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`

warning: `[error]` cannot be resolved, ignoring it.
warning: `[error]` cannot be resolved, ignoring it.
  --> /checkout/src/test/rustdoc-ui/intra-links-warning.rs:68:1
   |
LL | #[doc = "single line [error]"] //~ WARNING `[error]` cannot be resolved
   |
   = note: the link appears in this line:
           
           single line [error]
           single line [error]
                        ^^^^^
   = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`

warning: `[error]` cannot be resolved, ignoring it.
  --> /checkout/src/test/rustdoc-ui/intra-links-warning.rs:71:1
   |
LL | #[doc = "single line with \"escaping\" [error]"] //~ WARNING `[error]` cannot be resolved
   |
   = note: the link appears in this line:
           
           
           single line with "escaping" [error]
   = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`

warning: `[error]` cannot be resolved, ignoring it.
  --> /checkout/src/test/rustdoc-ui/intra-links-warning.rs:74:1
  --> /checkout/src/test/rustdoc-ui/intra-links-warning.rs:74:1
   |
LL | / /// Item docs. //~ WARNING `[error]` cannot be resolved
LL | | #[doc="Hello there!"]
LL | | /// [error]
   |
   = note: the link appears in this line:
           
           [error]
           [error]
            ^^^^^
   = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`

warning: `[error1]` cannot be resolved, ignoring it.
  --> /checkout/src/test/rustdoc-ui/intra-links-warning.rs:80:11
   |
LL | /// docs [error1] //~ WARNING `[error1]` cannot be resolved
   |
   = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`

warning: `[error2]` cannot be resolved, ignoring it.
warning: `[error2]` cannot be resolved, ignoring it.
  --> /checkout/src/test/rustdoc-ui/intra-links-warning.rs:82:11
   |
LL | /// docs [error2] //~ WARNING `[error2]` cannot be resolved
   |
   = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`


warning: `[BarA]` cannot be resolved, ignoring it.
   |
   |
LL | /// bar [BarA] bar //~ WARNING `[BarA]` cannot be resolved
   |
   = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`


warning: `[BarB]` cannot be resolved, ignoring it.
   |
   |
LL |  * bar [BarB] bar //~ WARNING `[BarB]` cannot be resolved
   |
   = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`


warning: `[BarC]` cannot be resolved, ignoring it.
   |
   |
LL | bar [BarC] bar //~ WARNING `[BarC]` cannot be resolved
   |
   = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`

warning: `[BarD]` cannot be resolved, ignoring it.
warning: `[BarD]` cannot be resolved, ignoring it.
  --> /checkout/src/test/rustdoc-ui/intra-links-warning.rs:45:1
   |
LL | #[doc = "Foo\nbar [BarD] bar\nbaz"] //~ WARNING `[BarD]` cannot be resolved
   |
   = note: the link appears in this line:
           
           
           bar [BarD] bar
   = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`


warning: `[BarF]` cannot be resolved, ignoring it.
   |
   |
LL |         #[doc = $f] //~ WARNING `[BarF]` cannot be resolved
...
...
LL | f!("Foo\nbar [BarF] bar\nbaz");
   |
   = note: the link appears in this line:
           
           
           bar [BarF] bar
   = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
   = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

warning: 17 warnings emitted
---
thread 'main' panicked at 'Some tests failed', src/tools/compiletest/src/main.rs:348:22
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace


command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/compiletest" "--compile-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib" "--run-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "--rustc-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "--rustdoc-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustdoc" "--src-base" "/checkout/src/test/rustdoc-ui" "--build-base" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/rustdoc-ui" "--stage-id" "stage2-x86_64-unknown-linux-gnu" "--mode" "ui" "--target" "x86_64-unknown-linux-gnu" "--host" "x86_64-unknown-linux-gnu" "--llvm-filecheck" "/usr/lib/llvm-8/bin/FileCheck" "--nodejs" "/usr/bin/node" "--host-rustcflags" "-Cdebuginfo=0 -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--target-rustcflags" "-Cdebuginfo=0 -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--docck-python" "/usr/bin/python2.7" "--lldb-python" "/usr/bin/python2.7" "--gdb" "/usr/bin/gdb" "--quiet" "--llvm-version" "8.0.0" "--system-llvm" "--cc" "" "--cxx" "" "--cflags" "" "--llvm-components" "" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always"


failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test --exclude src/tools/tidy
Build completed unsuccessfully in 1:35:08
Build completed unsuccessfully in 1:35:08
== clock drift check ==
  local time: Sat May 30 18:23:28 UTC 2020
  network time: Sat, 30 May 2020 18:23:28 GMT
== end clock drift check ==

##[error]Bash exited with code '1'.
##[section]Finishing: Run build
##[section]Starting: Checkout rust-lang/rust@refs/pull/72771/merge to s
Task         : Get sources
Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.
Version      : 1.0.0
Author       : Microsoft
Author       : Microsoft
Help         : [More Information](https://go.microsoft.com/fwlink/?LinkId=798199)
==============================================================================
Cleaning any cached credential from repository: rust-lang/rust (GitHub)
##[section]Finishing: Checkout rust-lang/rust@refs/pull/72771/merge to s
Cleaning up task key
Start cleaning up orphan processes.
Terminate orphan process: pid (3534) (python)
##[section]Finishing: Finalize Job

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @rust-lang/infra. (Feature Requests)

@jyn514 jyn514 force-pushed the rustdoc branch 2 times, most recently from e1574be to 250da53 Compare May 31, 2020 15:56
@jyn514
Copy link
Member Author

jyn514 commented May 31, 2020

After 368d0f8 this also closes #65697.

@jyn514
Copy link
Member Author

jyn514 commented May 31, 2020

The way this works is by

  • Moving document_private/hidden from Options to RenderOptions
  • Adding RenderOptions to DocContext so it can be used while running passes
  • Adding document_private to the cache so it can used in free functions (like href)
  • Checking in fn href() if --document-private-items was passed, and not silently deleting the link if so
  • Checking in fold_item if document-private-items was passed; if not, it gives an error when linking to private items
  • Removing duplicate warnings as mentioned in Warn if linking to a private item #72771 (comment)

@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-8 of your PR failed (pretty log, raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
##[section]Starting: Linux x86_64-gnu-llvm-8
##[section]Starting: Initialize job
Agent name: 'Azure Pipelines 11'
Agent machine name: 'fv-az578'
Current agent version: '2.169.1'
##[group]Operating System
16.04.6
LTS
LTS
##[endgroup]
##[group]Virtual Environment
Environment: ubuntu-16.04
Version: 20200517.1
Included Software: https://github.com/actions/virtual-environments/blob/ubuntu16/20200517.1/images/linux/Ubuntu1604-README.md
##[endgroup]
Agent running as: 'vsts'
Prepare build directory.
Set build variables.
Download all required tasks.
Download all required tasks.
Downloading task: Bash (3.163.2)
Checking job knob settings.
   Knob: AgentToolsDirectory = /opt/hostedtoolcache Source: ${AGENT_TOOLSDIRECTORY} 
   Knob: AgentPerflog = /home/vsts/perflog Source: ${VSTS_AGENT_PERFLOG} 
Start tracking orphan processes.
##[section]Finishing: Initialize job
##[section]Starting: Configure Job Name
==============================================================================
---
========================== Starting Command Output ===========================
[command]/bin/bash --noprofile --norc /home/vsts/work/_temp/3c3e2bff-721e-4e83-8c77-3f880bc59c0c.sh

##[section]Finishing: Disable git automatic line ending conversion
##[section]Starting: Checkout rust-lang/rust@refs/pull/72771/merge to s
Task         : Get sources
Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.
Version      : 1.0.0
Author       : Microsoft
---
##[command]git remote add origin https://github.com/rust-lang/rust
##[command]git config gc.auto 0
##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
##[command]git config --get-all http.proxy
##[command]git -c http.extraheader="AUTHORIZATION: basic ***" fetch --force --tags --prune --progress --no-recurse-submodules --depth=2 origin +refs/heads/*:refs/remotes/origin/* +refs/pull/72771/merge:refs/remotes/pull/72771/merge
---
 ---> cb2676f08729
Step 5/8 : ENV RUST_CONFIGURE_ARGS       --build=x86_64-unknown-linux-gnu       --llvm-root=/usr/lib/llvm-8       --enable-llvm-link-shared       --set rust.thin-lto-import-instr-limit=10
 ---> Using cache
 ---> df25ce111862
Step 6/8 : ENV SCRIPT python2.7 ../x.py test --exclude src/tools/tidy &&            python2.7 ../x.py test src/test/mir-opt --pass=build                                   --target=armv5te-unknown-linux-gnueabi &&            python2.7 ../x.py test src/tools/tidy
 ---> 599b9ac96b27
Step 7/8 : ENV NO_DEBUG_ASSERTIONS=1
 ---> Using cache
 ---> 091087e35a36
---
   Compiling fmt_macros v0.0.0 (/checkout/src/libfmt_macros)
   Compiling chalk-rust-ir v0.10.0
   Compiling rustc_ast_pretty v0.0.0 (/checkout/src/librustc_ast_pretty)
   Compiling rustc_hir v0.0.0 (/checkout/src/librustc_hir)
   Compiling rustc_query_system v0.0.0 (/checkout/src/librustc_query_system)
   Compiling chalk-solve v0.10.0
   Compiling rustc_hir_pretty v0.0.0 (/checkout/src/librustc_hir_pretty)
   Compiling rustc_parse v0.0.0 (/checkout/src/librustc_parse)
   Compiling rustc_ast_lowering v0.0.0 (/checkout/src/librustc_ast_lowering)
---
   Compiling fmt_macros v0.0.0 (/checkout/src/libfmt_macros)
   Compiling chalk-rust-ir v0.10.0
   Compiling rustc_ast_pretty v0.0.0 (/checkout/src/librustc_ast_pretty)
   Compiling rustc_hir v0.0.0 (/checkout/src/librustc_hir)
   Compiling rustc_query_system v0.0.0 (/checkout/src/librustc_query_system)
   Compiling chalk-solve v0.10.0
   Compiling rustc_hir_pretty v0.0.0 (/checkout/src/librustc_hir_pretty)
   Compiling rustc_parse v0.0.0 (/checkout/src/librustc_parse)
   Compiling rustc_ast_lowering v0.0.0 (/checkout/src/librustc_ast_lowering)
---
.................................................................................................... 1700/10276
..................................................................................i................. 1800/10276
.................................................................................................... 1900/10276
.................................................................................................... 2000/10276
...i..i............................................................................................. 2100/10276
.............................................................................................iiiii.. 2200/10276
.................................................................................................... 2400/10276
.................................................................................................... 2500/10276
.................................................................................................... 2600/10276
.................................................................................................... 2700/10276
---
........................i...............i........................................................... 5200/10276
.................................................................................................... 5300/10276
........................................................................i........................... 5400/10276
..................................................................i................................. 5500/10276
..................................................................................ii.ii........i...i 5600/10276
.........................i.......................................................................... 5800/10276
.................................i.................................................................. 5900/10276
.......................................................................................ii........... 6000/10276
..........................i......................................................................... 6100/10276
..........................i......................................................................... 6100/10276
.................................................................................................... 6200/10276
.................................................................................................... 6300/10276
.................................................ii...i..ii...........i............................. 6400/10276
.................................................................................................... 6600/10276
.................................................................................................... 6700/10276
.................................................................................................... 6700/10276
..................................................................................i..ii............. 6800/10276
.................................................................................................... 7000/10276
.................................................................................................... 7100/10276
....................................i............................................................... 7200/10276
.................................................................................................... 7300/10276
---
.................................................................................................... 8200/10276
.................................................................................................... 8300/10276
.........................................................................i.......................... 8400/10276
.................................................................................................... 8500/10276
...........................iiiiii.iiiiii.i.......................................................... 8600/10276
.................................................................................................... 8800/10276
.................................................................................................... 8900/10276
.................................................................................................... 9000/10276
.................................................................................................... 9100/10276
---
Suite("src/test/codegen") not skipped for "bootstrap::test::Codegen" -- not in ["src/tools/tidy"]
Check compiletest suite=codegen mode=codegen (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)

running 192 tests
iiii......i..............ii.i..........i......................i...........i..i................i....i 100/192
.............i.i.i...iii..iiiiiiiiiiiiiiii.......................iii................ii......

 finished in 5.661
Suite("src/test/codegen-units") not skipped for "bootstrap::test::CodegenUnits" -- not in ["src/tools/tidy"]
Check compiletest suite=codegen-units mode=codegen-units (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
---
Suite("src/test/assembly") not skipped for "bootstrap::test::Assembly" -- not in ["src/tools/tidy"]
Check compiletest suite=assembly mode=assembly (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)

running 21 tests
iiiiiiiiiiiiiiiiiiiii

 finished in 0.168
Suite("src/test/incremental") not skipped for "bootstrap::test::Incremental" -- not in ["src/tools/tidy"]
Check compiletest suite=incremental mode=incremental (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
---
Suite("src/test/debuginfo") not skipped for "bootstrap::test::Debuginfo" -- not in ["src/tools/tidy"]
Check compiletest suite=debuginfo mode=debuginfo (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)

running 115 tests
iiiii..i.....i..i...i..i.i.i..i..i..ii....i.i....ii..........iiii.........i.....i..i.......ii.i.ii.. 100/115
...iiii.....ii.

 finished in 15.415
Suite("src/test/ui-fulldeps") not skipped for "bootstrap::test::UiFullDeps" -- not in ["src/tools/tidy"]
Uplifting stage1 rustc (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
---

   Doc-tests core

running 2577 tests
......iiiii......................................................................................... 100/2577
.................................................................................................ii. 200/2577
......................................i............................................................. 400/2577
..............................................................................................i..i.. 500/2577
..............................................................................................i..i.. 500/2577
................iiii................................................................................ 600/2577
.................................................................................................... 800/2577
.................................................................................................... 900/2577
.................................................................................................... 1000/2577
.................................................................................................... 1100/2577
---

running 1020 tests
i................................................................................................... 100/1020
.................................................................................................... 200/1020
...................iii......i......i...i......i..................................................... 300/1020
.................................................................................................... 400/1020
....................................................i....i......................................ii.. 500/1020
.................................................................................................... 700/1020
.................................................................................................... 700/1020
..............................................iiii.................................................. 800/1020
.................................................................................................... 900/1020
....................................................................iiii............................ 1000/1020
test result: ok. 1000 passed; 0 failed; 20 ignored; 0 measured; 0 filtered out

 finished in 159.192
Set({"src/libterm"}) not skipped for "bootstrap::test::Crate" -- not in ["src/tools/tidy"]
---

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

 finished in 1.050
Set({"/checkout/src/librustc_query_system"}) not skipped for "bootstrap::test::CrateLibrustc" -- not in ["src/tools/tidy"]
Testing rustc_query_system stage1 (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
   Compiling rustc_query_system v0.0.0 (/checkout/src/librustc_query_system)
     Running build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps/rustc_query_system-0f7bb3477fa2da6f

running 0 tests

---
Set({"/checkout/src/librustc_parse"}) not skipped for "bootstrap::doc::Rustc" -- not in ["src/tools/tidy"]
Set({"/checkout/src/librustc_passes"}) not skipped for "bootstrap::doc::Rustc" -- not in ["src/tools/tidy"]
Set({"/checkout/src/librustc_plugin_impl"}) not skipped for "bootstrap::doc::Rustc" -- not in ["src/tools/tidy"]
Set({"/checkout/src/librustc_privacy"}) not skipped for "bootstrap::doc::Rustc" -- not in ["src/tools/tidy"]
Set({"/checkout/src/librustc_query_system"}) not skipped for "bootstrap::doc::Rustc" -- not in ["src/tools/tidy"]
Set({"/checkout/src/librustc_save_analysis"}) not skipped for "bootstrap::doc::Rustc" -- not in ["src/tools/tidy"]
Set({"/checkout/src/librustc_session"}) not skipped for "bootstrap::doc::Rustc" -- not in ["src/tools/tidy"]
Set({"/checkout/src/librustc_span"}) not skipped for "bootstrap::doc::Rustc" -- not in ["src/tools/tidy"]
Set({"/checkout/src/librustc_symbol_mangling"}) not skipped for "bootstrap::doc::Rustc" -- not in ["src/tools/tidy"]
---
Suite("src/test/run-make-fulldeps") not skipped for "bootstrap::test::RunMakeFullDeps" -- not in ["src/tools/tidy"]
Check compiletest suite=run-make-fulldeps mode=run-make (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)

running 211 tests
......................i...ii.......................................................................i 100/211
........................................iiiiii......i..............iii.............................. 200/211
.......ii..

 finished in 75.630
Set({"src/doc/rustdoc"}) not skipped for "bootstrap::test::RustdocBook" -- not in ["src/tools/tidy"]
doc tests for: /checkout/src/doc/rustdoc/src/advanced-features.md
---
doc tests for: /checkout/src/doc/rustc/src/targets/index.md
doc tests for: /checkout/src/doc/rustc/src/what-is-rustc.md
 finished in 4.392
Set({"src/test/rustdoc-js-std"}) not skipped for "bootstrap::test::RustdocJSStd" -- not in ["src/tools/tidy"]
Checking "alias-1" ... OK
Checking "alias-2" ... OK
Checking "alias-3" ... OK
Checking "alias" ... OK
Checking "basic" ... OK
Checking "deduplication" ... OK
Checking "enum-option" ... OK
Checking "filter-crate" ... OK
Checking "fn-forget" ... OK
Checking "from_u" ... OK
Checking "keyword" ... OK
Checking "macro-check" ... OK
Checking "macro-print" ... OK
Checking "multi-query" ... OK
Checking "never" ... OK
Checking "quoted" ... OK
Checking "return-specific-literal" ... OK
Checking "return-specific" ... OK
Checking "should-fail" ... OK
Checking "string-from_ut" ... OK
Checking "struct-vec" ... OK
Checking "vec-new" ... OK
Check compiletest suite=rustdoc-js mode=js-doc-test (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)

running 7 tests
.......
---
failures:

---- [ui] rustdoc-ui/intra-links-warning.rs stdout ----

error: /checkout/src/test/rustdoc-ui/intra-links-warning.rs:10: expected warning not found: `[Uniooon::X]` cannot be resolved

error: /checkout/src/test/rustdoc-ui/intra-links-warning.rs:10: expected warning not found: `[Qux::Z]` cannot be resolved
error: 0 unexpected errors found, 2 expected errors not found
status: exit code: 0
status: exit code: 0
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustdoc" "/checkout/src/test/rustdoc-ui/intra-links-warning.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/rustdoc-ui/intra-links-warning" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/rustdoc-ui/intra-links-warning/auxiliary"
    Error {
        line_num: 10,
        kind: Some(
            Warning,
            Warning,
        ),
        msg: "`[Uniooon::X]` cannot be resolved",
    Error {
        line_num: 10,
        kind: Some(
            Warning,
            Warning,
        ),
        msg: "`[Qux::Z]` cannot be resolved",
]

thread '[ui] rustdoc-ui/intra-links-warning.rs' panicked at 'explicit panic', src/tools/compiletest/src/runtest.rs:1460:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
---

thread 'main' panicked at 'Some tests failed', src/tools/compiletest/src/main.rs:348:22


command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/compiletest" "--compile-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib" "--run-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "--rustc-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "--rustdoc-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustdoc" "--src-base" "/checkout/src/test/rustdoc-ui" "--build-base" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/rustdoc-ui" "--stage-id" "stage2-x86_64-unknown-linux-gnu" "--mode" "ui" "--target" "x86_64-unknown-linux-gnu" "--host" "x86_64-unknown-linux-gnu" "--llvm-filecheck" "/usr/lib/llvm-8/bin/FileCheck" "--nodejs" "/usr/bin/node" "--host-rustcflags" "-Cdebuginfo=0 -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--target-rustcflags" "-Cdebuginfo=0 -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--docck-python" "/usr/bin/python2.7" "--lldb-python" "/usr/bin/python2.7" "--gdb" "/usr/bin/gdb" "--quiet" "--llvm-version" "8.0.0" "--system-llvm" "--cc" "" "--cxx" "" "--cflags" "" "--llvm-components" "" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always"


failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test --exclude src/tools/tidy
Build completed unsuccessfully in 1:46:23
Build completed unsuccessfully in 1:46:23
== clock drift check ==
  local time: Sun May 31 17:47:39 UTC 2020
  network time: Sun, 31 May 2020 17:47:39 GMT
== end clock drift check ==

##[error]Bash exited with code '1'.
##[section]Finishing: Run build
##[section]Starting: Checkout rust-lang/rust@refs/pull/72771/merge to s
Task         : Get sources
Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.
Version      : 1.0.0
Author       : Microsoft
Author       : Microsoft
Help         : [More Information](https://go.microsoft.com/fwlink/?LinkId=798199)
==============================================================================
Cleaning any cached credential from repository: rust-lang/rust (GitHub)
##[section]Finishing: Checkout rust-lang/rust@refs/pull/72771/merge to s
Cleaning up task key
Start cleaning up orphan processes.
Terminate orphan process: pid (3747) (python)
##[section]Finishing: Finalize Job

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @rust-lang/infra. (Feature Requests)

@crlf0710 crlf0710 added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Jun 12, 2020
@jyn514
Copy link
Member Author

jyn514 commented Jun 12, 2020

Status: this is waiting on pulldown-cmark/pulldown-cmark#445. However, I think that bug was pre-existing (I just happened to notice while working on this PR). @GuillaumeGomez if I fix the test failures does this look good? I can add an ignored test case for the bug I spotted and fix it in a follow-up PR at some point.

@jyn514
Copy link
Member Author

jyn514 commented Jun 12, 2020

I opened #73264 for the secondary issue, it's not actually related to this PR.

@jyn514 jyn514 changed the title [WIP] Warn if linking to a private item Warn if linking to a private item Jun 12, 2020
@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-8 of your PR failed (pretty log, raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
##[section]Starting: Linux x86_64-gnu-llvm-8
##[section]Starting: Initialize job
Agent name: 'Azure Pipelines 51'
Agent machine name: 'fv-az578'
Current agent version: '2.170.1'
##[group]Operating System
16.04.6
LTS
LTS
##[endgroup]
##[group]Virtual Environment
Environment: ubuntu-16.04
Version: 20200604.1
Included Software: https://github.com/actions/virtual-environments/blob/ubuntu16/20200604.1/images/linux/Ubuntu1604-README.md
##[endgroup]
Agent running as: 'vsts'
Prepare build directory.
Set build variables.
Download all required tasks.
Download all required tasks.
Downloading task: Bash (3.163.3)
Checking job knob settings.
   Knob: AgentToolsDirectory = /opt/hostedtoolcache Source: ${AGENT_TOOLSDIRECTORY} 
   Knob: AgentPerflog = /home/vsts/perflog Source: ${VSTS_AGENT_PERFLOG} 
Start tracking orphan processes.
##[section]Finishing: Initialize job
##[section]Starting: Configure Job Name
==============================================================================
---
========================== Starting Command Output ===========================
[command]/bin/bash --noprofile --norc /home/vsts/work/_temp/90794349-0f3c-409d-bfa0-32112c3fb3fb.sh

##[section]Finishing: Disable git automatic line ending conversion
##[section]Starting: Checkout rust-lang/rust@refs/pull/72771/merge to s
Task         : Get sources
Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.
Version      : 1.0.0
Author       : Microsoft
---
##[command]git remote add origin https://github.com/rust-lang/rust
##[command]git config gc.auto 0
##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
##[command]git config --get-all http.proxy
##[command]git -c http.extraheader="AUTHORIZATION: basic ***" fetch --force --tags --prune --progress --no-recurse-submodules --depth=2 origin +refs/heads/*:refs/remotes/origin/* +refs/pull/72771/merge:refs/remotes/pull/72771/merge
---
 ---> 29a56a071ad9
Step 5/8 : ENV RUST_CONFIGURE_ARGS       --build=x86_64-unknown-linux-gnu       --llvm-root=/usr/lib/llvm-8       --enable-llvm-link-shared       --set rust.thin-lto-import-instr-limit=10
 ---> Using cache
 ---> eb826cd6a4d7
Step 6/8 : ENV SCRIPT python2.7 ../x.py test --exclude src/tools/tidy &&            python2.7 ../x.py test src/test/mir-opt --pass=build                                   --target=armv5te-unknown-linux-gnueabi &&            python2.7 ../x.py test src/tools/tidy
 ---> 9841042138f8
Step 7/8 : ENV NO_DEBUG_ASSERTIONS=1
 ---> Using cache
 ---> 00b49f7048de
---
   Compiling rustc_parse_format v0.0.0 (/checkout/src/librustc_parse_format)
   Compiling chalk-rust-ir v0.10.0
   Compiling rustc_ast_pretty v0.0.0 (/checkout/src/librustc_ast_pretty)
   Compiling rustc_hir v0.0.0 (/checkout/src/librustc_hir)
   Compiling rustc_query_system v0.0.0 (/checkout/src/librustc_query_system)
   Compiling chalk-solve v0.10.0
   Compiling rustc_hir_pretty v0.0.0 (/checkout/src/librustc_hir_pretty)
   Compiling rustc_parse v0.0.0 (/checkout/src/librustc_parse)
   Compiling rustc_ast_lowering v0.0.0 (/checkout/src/librustc_ast_lowering)
---
   Compiling rustc_parse_format v0.0.0 (/checkout/src/librustc_parse_format)
   Compiling chalk-rust-ir v0.10.0
   Compiling rustc_ast_pretty v0.0.0 (/checkout/src/librustc_ast_pretty)
   Compiling rustc_hir v0.0.0 (/checkout/src/librustc_hir)
   Compiling rustc_query_system v0.0.0 (/checkout/src/librustc_query_system)
   Compiling chalk-solve v0.10.0
   Compiling rustc_hir_pretty v0.0.0 (/checkout/src/librustc_hir_pretty)
   Compiling rustc_parse v0.0.0 (/checkout/src/librustc_parse)
   Compiling rustc_ast_lowering v0.0.0 (/checkout/src/librustc_ast_lowering)
---
...............................i...............i.................................................... 5200/10301
.................................................................................................... 5300/10301
...............................................................................i.................... 5400/10301
.........................................................................i.......................... 5500/10301
............................................................................................ii.ii... 5600/10301
.....i...i.......................................................................................... 5700/10301
............................................i....................................................... 5900/10301
..................................................................................................ii 6000/10301
.....................................i.............................................................. 6100/10301
.................................................................................................... 6200/10301
.................................................................................................... 6200/10301
.................................................................................................... 6300/10301
.............................................................ii...i..ii...........i................. 6400/10301
.................................................................................................... 6600/10301
.................................................................................................... 6700/10301
.................................................................................................... 6700/10301
..............................................................................................i..ii. 6800/10301
.................................................................................................... 7000/10301
.................................................................................................... 7100/10301
.................................................i.................................................. 7200/10301
.................................................................................................... 7300/10301
---
.................................................................................................... 8200/10301
.................................................................................................... 8300/10301
............................................................................................i....... 8400/10301
.................................................................................................... 8500/10301
.............................................iiiiii.iiiiii.i........................................ 8600/10301
..i................................................................................................. 8800/10301
.................................................................................................... 8900/10301
.................................................................................................... 9000/10301
.................................................................................................... 9100/10301
---
Suite("src/test/codegen") not skipped for "bootstrap::test::Codegen" -- not in ["src/tools/tidy"]
Check compiletest suite=codegen mode=codegen (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)

running 193 tests
iiii......i..............ii..i.........i......................i...........i..i................i....i 100/193
.............i.i.i...iii..iiiiiiiiiiiiiiiii.......................iii................ii......

 finished in 5.334
Suite("src/test/codegen-units") not skipped for "bootstrap::test::CodegenUnits" -- not in ["src/tools/tidy"]
Check compiletest suite=codegen-units mode=codegen-units (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
---
Suite("src/test/assembly") not skipped for "bootstrap::test::Assembly" -- not in ["src/tools/tidy"]
Check compiletest suite=assembly mode=assembly (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)

running 21 tests
iiiiiiiiiiiiiiiiiiiii

 finished in 0.146
Suite("src/test/incremental") not skipped for "bootstrap::test::Incremental" -- not in ["src/tools/tidy"]
Check compiletest suite=incremental mode=incremental (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
---
Suite("src/test/debuginfo") not skipped for "bootstrap::test::Debuginfo" -- not in ["src/tools/tidy"]
Check compiletest suite=debuginfo mode=debuginfo (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)

running 115 tests
iiiii..i.....i..i...i..i.i.i..i..i..ii....i.i....ii..........iiii.........i.....i..i.......ii.i.ii.. 100/115
...iiii.....ii.

 finished in 14.606
Suite("src/test/ui-fulldeps") not skipped for "bootstrap::test::UiFullDeps" -- not in ["src/tools/tidy"]
Uplifting stage1 rustc (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
---
.................................................................................................... 500/769
...........................thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: RecvError', src/libstd/sync/mpsc/mod.rs:2741:32
....thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: RecvError', src/libstd/sync/mpsc/mod.rs:2778:31
thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: "SendError(..)"', src/libstd/sync/mpsc/mod.rs:2766:28
.......thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: RecvError', src/libstd/sync/mpsc/mod.rs:2645:23
..........................................thread '.<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: RecvError', src/libstd/sync/mpsc/mod.rs:1997:32
......thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: RecvError', src/libstd/sync/mpsc/mod.rs:2034:31
.....thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: RecvError', src/libstd/sync/mpsc/mod.rs:1916:23
.............................thread '<unnamed>' panicked at 'explicit panic', src/libstd/sync/mutex.rs:634:13
...thread '<unnamed>' panicked at 'test panic in inner thread to poison mutex', src/libstd/sync/mutex.rs:588:13
....thread '<unnamed>' panicked at 'test panic in inner thread to poison mutex', src/libstd/sync/mutex.rs:564:13
thread '<unnamed>' panicked at 'explicit panic', src/libstd/sync/mutex.rs:695:13
thread '<unnamed>' panicked at 'explicit panic', src/libstd/sync/mutex.rs:695:13
..thread '<unnamed>' panicked at 'assertion failed: `(left == right)`
  left: `1`,
 right: `2`', src/libstd/sync/mutex.rs:658:13
..........thread '<unnamed>' panicked at 'test panic in inner thread to poison RwLock', src/libstd/sync/rwlock.rs:789:13
....thread '<unnamed>' panicked at 'test panic in inner thread to poison RwLock', src/libstd/sync/rwlock.rs:765:13
..thread '<unnamed>' panicked at 'explicit panic', src/libstd/sync/rwlock.rs:701:13
thread '<unnamed>' panicked at 'explicit panic', src/libstd/sync/rwlock.rs:629:13
thread '<unnamed>.' panicked at 'explicit panic', src/libstd/sync/rwlock.rs:641:13
..thread '<unnamed>' panicked at 'explicit panic', src/libstd/sync/rwlock.rs:616:13
.......................................... 700/769
.........................................thread '<unnamed>' panicked at 'explicit panic', src/libstd/thread/mod.rs:1577:37
.............thread '<unnamed>' panicked at 'Box<Any>', src/libstd/thread/mod.rs:1712:13
---

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

 finished in 0.830
Set({"/checkout/src/librustc_query_system"}) not skipped for "bootstrap::test::CrateLibrustc" -- not in ["src/tools/tidy"]
Testing rustc_query_system stage1 (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
   Compiling rustc_query_system v0.0.0 (/checkout/src/librustc_query_system)
     Running build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps/rustc_query_system-101a02b96cd72ebe

running 0 tests

---
Set({"/checkout/src/librustc_parse_format"}) not skipped for "bootstrap::doc::Rustc" -- not in ["src/tools/tidy"]
Set({"/checkout/src/librustc_passes"}) not skipped for "bootstrap::doc::Rustc" -- not in ["src/tools/tidy"]
Set({"/checkout/src/librustc_plugin_impl"}) not skipped for "bootstrap::doc::Rustc" -- not in ["src/tools/tidy"]
Set({"/checkout/src/librustc_privacy"}) not skipped for "bootstrap::doc::Rustc" -- not in ["src/tools/tidy"]
Set({"/checkout/src/librustc_query_system"}) not skipped for "bootstrap::doc::Rustc" -- not in ["src/tools/tidy"]
Set({"/checkout/src/librustc_save_analysis"}) not skipped for "bootstrap::doc::Rustc" -- not in ["src/tools/tidy"]
Set({"/checkout/src/librustc_serialize"}) not skipped for "bootstrap::doc::Rustc" -- not in ["src/tools/tidy"]
Set({"/checkout/src/librustc_session"}) not skipped for "bootstrap::doc::Rustc" -- not in ["src/tools/tidy"]
Set({"/checkout/src/librustc_span"}) not skipped for "bootstrap::doc::Rustc" -- not in ["src/tools/tidy"]
---
Suite("src/test/run-make-fulldeps") not skipped for "bootstrap::test::RunMakeFullDeps" -- not in ["src/tools/tidy"]
Check compiletest suite=run-make-fulldeps mode=run-make (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)

running 212 tests
......................i...ii........................................................................ 100/212
i........................................iiiiii......i..............iii............................. 200/212
........ii..

 finished in 63.877
Set({"src/doc/rustdoc"}) not skipped for "bootstrap::test::RustdocBook" -- not in ["src/tools/tidy"]
doc tests for: /checkout/src/doc/rustdoc/src/advanced-features.md
---
doc tests for: /checkout/src/doc/rustc/src/targets/index.md
doc tests for: /checkout/src/doc/rustc/src/what-is-rustc.md
 finished in 4.373
Set({"src/test/rustdoc-js-std"}) not skipped for "bootstrap::test::RustdocJSStd" -- not in ["src/tools/tidy"]
Checking "alias-1" ... OK
Checking "alias-2" ... OK
Checking "alias-3" ... OK
Checking "alias" ... OK
Checking "basic" ... OK
Checking "deduplication" ... OK
Checking "enum-option" ... OK
Checking "filter-crate" ... OK
Checking "fn-forget" ... OK
Checking "from_u" ... OK
Checking "keyword" ... OK
Checking "macro-check" ... OK
Checking "macro-print" ... OK
Checking "multi-query" ... OK
Checking "never" ... OK
Checking "quoted" ... OK
Checking "return-specific-literal" ... OK
Checking "return-specific" ... OK
Checking "should-fail" ... OK
Checking "string-from_ut" ... OK
Checking "struct-vec" ... OK
Checking "vec-new" ... OK
Check compiletest suite=rustdoc-js mode=js-doc-test (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)

running 7 tests
.......
---

31    |
32    = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
33 
+ warning: `[Uniooon::X]` cannot be resolved, ignoring it.
+    |
+    |
+ LL |       //! , [Uniooon::X] and [Qux::Z].
+    |
+    = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
+ 
+ 
+ warning: `[Qux::Z]` cannot be resolved, ignoring it.
+    |
+    |
+ LL |       //! , [Uniooon::X] and [Qux::Z].
+    |
+    = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
+ 
+ 
34 warning: `[Qux:Y]` cannot be resolved, ignoring it.
36    |

161    = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
162    = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
---


The actual stderr differed from the expected stderr.
Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/rustdoc-ui/intra-links-warning/intra-links-warning.stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args intra-links-warning.rs`
error: 1 errors occurred comparing output.
status: exit code: 0
status: exit code: 0
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustdoc" "/checkout/src/test/rustdoc-ui/intra-links-warning.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/rustdoc-ui/intra-links-warning" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/rustdoc-ui/intra-links-warning/auxiliary"
------------------------------------------

------------------------------------------
stderr:
stderr:
------------------------------------------
warning: `[Foo::baz]` cannot be resolved, ignoring it.
   |
   |
LL |        //! Test with [Foo::baz], [Bar::foo], ...
   |
   = note: `#[warn(intra_doc_link_resolution_failure)]` on by default
   = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`


warning: `[Bar::foo]` cannot be resolved, ignoring it.
  --> /checkout/src/test/rustdoc-ui/intra-links-warning.rs:3:35
   |
LL |        //! Test with [Foo::baz], [Bar::foo], ...
   |
   = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`


warning: `[Uniooon::X]` cannot be resolved, ignoring it.
   |
   |
LL |      //! , [Uniooon::X] and [Qux::Z].
   |
   = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`


warning: `[Qux::Z]` cannot be resolved, ignoring it.
   |
   |
LL |      //! , [Uniooon::X] and [Qux::Z].
   |
   = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`


warning: `[Uniooon::X]` cannot be resolved, ignoring it.
   |
   |
LL |       //! , [Uniooon::X] and [Qux::Z].
   |
   = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`


warning: `[Qux::Z]` cannot be resolved, ignoring it.
   |
   |
LL |       //! , [Uniooon::X] and [Qux::Z].
   |
   = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`


warning: `[Qux:Y]` cannot be resolved, ignoring it.
   |
   |
LL |        /// [Qux:Y]
   |
   = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`

warning: `[error]` cannot be resolved, ignoring it.
warning: `[error]` cannot be resolved, ignoring it.
  --> /checkout/src/test/rustdoc-ui/intra-links-warning.rs:58:30
   |
LL |  * time to introduce a link [error]*/ //~ WARNING `[error]` cannot be resolved
   |
   = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`

warning: `[error]` cannot be resolved, ignoring it.
warning: `[error]` cannot be resolved, ignoring it.
  --> /checkout/src/test/rustdoc-ui/intra-links-warning.rs:64:30
   |
LL |  * time to introduce a link [error] //~ WARNING `[error]` cannot be resolved
   |
   = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`

warning: `[error]` cannot be resolved, ignoring it.
warning: `[error]` cannot be resolved, ignoring it.
  --> /checkout/src/test/rustdoc-ui/intra-links-warning.rs:68:1
   |
LL | #[doc = "single line [error]"] //~ WARNING `[error]` cannot be resolved
   |
   = note: the link appears in this line:
           
           single line [error]
           single line [error]
                        ^^^^^
   = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`

warning: `[error]` cannot be resolved, ignoring it.
  --> /checkout/src/test/rustdoc-ui/intra-links-warning.rs:71:1
   |
LL | #[doc = "single line with \"escaping\" [error]"] //~ WARNING `[error]` cannot be resolved
   |
   = note: the link appears in this line:
           
           
           single line with "escaping" [error]
   = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`

warning: `[error]` cannot be resolved, ignoring it.
  --> /checkout/src/test/rustdoc-ui/intra-links-warning.rs:74:1
  --> /checkout/src/test/rustdoc-ui/intra-links-warning.rs:74:1
   |
LL | / /// Item docs. //~ WARNING `[error]` cannot be resolved
LL | | #[doc="Hello there!"]
LL | | /// [error]
   |
   = note: the link appears in this line:
           
           [error]
           [error]
            ^^^^^
   = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`

warning: `[error1]` cannot be resolved, ignoring it.
  --> /checkout/src/test/rustdoc-ui/intra-links-warning.rs:80:11
   |
LL | /// docs [error1] //~ WARNING `[error1]` cannot be resolved
   |
   = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`

warning: `[error2]` cannot be resolved, ignoring it.
warning: `[error2]` cannot be resolved, ignoring it.
  --> /checkout/src/test/rustdoc-ui/intra-links-warning.rs:82:11
   |
LL | /// docs [error2] //~ WARNING `[error2]` cannot be resolved
   |
   = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`


warning: `[BarA]` cannot be resolved, ignoring it.
   |
   |
LL | /// bar [BarA] bar //~ WARNING `[BarA]` cannot be resolved
   |
   = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`


warning: `[BarB]` cannot be resolved, ignoring it.
   |
   |
LL |  * bar [BarB] bar //~ WARNING `[BarB]` cannot be resolved
   |
   = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`


warning: `[BarC]` cannot be resolved, ignoring it.
   |
   |
LL | bar [BarC] bar //~ WARNING `[BarC]` cannot be resolved
   |
   = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`

warning: `[BarD]` cannot be resolved, ignoring it.
warning: `[BarD]` cannot be resolved, ignoring it.
  --> /checkout/src/test/rustdoc-ui/intra-links-warning.rs:45:1
   |
LL | #[doc = "Foo\nbar [BarD] bar\nbaz"] //~ WARNING `[BarD]` cannot be resolved
   |
   = note: the link appears in this line:
           
           
           bar [BarD] bar
   = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`


warning: `[BarF]` cannot be resolved, ignoring it.
   |
   |
LL |         #[doc = $f] //~ WARNING `[BarF]` cannot be resolved
...
...
LL | f!("Foo\nbar [BarF] bar\nbaz");
   |
   = note: the link appears in this line:
           
           
           bar [BarF] bar
   = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
   = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

warning: 19 warnings emitted
---

note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace


command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/compiletest" "--compile-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib" "--run-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "--rustc-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "--rustdoc-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustdoc" "--src-base" "/checkout/src/test/rustdoc-ui" "--build-base" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/rustdoc-ui" "--stage-id" "stage2-x86_64-unknown-linux-gnu" "--mode" "ui" "--target" "x86_64-unknown-linux-gnu" "--host" "x86_64-unknown-linux-gnu" "--llvm-filecheck" "/usr/lib/llvm-8/bin/FileCheck" "--nodejs" "/usr/bin/node" "--host-rustcflags" "-Cdebuginfo=0 -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--target-rustcflags" "-Cdebuginfo=0 -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--docck-python" "/usr/bin/python2.7" "--lldb-python" "/usr/bin/python2.7" "--gdb" "/usr/bin/gdb" "--quiet" "--llvm-version" "8.0.0" "--system-llvm" "--cc" "" "--cxx" "" "--cflags" "" "--llvm-components" "" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always"


failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test --exclude src/tools/tidy
Build completed unsuccessfully in 1:34:11
Build completed unsuccessfully in 1:34:11
== clock drift check ==
  local time: Fri Jun 12 03:56:59 UTC 2020
  network time: Fri, 12 Jun 2020 03:56:59 GMT
== end clock drift check ==

##[error]Bash exited with code '1'.
##[section]Finishing: Run build
##[section]Starting: Checkout rust-lang/rust@refs/pull/72771/merge to s
Task         : Get sources
Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.
Version      : 1.0.0
Author       : Microsoft
Author       : Microsoft
Help         : [More Information](https://go.microsoft.com/fwlink/?LinkId=798199)
==============================================================================
Cleaning any cached credential from repository: rust-lang/rust (GitHub)
##[section]Finishing: Checkout rust-lang/rust@refs/pull/72771/merge to s
Cleaning up task key
Start cleaning up orphan processes.
Terminate orphan process: pid (3563) (python)
##[section]Finishing: Finalize Job

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @rust-lang/infra. (Feature Requests)

@jyn514
Copy link
Member Author

jyn514 commented Jun 13, 2020

@rustbot modify labels: +S-waiting-on-review -S-waiting-on-author

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jun 13, 2020
Copy link
Member

@Manishearth Manishearth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

r=me for this, but please clean up the commit history

might also be worth being a little bit more verbose in debug!()

Do you intend to wait for the pulldown-cmark PR to land?

- Pass around document_private a lot more
- Add tests
  + Add tests for intra-doc links to private items
  + Add ignored tests for warnings in reference links
This was referenced Jun 26, 2020
bors added a commit to rust-lang-ci/rust that referenced this pull request Jun 27, 2020
…arth

Rollup of 12 pull requests

Successful merges:

 - rust-lang#72771 (Warn if linking to a private item)
 - rust-lang#72937 (Fortanix SGX target libunwind build process changes)
 - rust-lang#73485 (Perform obligation deduplication to avoid buggy `ExistentialMismatch`)
 - rust-lang#73529 (Add liballoc impl SpecFromElem for i8)
 - rust-lang#73579 (add missing doc links)
 - rust-lang#73627 (Shortcuts for min/max on double-ended BTreeMap/BTreeSet iterators)
 - rust-lang#73691 (Bootstrap: detect Windows based on sys.platform)
 - rust-lang#73694 (Document the Self keyword)
 - rust-lang#73718 (Document the super keyword)
 - rust-lang#73728 (Document some invariants correctly/more)
 - rust-lang#73738 (Remove irrelevant comment)
 - rust-lang#73765 (Remove blank line)

Failed merges:

r? @ghost
@bors bors merged commit 8adc781 into rust-lang:master Jun 27, 2020
@jyn514 jyn514 deleted the rustdoc branch June 27, 2020 11:07
@dennis-hamester
Copy link
Contributor

With this MR, the following produces a warning:

struct Private;

pub struct Public {
    /// A private field with a [`Private`] type.
    private: Private,
}

Was this intentional? The field itself is not public, so it should be fine to link to a private type, right?

@GuillaumeGomez
Copy link
Member

I think warn in this case is valid as well. You link to a private item, so wether or not you're using it on a private item shouldn't matter in my opinion. You can see it as a case of "this item was public but is not private (but mistake or not), and rustdoc is warning about items linked by it and to it".

@jyn514
Copy link
Member Author

jyn514 commented Jul 7, 2020

@GuillaumeGomez I disagree. One of the use cases I was thinking about here was --document-private-items. With the current behavior, adding docs that only show up when --document-private-items is passed will give a warning even if the docs are never generated or shown to the user. So there's no way to have links among private items without seeing this warning each time.

@dennis-hamester can you open an issue for this behavior?

@Manishearth
Copy link
Member

One potential fix is to only emit this warning for docs that are going to be emitted in the current run. Linking private types is useful in document-private-items: when that's enabled we shoudl disable this lint, and when that's disabled we should only emit the lint for docs that are going to be rendered

@dennis-hamester
Copy link
Contributor

I use this "pattern" a lot in my crates, to provide documentation for private items when building with --document-private-items. When building without that flag no link to any of the private types ever gets actually generated, which is why the warning seems wrong to me.

Actually, I also tend to deny intra_doc_link_resolution_failure to catch bad links and but now of course I get lot's of errors.

Does that mean linking to a private type is generally discouraged? Is there a better way? I'd like to provide documentation for internals as well, not just for the public api.

@Manishearth
Copy link
Member

Manishearth commented Jul 7, 2020

I agree with @jyn514, people use document-private-items and we shouldn't warn then.

You link to a private item, so wether or not you're using it on a private item shouldn't matter in my opinion.

It does, because if you use it on a private item then it's only going to be rendered with document-private-items, where privacy doesn't matter.

@GuillaumeGomez
Copy link
Member

In case the --document-private-items option is used, it makes sense not to warn at this point. But otherwise, it seems normal to warn.

@GuillaumeGomez
Copy link
Member

Hum, on second thought, it might make no sense to complain if it's a link from a private item. But I still that linking to a private item should emit a warning (unless the --document-private-items option is provided of course).

@dennis-hamester
Copy link
Contributor

I opened #74134 and discussion should probably continue there.

@Manishearth
Copy link
Member

@GuillaumeGomez Yes, we should complain if you link to a private item from a public item, in non-private-document mode. The private-to-private links only make sense with document-private-items anyway, and it's weird to warn about them when that's disabled where they don't matter.

@GuillaumeGomez
Copy link
Member

@Manishearth Absolutely, took me a few minutes to see it.

dennis-hamester added a commit to dennis-hamester/rust that referenced this pull request Jul 8, 2020
Fixes rust-lang#74134

After PR rust-lang#72771 this would trigger an intra_doc_link_resolution_failure warning
when rustdoc is invoked without --document-private-items. Links from private
items to private types are however never actually generated in that case and
thus shouldn't produce a warning. These links are in fact a very useful tool to
document crate internals.

Tests are added for all 4 combinations of public/private items and link
targets. Test 1 is the case mentioned above and fails without this commit. Tests
2 - 4 passed before already but are added nonetheless to prevent regressions.
Manishearth added a commit to Manishearth/rust that referenced this pull request Jul 13, 2020
…jyn514

rustdoc: Allow linking from private items to private types

Fixes rust-lang#74134

After PR rust-lang#72771 this would trigger an intra_doc_link_resolution_failure warning
when rustdoc is invoked without --document-private-items. Links from private
items to private types are however never actually generated in that case and
thus shouldn't produce a warning. These links are in fact a very useful tool to
document crate internals.

Tests are added for all 4 combinations of public/private items and link
targets. Test 1 is the case mentioned above and fails without this commit. Tests
2 - 4 passed before already but are added nonetheless to prevent regressions.
Manishearth added a commit to Manishearth/rust that referenced this pull request Jul 13, 2020
…jyn514

rustdoc: Allow linking from private items to private types

Fixes rust-lang#74134

After PR rust-lang#72771 this would trigger an intra_doc_link_resolution_failure warning
when rustdoc is invoked without --document-private-items. Links from private
items to private types are however never actually generated in that case and
thus shouldn't produce a warning. These links are in fact a very useful tool to
document crate internals.

Tests are added for all 4 combinations of public/private items and link
targets. Test 1 is the case mentioned above and fails without this commit. Tests
2 - 4 passed before already but are added nonetheless to prevent regressions.
Manishearth added a commit to Manishearth/rust that referenced this pull request Jul 13, 2020
…jyn514

rustdoc: Allow linking from private items to private types

Fixes rust-lang#74134

After PR rust-lang#72771 this would trigger an intra_doc_link_resolution_failure warning
when rustdoc is invoked without --document-private-items. Links from private
items to private types are however never actually generated in that case and
thus shouldn't produce a warning. These links are in fact a very useful tool to
document crate internals.

Tests are added for all 4 combinations of public/private items and link
targets. Test 1 is the case mentioned above and fails without this commit. Tests
2 - 4 passed before already but are added nonetheless to prevent regressions.
Manishearth added a commit to Manishearth/rust that referenced this pull request Jul 13, 2020
…jyn514

rustdoc: Allow linking from private items to private types

Fixes rust-lang#74134

After PR rust-lang#72771 this would trigger an intra_doc_link_resolution_failure warning
when rustdoc is invoked without --document-private-items. Links from private
items to private types are however never actually generated in that case and
thus shouldn't produce a warning. These links are in fact a very useful tool to
document crate internals.

Tests are added for all 4 combinations of public/private items and link
targets. Test 1 is the case mentioned above and fails without this commit. Tests
2 - 4 passed before already but are added nonetheless to prevent regressions.
Manishearth added a commit to Manishearth/rust that referenced this pull request Jul 14, 2020
…jyn514

rustdoc: Allow linking from private items to private types

Fixes rust-lang#74134

After PR rust-lang#72771 this would trigger an intra_doc_link_resolution_failure warning
when rustdoc is invoked without --document-private-items. Links from private
items to private types are however never actually generated in that case and
thus shouldn't produce a warning. These links are in fact a very useful tool to
document crate internals.

Tests are added for all 4 combinations of public/private items and link
targets. Test 1 is the case mentioned above and fails without this commit. Tests
2 - 4 passed before already but are added nonetheless to prevent regressions.
Manishearth added a commit to Manishearth/rust that referenced this pull request Jul 14, 2020
…jyn514

rustdoc: Allow linking from private items to private types

Fixes rust-lang#74134

After PR rust-lang#72771 this would trigger an intra_doc_link_resolution_failure warning
when rustdoc is invoked without --document-private-items. Links from private
items to private types are however never actually generated in that case and
thus shouldn't produce a warning. These links are in fact a very useful tool to
document crate internals.

Tests are added for all 4 combinations of public/private items and link
targets. Test 1 is the case mentioned above and fails without this commit. Tests
2 - 4 passed before already but are added nonetheless to prevent regressions.
Manishearth added a commit to Manishearth/rust that referenced this pull request Jul 14, 2020
…jyn514

rustdoc: Allow linking from private items to private types

Fixes rust-lang#74134

After PR rust-lang#72771 this would trigger an intra_doc_link_resolution_failure warning
when rustdoc is invoked without --document-private-items. Links from private
items to private types are however never actually generated in that case and
thus shouldn't produce a warning. These links are in fact a very useful tool to
document crate internals.

Tests are added for all 4 combinations of public/private items and link
targets. Test 1 is the case mentioned above and fails without this commit. Tests
2 - 4 passed before already but are added nonetheless to prevent regressions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

rustdoc fails to link to private items without warning
8 participants