fn method_is_private(&mut self, span: Span, method_id: NodeId) -> bool {
        let check = |vis: visibility, container_id: DefId| {
            let mut is_private = false;
            if vis == private {
                is_private = true;
            } else if vis == public {
                is_private = false;
            } else {
                // Look up the enclosing impl.
                if container_id.crate != LOCAL_CRATE {
                    self.tcx.sess.span_bug(span,
                                      "local method isn't in local \
                                       impl?!");
                }

                match self.tcx.items.find(&container_id.node) {
                    Some(&node_item(item, _)) => {
                        match item.node {
                            item_impl(_, None, _, _)
                                    if item.vis != public => {
                                is_private = true;
                            }
                            _ => {}
                        }
                    }
                    Some(_) => {
                        self.tcx.sess.span_bug(span, "impl wasn't an item?!");
                    }
                    None => {
                        self.tcx.sess.span_bug(span, "impl wasn't in AST map?!");
                    }
                }
            }

            is_private
        };

        match self.tcx.items.find(&method_id) {
            Some(&node_method(method, impl_id, _)) => {
                check(method.vis, impl_id)
            }
            Some(&node_trait_method(trait_method, trait_id, _)) => {
                match *trait_method {
                    required(_) => check(public, trait_id),
                    provided(method) => check(method.vis, trait_id),
                }
            }
            Some(_) => {
                self.tcx.sess.span_bug(span,
                                  fmt!("method_is_private: method was a %s?!",
                                       ast_map::node_id_to_str(
                                            self.tcx.items,
                                            method_id,
                                           token::get_ident_interner())));
            }
            None => {
                self.tcx.sess.span_bug(span, "method not found in \
                                         AST map?!");
            }
        }
    }
// Returns true if a crate-local method is private and false otherwise.
Returns true if a crate-local method is private and false otherwise.
Returns true if a crate - local method is private and false otherwise .
fn method_is_private(&mut self, span: Span, method_id: NodeId) -> bool {
        let check = |vis: visibility, container_id: DefId| {
            let mut is_private = false;
            if vis == private {
                is_private = true;
            } else if vis == public {
                is_private = false;
            } else {
                // Look up the enclosing impl.
                if container_id.crate != LOCAL_CRATE {
                    self.tcx.sess.span_bug(span,
                                      "local method isn't in local \
                                       impl?!");
                }
                match self.tcx.items.find(&container_id.node) {
                    Some(&node_item(item, _)) => {
                        match item.node {
                            item_impl(_, None, _, _)
                                    if item.vis != public => {
                                is_private = true;
                            }
                            _ => {}
                        }
                    }
                    Some(_) => {
                        self.tcx.sess.span_bug(span, "impl wasn't an item?!");
                    }
                    None => {
                        self.tcx.sess.span_bug(span, "impl wasn't in AST map?!");
                    }
                }
            }
            is_private
        };
        match self.tcx.items.find(&method_id) {
            Some(&node_method(method, impl_id, _)) => {
                check(method.vis, impl_id)
            }
            Some(&node_trait_method(trait_method, trait_id, _)) => {
                match *trait_method {
                    required(_) => check(public, trait_id),
                    provided(method) => check(method.vis, trait_id),
                }
            }
            Some(_) => {
                self.tcx.sess.span_bug(span,
                                  fmt!("method_is_private: method was a %s?!",
                                       ast_map::node_id_to_str(
                                            self.tcx.items,
                                            method_id,
                                           token::get_ident_interner())));
            }
            None => {
                self.tcx.sess.span_bug(span, "method not found in \
                                         AST map?!");
            }
        }
    }
fn method_is_private ( & mut self , span : Span , method_id : NodeId ) -> bool { let check = | vis : visibility , container_id : DefId | { let mut is_private = false ; if vis == private { is_private = true ; } else if vis == public { is_private = false ; } else { // Look up the enclosing impl. if container_id . crate != LOCAL_CRATE { self . tcx . sess . span_bug ( span , " \
 " ) ; } match self . tcx . items . find ( & container_id . node ) { Some ( & node_item ( item , _ ) ) => { match item . node { item_impl ( _ , None , _ , _ ) if item . vis != public => { is_private = true ; } _ => { } } } Some ( _ ) => { self . tcx . sess . span_bug ( span , " " ) ; } None => { self . tcx . sess . span_bug ( span , " " ) ; } } } is_private } ; match self . tcx . items . find ( & method_id ) { Some ( & node_method ( method , impl_id , _ ) ) => { check ( method . vis , impl_id ) } Some ( & node_trait_method ( trait_method , trait_id , _ ) ) => { match * trait_method { required ( _ ) => check ( public , trait_id ) , provided ( method ) => check ( method . vis , trait_id ) , } } Some ( _ ) => { self . tcx . sess . span_bug ( span , fmt ! ( " " ast_map node_id_to_str ( self tcx items method_id token get_ident_interner ( ) ) ) ) ; } None => { self . tcx . sess . span_bug ( span , " \
 " ) ; } } }
Returns true if a crate-local method is private and false otherwise.
Returns true if a crate - local method is private and false otherwise .
&mut self
span
Span
method_id
NodeId
&mut self
span
Span
method_id
NodeId