about summary refs log tree commit diff
diff options
context:
space:
mode:
authorManish Goregaokar <manishsmail@gmail.com>2020-07-09 11:50:26 -0700
committerGitHub <noreply@github.com>2020-07-09 11:50:26 -0700
commitd163524cf46c5d17b5243d6fb0b0b91d2749857d (patch)
tree7e79c6d24f55b1d07f0e90f0600ae80b57f87177
parent5fc46fa9d2cced87165b95c41a85840a43035751 (diff)
parentfe351e9b8eb19aeda4a34f4c64c75ffb60600cc0 (diff)
downloadrust-d163524cf46c5d17b5243d6fb0b0b91d2749857d.tar.gz
rust-d163524cf46c5d17b5243d6fb0b0b91d2749857d.zip
Rollup merge of #73791 - Manishearth:parens-intra-doc, r=GuillaumeGomez,jyn514
Allow for parentheses after macro intra-doc-links

None
-rw-r--r--src/librustdoc/passes/collect_intra_doc_links.rs3
-rw-r--r--src/test/rustdoc/intra-links.rs4
2 files changed, 6 insertions, 1 deletions
diff --git a/src/librustdoc/passes/collect_intra_doc_links.rs b/src/librustdoc/passes/collect_intra_doc_links.rs
index f1d1bf439f1..4fcf6ceb44d 100644
--- a/src/librustdoc/passes/collect_intra_doc_links.rs
+++ b/src/librustdoc/passes/collect_intra_doc_links.rs
@@ -602,6 +602,9 @@ impl<'a, 'tcx> DocFolder for LinkCollector<'a, 'tcx> {
                     kind = Some(ValueNS);
                     disambiguator = Some(&prefix[..prefix.len() - 1]);
                     link.trim_start_matches(prefix)
+                } else if link.ends_with("!()") {
+                    kind = Some(MacroNS);
+                    link.trim_end_matches("!()")
                 } else if link.ends_with("()") {
                     kind = Some(ValueNS);
                     disambiguator = Some("fn");
diff --git a/src/test/rustdoc/intra-links.rs b/src/test/rustdoc/intra-links.rs
index c6725f526aa..751c10925c0 100644
--- a/src/test/rustdoc/intra-links.rs
+++ b/src/test/rustdoc/intra-links.rs
@@ -46,6 +46,8 @@ macro_rules! this_macro {
     () => {};
 }
 
+// @has intra_links/struct.ThisType.html '//a/@href' '../intra_links/macro.this_macro.html'
+/// another link to [`this_macro!()`]
 pub struct ThisType;
 
 impl ThisType {
@@ -70,7 +72,7 @@ pub trait SoAmbiguous {}
 pub fn SoAmbiguous() {}
 
 
-// @has - '//a/@href' '../intra_links/struct.ThisType.html'
+// @has intra_links/struct.SomeOtherType.html '//a/@href' '../intra_links/struct.ThisType.html'
 // @has - '//a/@href' '../intra_links/struct.ThisType.html#method.this_method'
 // @has - '//a/@href' '../intra_links/enum.ThisEnum.html'
 // @has - '//a/@href' '../intra_links/enum.ThisEnum.html#variant.ThisVariant'