1
Fork 0

Rollup merge of #48335 - Manishearth:shortcut-links, r=QuietMisdreavus

Implement implied shortcut links for intra-rustdoc-links

cc https://github.com/rust-lang/rust/issues/43466

Needs https://github.com/google/pulldown-cmark/pull/126

r? @QuietMisdreavus
This commit is contained in:
Guillaume Gomez 2018-02-21 16:29:52 +01:00 committed by GitHub
commit fe1293f8a9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 61 additions and 16 deletions

View file

@ -1044,7 +1044,7 @@ fn resolve(cx: &DocContext, path_str: &str, is_val: bool) -> Result<(Def, Option
/// Resolve a string as a macro
fn macro_resolve(cx: &DocContext, path_str: &str) -> Option<Def> {
use syntax::ext::base::MacroKind;
use syntax::ext::base::{MacroKind, SyntaxExtension};
use syntax::ext::hygiene::Mark;
let segment = ast::PathSegment {
identifier: ast::Ident::from_str(path_str),
@ -1061,7 +1061,11 @@ fn macro_resolve(cx: &DocContext, path_str: &str) -> Option<Def> {
let res = resolver
.resolve_macro_to_def_inner(mark, &path, MacroKind::Bang, false);
if let Ok(def) = res {
Some(def)
if let SyntaxExtension::DeclMacro(..) = *resolver.get_macro(def) {
Some(def)
} else {
None
}
} else if let Some(def) = resolver.all_macros.get(&path_str.into()) {
Some(*def)
} else {