Rollup merge of #73791 - Manishearth:parens-intra-doc, r=GuillaumeGomez,jyn514

Allow for parentheses after macro intra-doc-links

None
This commit is contained in:
Manish Goregaokar 2020-07-09 11:50:26 -07:00 committed by GitHub
commit d163524cf4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View File

@ -602,6 +602,9 @@ fn fold_item(&mut self, mut item: Item) -> Option<Item> {
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");

View File

@ -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'