fn macro_resolve(cx: &DocContext, path_str: &str) -> Option<Def> {
    use syntax::ext::base::{MacroKind, SyntaxExtension};
    use syntax::ext::hygiene::Mark;
    let segment = ast::PathSegment::from_ident(Ident::from_str(path_str));
    let path = ast::Path { segments: vec![segment], span: DUMMY_SP };
    let mut resolver = cx.resolver.borrow_mut();
    let mark = Mark::root();
    let res = resolver
        .resolve_macro_to_def_inner(mark, &path, MacroKind::Bang, false);
    if let Ok(def) = res {
        if let SyntaxExtension::DeclMacro { .. } = *resolver.get_macro(def) {
            return Some(def);
        }
    }
    if let Some(def) = resolver.all_macros.get(&Symbol::intern(path_str)) {
        return Some(*def);
    }
    None
}
/// Resolve a string as a macro
Resolve a string as a macro
Resolve a string as a macro
fn macro_resolve(cx: &DocContext, path_str: &str) -> Option<Def> {
    use syntax::ext::base::{MacroKind, SyntaxExtension};
    use syntax::ext::hygiene::Mark;
    let segment = ast::PathSegment::from_ident(Ident::from_str(path_str));
    let path = ast::Path { segments: vec![segment], span: DUMMY_SP };
    let mut resolver = cx.resolver.borrow_mut();
    let mark = Mark::root();
    let res = resolver
        .resolve_macro_to_def_inner(mark, &path, MacroKind::Bang, false);
    if let Ok(def) = res {
        if let SyntaxExtension::DeclMacro { .. } = *resolver.get_macro(def) {
            return Some(def);
        }
    }
    if let Some(def) = resolver.all_macros.get(&Symbol::intern(path_str)) {
        return Some(*def);
    }
    None
}
fn macro_resolve ( cx : & DocContext , path_str : & str ) -> Option < Def > { use syntax :: ext :: base :: { MacroKind , SyntaxExtension } ; use syntax :: ext :: hygiene :: Mark ; let segment = ast :: PathSegment :: from_ident ( Ident :: from_str ( path_str ) ) ; let path = ast :: Path { segments : vec ! [ segment ] , span : DUMMY_SP } ; let mut resolver = cx . resolver . borrow_mut ( ) ; let mark = Mark :: root ( ) ; let res = resolver . resolve_macro_to_def_inner ( mark , & path , MacroKind :: Bang , false ) ; if let Ok ( def ) = res { if let SyntaxExtension :: DeclMacro { .. } = * resolver . get_macro ( def ) { return Some ( def ) ; } } if let Some ( def ) = resolver . all_macros . get ( & Symbol :: intern ( path_str ) ) { return Some ( * def ) ; } None }
Resolve a string as a macro
Resolve a string as a macro
cx
&DocContext
path_str
&str