pub fn check_item(tcx: &ty::ctxt, item: &ast::Item,
                  cb: &mut FnMut(ast::DefId, Span, &Option<Stability>)) {
    match item.node {
        ast::ItemExternCrate(_) => {
            // compiler-generated `extern crate` items have a dummy span.
            if item.span == DUMMY_SP { return }

            let cnum = match tcx.sess.cstore.find_extern_mod_stmt_cnum(item.id) {
                Some(cnum) => cnum,
                None => return,
            };
            let id = ast::DefId { krate: cnum, node: ast::CRATE_NODE_ID };
            maybe_do_stability_check(tcx, id, item.span, cb);
        }
        ast::ItemTrait(_, _, ref supertraits, _) => {
            for t in supertraits.iter() {
                if let ast::TraitTyParamBound(ref t, _) = *t {
                    let id = ty::trait_ref_to_def_id(tcx, &t.trait_ref);
                    maybe_do_stability_check(tcx, id, t.trait_ref.path.span, cb);
                }
            }
        }
        ast::ItemImpl(_, _, _, Some(ref t), _, _) => {
            let id = ty::trait_ref_to_def_id(tcx, t);
            maybe_do_stability_check(tcx, id, t.path.span, cb);
        }
        _ => (/* pass */)
    }
}
/// Helper for discovering nodes to check for stability
Helper for discovering nodes to check for stability
Helper for discovering nodes to check for stability
pub fn check_item(tcx: &ty::ctxt, item: &ast::Item,
                  cb: &mut FnMut(ast::DefId, Span, &Option<Stability>)) {
    match item.node {
        ast::ItemExternCrate(_) => {
            // compiler-generated `extern crate` items have a dummy span.
            if item.span == DUMMY_SP { return }
            let cnum = match tcx.sess.cstore.find_extern_mod_stmt_cnum(item.id) {
                Some(cnum) => cnum,
                None => return,
            };
            let id = ast::DefId { krate: cnum, node: ast::CRATE_NODE_ID };
            maybe_do_stability_check(tcx, id, item.span, cb);
        }
        ast::ItemTrait(_, _, ref supertraits, _) => {
            for t in supertraits.iter() {
                if let ast::TraitTyParamBound(ref t, _) = *t {
                    let id = ty::trait_ref_to_def_id(tcx, &t.trait_ref);
                    maybe_do_stability_check(tcx, id, t.trait_ref.path.span, cb);
                }
            }
        }
        ast::ItemImpl(_, _, _, Some(ref t), _, _) => {
            let id = ty::trait_ref_to_def_id(tcx, t);
            maybe_do_stability_check(tcx, id, t.path.span, cb);
        }
        _ => (/* pass */)
    }
}
pub fn check_item ( tcx : & ty :: ctxt , item : & ast :: Item , cb : & mut FnMut ( ast :: DefId , Span , & Option < Stability > ) ) { match item . node { ast :: ItemExternCrate ( _ ) => { // compiler-generated `extern crate` items have a dummy span. if item . span == DUMMY_SP { return } let cnum = match tcx . sess . cstore . find_extern_mod_stmt_cnum ( item . id ) { Some ( cnum ) => cnum , None => return , } ; let id = ast :: DefId { krate : cnum , node : ast :: CRATE_NODE_ID } ; maybe_do_stability_check ( tcx , id , item . span , cb ) ; } ast :: ItemTrait ( _ , _ , ref supertraits , _ ) => { for t in supertraits . iter ( ) { if let ast :: TraitTyParamBound ( ref t , _ ) = * t { let id = ty :: trait_ref_to_def_id ( tcx , & t . trait_ref ) ; maybe_do_stability_check ( tcx , id , t . trait_ref . path . span , cb ) ; } } } ast :: ItemImpl ( _ , _ , _ , Some ( ref t ) , _ , _ ) => { let id = ty :: trait_ref_to_def_id ( tcx , t ) ; maybe_do_stability_check ( tcx , id , t . path . span , cb ) ; } _ => ( /* pass */ ) } }
Helper for discovering nodes to check for stability
Helper for discovering nodes to check for stability
tcx
&ty::ctxt
item
&ast::Item
cb
&mut FnMut(ast::DefId, Span, &Option<Stability>)
tcx
&ty::ctxt
item
&ast::Item
cb
&mut FnMut(ast::DefId, Span, &Option<Stability>)