pub fn lookup(tcx: &ty::ctxt, id: DefId) -> Option<Stability> {
    debug!("lookup(id={})",
           id.repr(tcx));

    // is this definition the implementation of a trait method?
    match ty::trait_item_of_item(tcx, id) {
        Some(ty::MethodTraitItemId(trait_method_id)) if trait_method_id != id => {
            debug!("lookup: trait_method_id={:?}", trait_method_id);
            return lookup(tcx, trait_method_id)
        }
        _ => {}
    }

    let item_stab = if is_local(id) {
        tcx.stability.borrow().local.get(&id.node).cloned()
    } else {
        let stab = csearch::get_stability(&tcx.sess.cstore, id);
        let mut index = tcx.stability.borrow_mut();
        (*index).extern_cache.insert(id, stab.clone());
        stab
    };

    item_stab.or_else(|| {
        if let Some(trait_id) = ty::trait_id_of_impl(tcx, id) {
            // FIXME (#18969): for the time being, simply use the
            // stability of the trait to determine the stability of any
            // unmarked impls for it. See FIXME above for more details.

            debug!("lookup: trait_id={:?}", trait_id);
            lookup(tcx, trait_id)
        } else {
            None
        }
    })
}
/// Lookup the stability for a node, loading external crate
/// metadata as necessary.
Lookup the stability for a node, loading external crate
metadata as necessary.
Lookup the stability for a node loading external crate metadata as necessary .
pub fn lookup(tcx: &ty::ctxt, id: DefId) -> Option<Stability> {
    debug!("lookup(id={})",
           id.repr(tcx));
    // is this definition the implementation of a trait method?
    match ty::trait_item_of_item(tcx, id) {
        Some(ty::MethodTraitItemId(trait_method_id)) if trait_method_id != id => {
            debug!("lookup: trait_method_id={:?}", trait_method_id);
            return lookup(tcx, trait_method_id)
        }
        _ => {}
    }
    let item_stab = if is_local(id) {
        tcx.stability.borrow().local.get(&id.node).cloned()
    } else {
        let stab = csearch::get_stability(&tcx.sess.cstore, id);
        let mut index = tcx.stability.borrow_mut();
        (*index).extern_cache.insert(id, stab.clone());
        stab
    };
    item_stab.or_else(|| {
        if let Some(trait_id) = ty::trait_id_of_impl(tcx, id) {
            // FIXME (#18969): for the time being, simply use the
            // stability of the trait to determine the stability of any
            // unmarked impls for it. See FIXME above for more details.
            debug!("lookup: trait_id={:?}", trait_id);
            lookup(tcx, trait_id)
        } else {
            None
        }
    })
}
pub fn lookup ( tcx : & ty :: ctxt , id : DefId ) -> Option < Stability > { debug ! ( " " id repr ( tcx ) ) ; // is this definition the implementation of a trait method? match ty :: trait_item_of_item ( tcx , id ) { Some ( ty :: MethodTraitItemId ( trait_method_id ) ) if trait_method_id != id => { debug ! ( " " trait_method_id ) ; return lookup ( tcx , trait_method_id ) } _ => { } } let item_stab = if is_local ( id ) { tcx . stability . borrow ( ) . local . get ( & id . node ) . cloned ( ) } else { let stab = csearch :: get_stability ( & tcx . sess . cstore , id ) ; let mut index = tcx . stability . borrow_mut ( ) ; ( * index ) . extern_cache . insert ( id , stab . clone ( ) ) ; stab } ; item_stab . or_else ( | | { if let Some ( trait_id ) = ty :: trait_id_of_impl ( tcx , id ) { // FIXME (#18969): for the time being, simply use the // stability of the trait to determine the stability of any // unmarked impls for it. See FIXME above for more details. debug ! ( " " trait_id ) ; lookup ( tcx , trait_id ) } else { None } } ) }
Lookup the stability for a node, loading external crate
metadata as necessary.
Lookup the stability for a node loading external crate metadata as necessary .
tcx
&ty::ctxt
id
DefId
tcx
&ty::ctxt
id
DefId