-
Notifications
You must be signed in to change notification settings - Fork 13.3k
rustdoc does not warn about broken links if they contain .
or []
#54191
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
The resolution failure is expected (should have been |
This is caused by this section of the intra-doc link code: rust/src/librustdoc/passes/collect_intra_doc_links.rs Lines 356 to 359 in 15d7704
I think the idea here is that because of the dot, the link could be to a file, so it doesn't try to check it. (There's a similar skip earlier in the loop for if the link contains |
Update intra-doc link documentation to match the implementation r? `@Manishearth` cc `@camelid` `@m-ou-se` Relevant PRs: - rust-lang#74489 - rust-lang#80181 - rust-lang#76078 - rust-lang#77519 - rust-lang#73101 Relevant issues: - rust-lang#78800 - rust-lang#77200 - rust-lang#77199 / rust-lang#54191 I haven't documented things that I consider 'just bugs', like rust-lang#77732, but I have documented features that aren't implemented, like rust-lang#78800.
@dylni mentioned in #77199 that this also applies to things like |
.
or []
.
or []
.
or []
I suspect a thing we can do is unconditionally hit the intra doc resolution path if it has backticks in it, at least. I'd rather not introduce another lint; we should work on improving the diagnostic instead. |
Can we check whether it resolved as a markdown link too?
|
@Nemo157 none of these links will ever resolve. rust/src/librustdoc/passes/collect_intra_doc_links.rs Lines 2206 to 2234 in 8b95491
|
Oh, you mean as a URL. Hmm, maybe? I have to look back over the pulldown API. |
The |
@Nemo157 you misunderstand; we only hit this codepath for broken refs and for actual URLs. If it resolved to a markdown ref the ref title will never be seen here, though the URL passed to the ref title might (if it's sufficiently non-URLlike) |
Oh, though I guess we could unconditionally warn on unresolving broken refs (but use the intra doc diagnostic on broken urls) |
another case where these get confusing:
the |
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 rust-lang#54191
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 rust-lang#54191
I got a PR yesterday that included something like this:
In the current nightly rustdoc,
foo.bar()
neither resolves nor warns:Our CI with
--deny warnings
did not catch this mistake (although I did 😄). I think rustdoc should triggerintra-doc-link-resolution-failure
for this case.The text was updated successfully, but these errors were encountered: