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:
commit
fe1293f8a9
5 changed files with 61 additions and 16 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue