about summary refs log tree commit diff
path: root/tests/rustdoc-js-std
diff options
context:
space:
mode:
authorSamuel Tardieu <sam@rfc1149.net>2025-08-02 11:24:20 +0200
committerGitHub <noreply@github.com>2025-08-02 11:24:20 +0200
commitfc4b3fa3f98e1ebe81e1aaded09d1072bde3849a (patch)
tree7f5694fdc0c485b6a2350619fdd9733e2b316f65 /tests/rustdoc-js-std
parent889701db1ff614160314734fe4138c2f820a95bb (diff)
parenta73d7e3ab9cc29cb427c1463d1a02b89dd7728b6 (diff)
downloadrust-fc4b3fa3f98e1ebe81e1aaded09d1072bde3849a.tar.gz
rust-fc4b3fa3f98e1ebe81e1aaded09d1072bde3849a.zip
Rollup merge of #132748 - lolbinarycat:rustdoc-intra-doc-link-warn-more-54191, r=GuillaumeGomez
get rid of some false negatives in rustdoc::broken_intra_doc_links

rustdoc will not try to do intra-doc linking if the "path" of a link looks too much like a "real url".

however, only inline links (`[text](url)`) can actually contain a url, other types of links (reference links, shortcut links) contain a *reference* which is later resolved to an actual url.

the "path" in this case cannot be a url, and therefore it should not be skipped due to looking like a url.

fixes https://github.com/rust-lang/rust/issues/54191

to minimize the number of false positives that will be introduced, the following heuristic is used:

If there's no backticks, be lenient revert to old behavior.
This is to prevent churn by linting on stuff that isn't meant to be a link.
only shortcut links have simple enough syntax that they
are likely to be written accidentlly, collapsed and reference links
need 4 metachars, and reference links will not usually use
backticks in the reference name.
therefore, only shortcut syntax gets the lenient behavior.
here's a truth table for how link kinds that cannot be urls are handled:

|              |  is shortcut link  | not shortcut link |
|--------------|--------------------|-------------------|
| has backtick |    never ignore    |    never ignore   |
| no backtick  | ignore if url-like |    never ignore   |
Diffstat (limited to 'tests/rustdoc-js-std')
0 files changed, 0 insertions, 0 deletions