Skip to content

Commit

Permalink
Report trait/impl sig inconsistency before method/body inconsistency
Browse files Browse the repository at this point in the history
Closes #15657.
  • Loading branch information
ftxqxd committed Oct 3, 2014
1 parent 042cdee commit 073a1ab
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions src/librustc/middle/typeck/check/mod.rs
Expand Up @@ -693,16 +693,6 @@ pub fn check_item(ccx: &CrateCtxt, it: &ast::Item) {
debug!("ItemImpl {} with id {}", token::get_ident(it.ident), it.id);

let impl_pty = ty::lookup_item_type(ccx.tcx, ast_util::local_def(it.id));
for impl_item in impl_items.iter() {
match *impl_item {
ast::MethodImplItem(ref m) => {
check_method_body(ccx, &impl_pty.generics, &**m);
}
ast::TypeImplItem(_) => {
// Nothing to do here.
}
}
}

match *opt_trait_ref {
Some(ref ast_trait_ref) => {
Expand All @@ -717,6 +707,17 @@ pub fn check_item(ccx: &CrateCtxt, it: &ast::Item) {
None => { }
}

for impl_item in impl_items.iter() {
match *impl_item {
ast::MethodImplItem(ref m) => {
check_method_body(ccx, &impl_pty.generics, &**m);
}
ast::TypeImplItem(_) => {
// Nothing to do here.
}
}
}

}
ast::ItemTrait(_, _, _, ref trait_methods) => {
let trait_def = ty::lookup_trait_def(ccx.tcx, local_def(it.id));
Expand Down

0 comments on commit 073a1ab

Please sign in to comment.