Skip to content

Commit c191cd1

Browse files
authored
Rollup merge of rust-lang#73791 - Manishearth:parens-intra-doc, r=GuillaumeGomez,jyn514
Allow for parentheses after macro intra-doc-links None
2 parents 806cfce + fe351e9 commit c191cd1

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/librustdoc/passes/collect_intra_doc_links.rs

+3
Original file line numberDiff line numberDiff line change
@@ -602,6 +602,9 @@ impl<'a, 'tcx> DocFolder for LinkCollector<'a, 'tcx> {
602602
kind = Some(ValueNS);
603603
disambiguator = Some(&prefix[..prefix.len() - 1]);
604604
link.trim_start_matches(prefix)
605+
} else if link.ends_with("!()") {
606+
kind = Some(MacroNS);
607+
link.trim_end_matches("!()")
605608
} else if link.ends_with("()") {
606609
kind = Some(ValueNS);
607610
disambiguator = Some("fn");

src/test/rustdoc/intra-links.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ macro_rules! this_macro {
4646
() => {};
4747
}
4848

49+
// @has intra_links/struct.ThisType.html '//a/@href' '../intra_links/macro.this_macro.html'
50+
/// another link to [`this_macro!()`]
4951
pub struct ThisType;
5052

5153
impl ThisType {
@@ -70,7 +72,7 @@ pub trait SoAmbiguous {}
7072
pub fn SoAmbiguous() {}
7173

7274

73-
// @has - '//a/@href' '../intra_links/struct.ThisType.html'
75+
// @has intra_links/struct.SomeOtherType.html '//a/@href' '../intra_links/struct.ThisType.html'
7476
// @has - '//a/@href' '../intra_links/struct.ThisType.html#method.this_method'
7577
// @has - '//a/@href' '../intra_links/enum.ThisEnum.html'
7678
// @has - '//a/@href' '../intra_links/enum.ThisEnum.html#variant.ThisVariant'

0 commit comments

Comments
 (0)