fn resolve_type(cx: &DocContext,
                path: Path,
                id: ast::NodeId) -> Type {
    let tcx = match cx.tcx_opt() {
        Some(tcx) => tcx,
        // If we're extracting tests, this return value doesn't matter.
        None => return Primitive(Bool),
    };
    debug!("searching for {} in defmap", id);
    let def = match tcx.def_map.borrow().get(&id) {
        Some(k) => k.full_def(),
        None => panic!("unresolved id not in defmap")
    };

    let is_generic = match def {
        def::DefPrimTy(p) => match p {
            ast::TyStr => return Primitive(Str),
            ast::TyBool => return Primitive(Bool),
            ast::TyChar => return Primitive(Char),
            ast::TyInt(ast::TyIs) => return Primitive(Isize),
            ast::TyInt(ast::TyI8) => return Primitive(I8),
            ast::TyInt(ast::TyI16) => return Primitive(I16),
            ast::TyInt(ast::TyI32) => return Primitive(I32),
            ast::TyInt(ast::TyI64) => return Primitive(I64),
            ast::TyUint(ast::TyUs) => return Primitive(Usize),
            ast::TyUint(ast::TyU8) => return Primitive(U8),
            ast::TyUint(ast::TyU16) => return Primitive(U16),
            ast::TyUint(ast::TyU32) => return Primitive(U32),
            ast::TyUint(ast::TyU64) => return Primitive(U64),
            ast::TyFloat(ast::TyF32) => return Primitive(F32),
            ast::TyFloat(ast::TyF64) => return Primitive(F64),
        },
        def::DefSelfTy(..) if path.segments.len() == 1 => {
            return Generic(token::get_name(special_idents::type_self.name).to_string());
        }
        def::DefSelfTy(..) | def::DefTyParam(..) => true,
        _ => false,
    };
    let did = register_def(&*cx, def);
    ResolvedPath { path: path, typarams: None, did: did, is_generic: is_generic }
}
/// Given a Type, resolve it using the def_map
Given a Type, resolve it using the def_map
Given a Type resolve it using the def_map
fn resolve_type(cx: &DocContext,
                path: Path,
                id: ast::NodeId) -> Type {
    let tcx = match cx.tcx_opt() {
        Some(tcx) => tcx,
        // If we're extracting tests, this return value doesn't matter.
        None => return Primitive(Bool),
    };
    debug!("searching for {} in defmap", id);
    let def = match tcx.def_map.borrow().get(&id) {
        Some(k) => k.full_def(),
        None => panic!("unresolved id not in defmap")
    };
    let is_generic = match def {
        def::DefPrimTy(p) => match p {
            ast::TyStr => return Primitive(Str),
            ast::TyBool => return Primitive(Bool),
            ast::TyChar => return Primitive(Char),
            ast::TyInt(ast::TyIs) => return Primitive(Isize),
            ast::TyInt(ast::TyI8) => return Primitive(I8),
            ast::TyInt(ast::TyI16) => return Primitive(I16),
            ast::TyInt(ast::TyI32) => return Primitive(I32),
            ast::TyInt(ast::TyI64) => return Primitive(I64),
            ast::TyUint(ast::TyUs) => return Primitive(Usize),
            ast::TyUint(ast::TyU8) => return Primitive(U8),
            ast::TyUint(ast::TyU16) => return Primitive(U16),
            ast::TyUint(ast::TyU32) => return Primitive(U32),
            ast::TyUint(ast::TyU64) => return Primitive(U64),
            ast::TyFloat(ast::TyF32) => return Primitive(F32),
            ast::TyFloat(ast::TyF64) => return Primitive(F64),
        },
        def::DefSelfTy(..) if path.segments.len() == 1 => {
            return Generic(token::get_name(special_idents::type_self.name).to_string());
        }
        def::DefSelfTy(..) | def::DefTyParam(..) => true,
        _ => false,
    };
    let did = register_def(&*cx, def);
    ResolvedPath { path: path, typarams: None, did: did, is_generic: is_generic }
}
fn resolve_type ( cx : & DocContext , path : Path , id : ast :: NodeId ) -> Type { let tcx = match cx . tcx_opt ( ) { Some ( tcx ) => tcx , // If we're extracting tests, this return value doesn't matter. None => return Primitive ( Bool ) , } ; debug ! ( " " id ) ; let def = match tcx . def_map . borrow ( ) . get ( & id ) { Some ( k ) => k . full_def ( ) , None => panic ! ( " " ) } ; let is_generic = match def { def :: DefPrimTy ( p ) => match p { ast :: TyStr => return Primitive ( Str ) , ast :: TyBool => return Primitive ( Bool ) , ast :: TyChar => return Primitive ( Char ) , ast :: TyInt ( ast :: TyIs ) => return Primitive ( Isize ) , ast :: TyInt ( ast :: TyI8 ) => return Primitive ( I8 ) , ast :: TyInt ( ast :: TyI16 ) => return Primitive ( I16 ) , ast :: TyInt ( ast :: TyI32 ) => return Primitive ( I32 ) , ast :: TyInt ( ast :: TyI64 ) => return Primitive ( I64 ) , ast :: TyUint ( ast :: TyUs ) => return Primitive ( Usize ) , ast :: TyUint ( ast :: TyU8 ) => return Primitive ( U8 ) , ast :: TyUint ( ast :: TyU16 ) => return Primitive ( U16 ) , ast :: TyUint ( ast :: TyU32 ) => return Primitive ( U32 ) , ast :: TyUint ( ast :: TyU64 ) => return Primitive ( U64 ) , ast :: TyFloat ( ast :: TyF32 ) => return Primitive ( F32 ) , ast :: TyFloat ( ast :: TyF64 ) => return Primitive ( F64 ) , } , def :: DefSelfTy ( .. ) if path . segments . len ( ) == 1 => { return Generic ( token :: get_name ( special_idents :: type_self . name ) . to_string ( ) ) ; } def :: DefSelfTy ( .. ) | def :: DefTyParam ( .. ) => true , _ => false , } ; let did = register_def ( & * cx , def ) ; ResolvedPath { path : path , typarams : None , did : did , is_generic : is_generic } }
Given a Type, resolve it using the def_map
Given a Type resolve it using the def_map
cx
&DocContext
path
Path
id
ast::NodeId
cx
&DocContext
path
Path
id
ast::NodeId