fn check_method(&mut self, span: Span, origin: &method_origin, ident: ast::Ident) {
        match *origin {
            method_static(method_id) => {
                self.check_method_common(span, method_id, &ident)
            }
            method_param(method_param {
                trait_id: trait_id,
                method_num: method_num,
                 _
            }) |
            method_object(method_object {
                trait_id: trait_id,
                method_num: method_num,
                 _
            }) => {
                if trait_id.crate == LOCAL_CRATE {
                    match self.tcx.items.find(&trait_id.node) {
                        Some(&node_item(item, _)) => {
                            match item.node {
                                item_trait(_, _, ref methods) => {
                                    if method_num >= (*methods).len() {
                                        self.tcx.sess.span_bug(span,
                                                               "method number out of range?!");
                                    }
                                    match (*methods)[method_num] {
                                        provided(method)
                                             if method.vis == private &&
                                             !self.privileged_items.iter()
                                             .any(|x| x == &(trait_id.node)) => {
                                            self.tcx.sess.span_err(span,
                                                              fmt!("method `%s` is private",
                                                                   token::ident_to_str(&method
                                                                                        .ident)));
                                        }
                                        provided(_) | required(_) => {
                                            // Required methods can't be
                                            // private.
                                        }
                                    }
                                }
                                _ => {
                                    self.tcx.sess.span_bug(span, "trait wasn't actually a trait?!");
                                }
                            }
                        }
                        Some(_) => {
                            self.tcx.sess.span_bug(span, "trait wasn't an item?!");
                        }
                        None => {
                            self.tcx.sess.span_bug(span,
                                                   "trait item wasn't found in the AST map?!");
                        }
                    }
                } else {
                    // FIXME #4732: External crates.
                }
            }
        }
    }
// Checks that a private method is in scope.
Checks that a private method is in scope.
Checks that a private method is in scope .
fn check_method(&mut self, span: Span, origin: &method_origin, ident: ast::Ident) {
        match *origin {
            method_static(method_id) => {
                self.check_method_common(span, method_id, &ident)
            }
            method_param(method_param {
                trait_id: trait_id,
                method_num: method_num,
                 _
            }) |
            method_object(method_object {
                trait_id: trait_id,
                method_num: method_num,
                 _
            }) => {
                if trait_id.crate == LOCAL_CRATE {
                    match self.tcx.items.find(&trait_id.node) {
                        Some(&node_item(item, _)) => {
                            match item.node {
                                item_trait(_, _, ref methods) => {
                                    if method_num >= (*methods).len() {
                                        self.tcx.sess.span_bug(span,
                                                               "method number out of range?!");
                                    }
                                    match (*methods)[method_num] {
                                        provided(method)
                                             if method.vis == private &&
                                             !self.privileged_items.iter()
                                             .any(|x| x == &(trait_id.node)) => {
                                            self.tcx.sess.span_err(span,
                                                              fmt!("method `%s` is private",
                                                                   token::ident_to_str(&method
                                                                                        .ident)));
                                        }
                                        provided(_) | required(_) => {
                                            // Required methods can't be
                                            // private.
                                        }
                                    }
                                }
                                _ => {
                                    self.tcx.sess.span_bug(span, "trait wasn't actually a trait?!");
                                }
                            }
                        }
                        Some(_) => {
                            self.tcx.sess.span_bug(span, "trait wasn't an item?!");
                        }
                        None => {
                            self.tcx.sess.span_bug(span,
                                                   "trait item wasn't found in the AST map?!");
                        }
                    }
                } else {
                    // FIXME #4732: External crates.
                }
            }
        }
    }
fn check_method ( & mut self , span : Span , origin : & method_origin , ident : ast :: Ident ) { match * origin { method_static ( method_id ) => { self . check_method_common ( span , method_id , & ident ) } method_param ( method_param { trait_id : trait_id , method_num : method_num , _ } ) | method_object ( method_object { trait_id : trait_id , method_num : method_num , _ } ) => { if trait_id . crate == LOCAL_CRATE { match self . tcx . items . find ( & trait_id . node ) { Some ( & node_item ( item , _ ) ) => { match item . node { item_trait ( _ , _ , ref methods ) => { if method_num >= ( * methods ) . len ( ) { self . tcx . sess . span_bug ( span , " " ) ; } match ( * methods ) [ method_num ] { provided ( method ) if method . vis == private && ! self . privileged_items . iter ( ) . any ( | x | x == & ( trait_id . node ) ) => { self . tcx . sess . span_err ( span , fmt ! ( " " token ident_to_str ( method ident ) ) ) ; } provided ( _ ) | required ( _ ) => { // Required methods can't be // private. } } } _ => { self . tcx . sess . span_bug ( span , " " ) ; } } } Some ( _ ) => { self . tcx . sess . span_bug ( span , " " ) ; } None => { self . tcx . sess . span_bug ( span , " " ) ; } } } else { // FIXME #4732: External crates. } } } }
Checks that a private method is in scope.
Checks that a private method is in scope .
&mut self
span
Span
origin
&method_origin
ident
ast::Ident
&mut self
span
Span
origin
&method_origin
ident
ast::Ident