forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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 rust-lang#54191
- Loading branch information
1 parent
7028d93
commit 8ae6586
Showing
3 changed files
with
61 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#![no_std] | ||
#![deny(rustdoc::broken_intra_doc_links)] | ||
|
||
// regression test for https://github.com/rust-lang/rust/issues/54191 | ||
|
||
/// this is not a link to [`example.com`] | ||
/// | ||
/// this link [`has spaces in it`]. | ||
/// | ||
/// attempted link to method: [`Foo.bar()`] | ||
/// | ||
/// classic broken intra-doc link: [`Bar`] | ||
pub struct Foo; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
error: unresolved link to `example.com` | ||
--> $DIR/bad-intra-doc.rs:6:29 | ||
| | ||
LL | /// this is not a link to [`example.com`] | ||
| ^^^^^^^^^^^ no item named `example.com` in scope | ||
| | ||
= help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]` | ||
note: the lint level is defined here | ||
--> $DIR/bad-intra-doc.rs:2:9 | ||
| | ||
LL | #![deny(rustdoc::broken_intra_doc_links)] | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: unresolved link to `has spaces in it` | ||
--> $DIR/bad-intra-doc.rs:8:17 | ||
| | ||
LL | /// this link [`has spaces in it`]. | ||
| ^^^^^^^^^^^^^^^^ no item named `has spaces in it` in scope | ||
| | ||
= help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]` | ||
|
||
error: unresolved link to `Foo.bar` | ||
--> $DIR/bad-intra-doc.rs:10:33 | ||
| | ||
LL | /// attempted link to method: [`Foo.bar()`] | ||
| ^^^^^^^^^ no item named `Foo.bar` in scope | ||
| | ||
= help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]` | ||
|
||
error: unresolved link to `Bar` | ||
--> $DIR/bad-intra-doc.rs:12:38 | ||
| | ||
LL | /// classic broken intra-doc link: [`Bar`] | ||
| ^^^ no item named `Bar` in scope | ||
| | ||
= help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]` | ||
|
||
error: aborting due to 4 previous errors | ||
|