-
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
Conversation
Some changes occurred in intra-doc-links. cc @jyn514 |
r? @jyn514 (rust-highfive has picked a reviewer for you, use r? to override) |
922b888
to
0ffc9b3
Compare
This comment has been minimized.
This comment has been minimized.
0ffc9b3
to
4572e7f
Compare
And, now that we do that, we can remove the explanatory note since the error span should make it clear what the disambiguator is.
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!()). | ||
| ^ |
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 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 comment
The 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.
091f43f
to
141df6f
Compare
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!()). | ||
| ^ |
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'm not sure, sorry. Probably it's something to do with how pulldown-cmark returns the links.
let after_first_backtick_group = ori_link.link.bytes().position(|b| b != b'`').unwrap_or(0); | ||
let before_second_backtick_group = ori_link | ||
.link | ||
.bytes() | ||
.skip(after_first_backtick_group) | ||
.position(|b| b == b'`') | ||
.unwrap_or(ori_link.link.len()); |
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
[`a`b`c`]
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.
error: unknown disambiguator `foo`
--> src/test/rustdoc-ui/intra-doc/unknown-disambiguator.rs:12:7
|
12 | //! [`foo@`b`c`]
| ^^^
@bors r+ |
📌 Commit 141df6f has been approved by |
… r=jyn514 Lint on unknown intra-doc link disambiguators
Rollup of 7 pull requests Successful merges: - rust-lang#82331 (alloc: Added `as_slice` method to `BinaryHeap` collection) - rust-lang#83130 (escape_ascii take 2) - rust-lang#83374 (unix: Fix feature(unix_socket_ancillary_data) on macos and other BSDs) - rust-lang#83543 (Lint on unknown intra-doc link disambiguators) - rust-lang#83636 (Add a regression test for issue-82792) - rust-lang#83643 (Remove a FIXME resolved by rust-lang#73578) - rust-lang#83644 (:arrow_up: rust-analyzer) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
No description provided.