Skip to content

Commit

Permalink
Don't use link.span yet
Browse files Browse the repository at this point in the history
This shows the span of the _whole_ link, including the brackets.
But rustdoc only wants to warn about the link text.
  • Loading branch information
jyn514 committed Sep 14, 2020
1 parent e4c28bf commit f7983ca
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/librustdoc/html/markdown.rs
Expand Up @@ -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));
Expand Down
4 changes: 2 additions & 2 deletions 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

Expand Down

0 comments on commit f7983ca

Please sign in to comment.