Skip to content

Commit f7983ca

Browse files
committed
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.
1 parent e4c28bf commit f7983ca

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/librustdoc/html/markdown.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1088,7 +1088,9 @@ pub fn markdown_links(md: &str) -> Vec<(String, Option<Range<usize>>)> {
10881088
};
10891089

10901090
let mut push = |link: BrokenLink<'_>| {
1091-
shortcut_links.push((link.reference.to_owned(), Some(link.span)));
1091+
// FIXME: use `link.span` instead of `locate`
1092+
// (doing it now includes the `[]` as well as the text)
1093+
shortcut_links.push((link.reference.to_owned(), locate(link.reference)));
10921094
None
10931095
};
10941096
let p = Parser::new_with_broken_link_callback(md, opts(), Some(&mut push));

src/test/rustdoc-ui/intra-link-double-anchor.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
warning: `with#anchor#error` contains multiple anchors
2-
--> $DIR/intra-link-double-anchor.rs:5:10
2+
--> $DIR/intra-link-double-anchor.rs:5:18
33
|
44
LL | /// docs [label][with#anchor#error]
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ contains invalid anchor
5+
| ^^^^^^^^^^^^^^^^^ contains invalid anchor
66
|
77
= note: `#[warn(broken_intra_doc_links)]` on by default
88

0 commit comments

Comments
 (0)