/// 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 {
            hir::TyStr => return Primitive(Str),
            hir::TyBool => return Primitive(Bool),
            hir::TyChar => return Primitive(Char),
            hir::TyInt(hir::TyIs) => return Primitive(Isize),
            hir::TyInt(hir::TyI8) => return Primitive(I8),
            hir::TyInt(hir::TyI16) => return Primitive(I16),
            hir::TyInt(hir::TyI32) => return Primitive(I32),
            hir::TyInt(hir::TyI64) => return Primitive(I64),
            hir::TyUint(hir::TyUs) => return Primitive(Usize),
            hir::TyUint(hir::TyU8) => return Primitive(U8),
            hir::TyUint(hir::TyU16) => return Primitive(U16),
            hir::TyUint(hir::TyU32) => return Primitive(U32),
            hir::TyUint(hir::TyU64) => return Primitive(U64),
            hir::TyFloat(hir::TyF32) => return Primitive(F32),
            hir::TyFloat(hir::TyF64) => return Primitive(F64),
        },
        def::DefSelfTy(..) if path.segments.len() == 1 => {
            return Generic(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 { hir :: TyStr => return Primitive ( Str ) , hir :: TyBool => return Primitive ( Bool ) , hir :: TyChar => return Primitive ( Char ) , hir :: TyInt ( hir :: TyIs ) => return Primitive ( Isize ) , hir :: TyInt ( hir :: TyI8 ) => return Primitive ( I8 ) , hir :: TyInt ( hir :: TyI16 ) => return Primitive ( I16 ) , hir :: TyInt ( hir :: TyI32 ) => return Primitive ( I32 ) , hir :: TyInt ( hir :: TyI64 ) => return Primitive ( I64 ) , hir :: TyUint ( hir :: TyUs ) => return Primitive ( Usize ) , hir :: TyUint ( hir :: TyU8 ) => return Primitive ( U8 ) , hir :: TyUint ( hir :: TyU16 ) => return Primitive ( U16 ) , hir :: TyUint ( hir :: TyU32 ) => return Primitive ( U32 ) , hir :: TyUint ( hir :: TyU64 ) => return Primitive ( U64 ) , hir :: TyFloat ( hir :: TyF32 ) => return Primitive ( F32 ) , hir :: TyFloat ( hir :: TyF64 ) => return Primitive ( F64 ) , } , def :: DefSelfTy ( .. ) if path . segments . len ( ) == 1 => { return Generic ( 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