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

Avoid some common false positives in intra doc link checking #59037

Merged
merged 1 commit into from
Mar 16, 2019

Conversation

Manishearth
Copy link
Member

The empty string case is never going to be a link. The numeric case may be a link, but if it were it would have resolved locally. It's more likely the makeshift markdown footnote notation ([0], etc)

r? @QuietMisdreavus

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Mar 9, 2019
@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-6.0 of your PR failed on Travis (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.
travis_time:end:00ce1cda:start=1552108483731564947,finish=1552108484615711045,duration=884146098
$ git checkout -qf FETCH_HEAD
travis_fold:end:git.checkout

Encrypted environment variables have been removed for security reasons.
See https://docs.travis-ci.com/user/pull-requests/#pull-requests-and-security-restrictions
$ export SCCACHE_BUCKET=rust-lang-ci-sccache2
$ export SCCACHE_REGION=us-west-1
$ export GCP_CACHE_BUCKET=rust-lang-ci-cache
Setting environment variables from .travis.yml
---
[00:56:56]    Compiling rustdoc v0.0.0 (/checkout/src/librustdoc)
[00:57:01] error[E0615]: attempted to take value of method `chars` on type `std::string::String`
[00:57:01]    --> src/librustdoc/passes/collect_intra_doc_links.rs:302:25
[00:57:01]     |
[00:57:01] 302 |             if ori_link.chars.first().unwrap().is_numeric() {
[00:57:01]     |                         ^^^^^ help: use parentheses to call the method: `chars()`
[00:57:01] error: aborting due to previous error
[00:57:01] 
[00:57:01] For more information about this error, try `rustc --explain E0615`.
[00:57:01] error: Could not compile `rustdoc`.

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 @TimNN. (Feature Requests)

@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-6.0 of your PR failed on Travis (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.
travis_time:end:32d63af5:start=1552113615040351762,finish=1552113615929897456,duration=889545694
$ git checkout -qf FETCH_HEAD
travis_fold:end:git.checkout

Encrypted environment variables have been removed for security reasons.
See https://docs.travis-ci.com/user/pull-requests/#pull-requests-and-security-restrictions
$ export SCCACHE_BUCKET=rust-lang-ci-sccache2
$ export SCCACHE_REGION=us-west-1
$ export GCP_CACHE_BUCKET=rust-lang-ci-cache
Setting environment variables from .travis.yml
---
[00:57:35]    Compiling parking_lot_core v0.4.0
[00:57:40]    Compiling tempfile v3.0.5
[00:57:42]    Compiling parking_lot v0.7.1
[00:57:43]    Compiling rustdoc v0.0.0 (/checkout/src/librustdoc)
[00:57:48] error[E0599]: no method named `first` found for type `std::str::Chars<'_>` in the current scope
[00:57:48]     |
[00:57:48]     |
[00:57:48] 302 |             if ori_link.chars().first().unwrap().is_numeric() {
[00:57:48] 
[00:57:49] error: aborting due to previous error
[00:57:49] 
[00:57:49] For more information about this error, try `rustc --explain E0599`.
---
travis_time:end:05a780d6:start=1552117096005320376,finish=1552117096012714702,duration=7394326
travis_fold:end:after_failure.4
travis_fold:start:after_failure.5
travis_time:start:0337a408
$ cat ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers || true
cat: ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers: No such file or directory
travis_fold:end:after_failure.5
travis_fold:start:after_failure.6
travis_time:start:066356d0
$ dmesg | grep -i kill

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 @TimNN. (Feature Requests)

@euclio
Copy link
Contributor

euclio commented Mar 9, 2019

I'm not sure that I agree with silencing the warning for footnotes. I personally would want to be warned that my footnote link isn't resolving to anything. Maybe there could be a note/help suggesting to add a link if it looks like a footnote?

@Manishearth
Copy link
Member Author

Footnote links aren't links: rustdoc's markdown parser doesn't do footnotes.

It's a common technique in plaintext to do footnotes with [0] [1], etc. There is no expectation that this will resolve because it's not a link -- the footnote itself contains text (not a URL).

@ollie27
Copy link
Member

ollie27 commented Mar 9, 2019

rustdoc's markdown parser doesn't do footnotes.

rustdoc does support footnotes. The syntax is [^0].

@Manishearth
Copy link
Member Author

Oh, huh. TIL.

Still not sure if we should be warning about those (we don't warn about broken links either) but I guess it's fine.

@estebank
Copy link
Contributor

Could we suggest using the footnote syntax when not resolving a link that is only a number?

@Manishearth
Copy link
Member Author

Manishearth commented Mar 10, 2019 via email

@QuietMisdreavus
Copy link
Member

Could we suggest using the footnote syntax when not resolving a link that is only a number?

Did we want to include this on this PR? If not, r=me, otherwise i'll wait to see it.

@Manishearth
Copy link
Member Author

Nah, that would be a different lint I think, but feel free to add it yourself.

@bors r=QuietMisdreavus

@bors
Copy link
Contributor

bors commented Mar 11, 2019

📌 Commit a4ea084 has been approved by QuietMisdreavus

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 11, 2019
kennytm added a commit to kennytm/rust that referenced this pull request Mar 11, 2019
…tMisdreavus

Avoid some common false positives in intra doc link checking

The empty string case is never going to be a link. The numeric case may be a link, but if it were it would have resolved locally. It's more likely the makeshift markdown footnote notation (`[0]`, etc)

r? @QuietMisdreavus
pietroalbini added a commit to pietroalbini/rust that referenced this pull request Mar 13, 2019
…tMisdreavus

Avoid some common false positives in intra doc link checking

The empty string case is never going to be a link. The numeric case may be a link, but if it were it would have resolved locally. It's more likely the makeshift markdown footnote notation (`[0]`, etc)

r? @QuietMisdreavus
kennytm added a commit to kennytm/rust that referenced this pull request Mar 15, 2019
…tMisdreavus

Avoid some common false positives in intra doc link checking

The empty string case is never going to be a link. The numeric case may be a link, but if it were it would have resolved locally. It's more likely the makeshift markdown footnote notation (`[0]`, etc)

r? @QuietMisdreavus
kennytm added a commit to kennytm/rust that referenced this pull request Mar 16, 2019
…tMisdreavus

Avoid some common false positives in intra doc link checking

The empty string case is never going to be a link. The numeric case may be a link, but if it were it would have resolved locally. It's more likely the makeshift markdown footnote notation (`[0]`, etc)

r? @QuietMisdreavus
bors added a commit that referenced this pull request Mar 16, 2019
Rollup of 37 pull requests

Successful merges:

 - #58854 (appveyor: Use VS2017 for all our images)
 - #58855 (std: Spin for a global malloc lock on wasm32)
 - #58873 (Fix "Auto-hide item methods documentation" setting)
 - #58901 (Change `std::fs::copy` to use `copyfile` on MacOS and iOS)
 - #58933 (Move alloc::prelude::* to alloc::prelude::v1, make alloc a subset of std)
 - #58938 (core: ensure VaList passes improper_ctypes lint)
 - #58941 (MIPS: add r6 support)
 - #58949 (SGX target: Expose thread id function in os module)
 - #58959 (Add release notes for PR #56243)
 - #58976 (Default to integrated `rust-lld` linker for UEFI targets)
 - #59009 (Fix SGX implementations of read/write_vectored.)
 - #59025 (Fix generic argument lookup for Self)
 - #59036 (Fix ICE in MIR pretty printing)
 - #59037 (Avoid some common false positives in intra doc link checking)
 - #59072 (we can now skip should_panic tests with the libtest harness)
 - #59079 (add suggestions to invalid macro item error)
 - #59082 (A few improvements to comments in user-facing crates)
 - #59102 (Consistent naming for duration_float methods and additional f32 methods)
 - #59118 (rustc: fix ICE when trait alias has bare Self)
 - #59139 (Unregress using scalar unions in constants.)
 - #59146 (Suggest return lifetime when there's only one named lifetime)
 - #59147 (Make std time tests more robust for platform differences)
 - #59152 (Stabilize Range*::contains.)
 - #59156 ([wg-async-await] Add regression test for #55809.)
 - #59158 (Revert "Don't generate minification variable if minification disabled")
 - #59169 (Add `-Z allow_features=...` flag)
 - #59173 (bootstrap: Default to a sensible llvm-suffix.)
 - #59175 (Don't run test launching `echo` since that doesn't exist on Windows)
 - #59180 (Use try blocks in rustc_codegen_ssa)
 - #59185 (No old chestnuts in iter::repeat docs)
 - #59201 (Remove restriction on isize/usize in repr(simd))
 - #59204 (Output diagnostic information for rustdoc)
 - #59206 (Improved test output)
 - #59208 (Reduce a Code Repetition Related to Bit Operation)
 - #59212 (Add x86_64 musl host to the manifest)
 - #59221 (Option and Result: Add references to documentation of as_ref and as_mut)
 - #59231 (Stabilize Option::copied)
@bors bors merged commit a4ea084 into rust-lang:master Mar 16, 2019
@Manishearth Manishearth deleted the intra-doc-false branch July 18, 2020 01:15
@Manishearth Manishearth restored the intra-doc-false branch July 18, 2020 01:15
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.

7 participants