-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Lint on unknown intra-doc link disambiguators #83543
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#![deny(warnings)] | ||
|
||
//! Linking to [foo@banana] and [`bar@banana!()`]. | ||
//~^ ERROR unknown disambiguator `foo` | ||
//~| ERROR unknown disambiguator `bar` | ||
//! And to [no disambiguator](@nectarine) and [another](@apricot!()). | ||
//~^ ERROR unknown disambiguator `` | ||
//~| ERROR unknown disambiguator `` | ||
//! And with weird backticks: [``foo@hello``] [foo`@`hello]. | ||
//~^ ERROR unknown disambiguator `foo` | ||
//~| ERROR unknown disambiguator `foo` | ||
|
||
fn main() {} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
error: unknown disambiguator `foo` | ||
--> $DIR/unknown-disambiguator.rs:3:17 | ||
| | ||
LL | //! Linking to [foo@banana] and [`bar@banana!()`]. | ||
| ^^^ | ||
| | ||
note: the lint level is defined here | ||
--> $DIR/unknown-disambiguator.rs:1:9 | ||
| | ||
LL | #![deny(warnings)] | ||
| ^^^^^^^^ | ||
= note: `#[deny(rustdoc::broken_intra_doc_links)]` implied by `#[deny(warnings)]` | ||
|
||
error: unknown disambiguator `bar` | ||
--> $DIR/unknown-disambiguator.rs:3:35 | ||
| | ||
LL | //! Linking to [foo@banana] and [`bar@banana!()`]. | ||
| ^^^ | ||
|
||
error: unknown disambiguator `foo` | ||
--> $DIR/unknown-disambiguator.rs:9:34 | ||
| | ||
LL | //! And with weird backticks: [``foo@hello``] [foo`@`hello]. | ||
| ^^^ | ||
|
||
error: unknown disambiguator `foo` | ||
--> $DIR/unknown-disambiguator.rs:9:48 | ||
| | ||
LL | //! And with weird backticks: [``foo@hello``] [foo`@`hello]. | ||
| ^^^ | ||
|
||
error: unknown disambiguator `` | ||
--> $DIR/unknown-disambiguator.rs:6:31 | ||
| | ||
LL | //! And to [no disambiguator](@nectarine) and [another](@apricot!()). | ||
| ^ | ||
Comment on lines
+14
to
+36
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think this is caused by my change, but any idea why it's reporting diagnostics for line 3, then line 9, and then back to line 6? It's kind of confusing that they're out of order. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure, sorry. Probably it's something to do with how pulldown-cmark returns the links. |
||
|
||
error: unknown disambiguator `` | ||
--> $DIR/unknown-disambiguator.rs:6:57 | ||
| | ||
LL | //! And to [no disambiguator](@nectarine) and [another](@apricot!()). | ||
| ^ | ||
|
||
error: aborting due to 6 previous errors | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this will break on things like
but that seems fine, that's an awful abuse of rustdoc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It actually works correctly! But I imagine there are some edge cases that don't work correctly.