pub fn check_expr(tcx: &ty::ctxt, e: &ast::Expr,
                  cb: &mut FnMut(ast::DefId, Span, &Option<Stability>)) {
    if is_internal(tcx, e.span) { return; }

    let mut span = e.span;

    let id = match e.node {
        ast::ExprPath(..) | ast::ExprQPath(..) | ast::ExprStruct(..) => {
            match tcx.def_map.borrow().get(&e.id) {
                Some(&def) => def.def_id(),
                None => return
            }
        }
        ast::ExprMethodCall(i, _, _) => {
            span = i.span;
            let method_call = ty::MethodCall::expr(e.id);
            match tcx.method_map.borrow().get(&method_call) {
                Some(method) => {
                    match method.origin {
                        ty::MethodStatic(def_id) => {
                            def_id
                        }
                        ty::MethodStaticClosure(def_id) => {
                            def_id
                        }
                        ty::MethodTypeParam(ty::MethodParam {
                            ref trait_ref,
                            method_num: index,
                            ..
                        }) |
                        ty::MethodTraitObject(ty::MethodObject {
                            ref trait_ref,
                            method_num: index,
                            ..
                        }) => {
                            ty::trait_item(tcx, trait_ref.def_id, index).def_id()
                        }
                    }
                }
                None => return
            }
        }
        _ => return
    };

    maybe_do_stability_check(tcx, id, span, cb);
}
/// 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_expr(tcx: &ty::ctxt, e: &ast::Expr,
                  cb: &mut FnMut(ast::DefId, Span, &Option<Stability>)) {
    if is_internal(tcx, e.span) { return; }
    let mut span = e.span;
    let id = match e.node {
        ast::ExprPath(..) | ast::ExprQPath(..) | ast::ExprStruct(..) => {
            match tcx.def_map.borrow().get(&e.id) {
                Some(&def) => def.def_id(),
                None => return
            }
        }
        ast::ExprMethodCall(i, _, _) => {
            span = i.span;
            let method_call = ty::MethodCall::expr(e.id);
            match tcx.method_map.borrow().get(&method_call) {
                Some(method) => {
                    match method.origin {
                        ty::MethodStatic(def_id) => {
                            def_id
                        }
                        ty::MethodStaticClosure(def_id) => {
                            def_id
                        }
                        ty::MethodTypeParam(ty::MethodParam {
                            ref trait_ref,
                            method_num: index,
                            ..
                        }) |
                        ty::MethodTraitObject(ty::MethodObject {
                            ref trait_ref,
                            method_num: index,
                            ..
                        }) => {
                            ty::trait_item(tcx, trait_ref.def_id, index).def_id()
                        }
                    }
                }
                None => return
            }
        }
        _ => return
    };
    maybe_do_stability_check(tcx, id, span, cb);
}
pub fn check_expr ( tcx : & ty :: ctxt , e : & ast :: Expr , cb : & mut FnMut ( ast :: DefId , Span , & Option < Stability > ) ) { if is_internal ( tcx , e . span ) { return ; } let mut span = e . span ; let id = match e . node { ast :: ExprPath ( .. ) | ast :: ExprQPath ( .. ) | ast :: ExprStruct ( .. ) => { match tcx . def_map . borrow ( ) . get ( & e . id ) { Some ( & def ) => def . def_id ( ) , None => return } } ast :: ExprMethodCall ( i , _ , _ ) => { span = i . span ; let method_call = ty :: MethodCall :: expr ( e . id ) ; match tcx . method_map . borrow ( ) . get ( & method_call ) { Some ( method ) => { match method . origin { ty :: MethodStatic ( def_id ) => { def_id } ty :: MethodStaticClosure ( def_id ) => { def_id } ty :: MethodTypeParam ( ty :: MethodParam { ref trait_ref , method_num : index , .. } ) | ty :: MethodTraitObject ( ty :: MethodObject { ref trait_ref , method_num : index , .. } ) => { ty :: trait_item ( tcx , trait_ref . def_id , index ) . def_id ( ) } } } None => return } } _ => return } ; maybe_do_stability_check ( tcx , id , span , cb ) ; }
Helper for discovering nodes to check for stability
Helper for discovering nodes to check for stability
tcx
&ty::ctxt
e
&ast::Expr
cb
&mut FnMut(ast::DefId, Span, &Option<Stability>)
tcx
&ty::ctxt
e
&ast::Expr
cb
&mut FnMut(ast::DefId, Span, &Option<Stability>)