Skip to content

Commit

Permalink
Rollup merge of #73791 - Manishearth:parens-intra-doc, r=GuillaumeGom…
Browse files Browse the repository at this point in the history
…ez,jyn514

Allow for parentheses after macro intra-doc-links

None
  • Loading branch information
Manishearth committed Jul 9, 2020
2 parents 5fc46fa + fe351e9 commit d163524
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/librustdoc/passes/collect_intra_doc_links.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
4 changes: 3 additions & 1 deletion src/test/rustdoc/intra-links.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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'
Expand Down

0 comments on commit d163524

Please sign in to comment.