diff options
| author | Joshua Nelson <jyn514@gmail.com> | 2020-09-13 20:56:33 -0400 |
|---|---|---|
| committer | Joshua Nelson <jyn514@gmail.com> | 2020-09-13 21:31:26 -0400 |
| commit | f7983cae7008b8f86d927ddcd83a0b4785307b24 (patch) | |
| tree | a9f396c1b9f1f792693285cc710701f95e8b44e1 | |
| parent | e4c28bf61a0631b6bf4bd9e53da53611399c1129 (diff) | |
| download | rust-f7983cae7008b8f86d927ddcd83a0b4785307b24.tar.gz rust-f7983cae7008b8f86d927ddcd83a0b4785307b24.zip | |
Don't use `link.span` yet
This shows the span of the _whole_ link, including the brackets. But rustdoc only wants to warn about the link text.
| -rw-r--r-- | src/librustdoc/html/markdown.rs | 4 | ||||
| -rw-r--r-- | src/test/rustdoc-ui/intra-link-double-anchor.stderr | 4 |
2 files changed, 5 insertions, 3 deletions
diff --git a/src/librustdoc/html/markdown.rs b/src/librustdoc/html/markdown.rs index 178c9b0fad3..a25d49c3495 100644 --- a/src/librustdoc/html/markdown.rs +++ b/src/librustdoc/html/markdown.rs @@ -1088,7 +1088,9 @@ pub fn markdown_links(md: &str) -> Vec<(String, Option<Range<usize>>)> { }; let mut push = |link: BrokenLink<'_>| { - shortcut_links.push((link.reference.to_owned(), Some(link.span))); + // FIXME: use `link.span` instead of `locate` + // (doing it now includes the `[]` as well as the text) + shortcut_links.push((link.reference.to_owned(), locate(link.reference))); None }; let p = Parser::new_with_broken_link_callback(md, opts(), Some(&mut push)); diff --git a/src/test/rustdoc-ui/intra-link-double-anchor.stderr b/src/test/rustdoc-ui/intra-link-double-anchor.stderr index 55636d5c2f4..3282ec8b793 100644 --- a/src/test/rustdoc-ui/intra-link-double-anchor.stderr +++ b/src/test/rustdoc-ui/intra-link-double-anchor.stderr @@ -1,8 +1,8 @@ warning: `with#anchor#error` contains multiple anchors - --> $DIR/intra-link-double-anchor.rs:5:10 + --> $DIR/intra-link-double-anchor.rs:5:18 | LL | /// docs [label][with#anchor#error] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ contains invalid anchor + | ^^^^^^^^^^^^^^^^^ contains invalid anchor | = note: `#[warn(broken_intra_doc_links)]` on by default |
