Skip to content

Commit 073a1ab

Browse files
committed
Report trait/impl sig inconsistency before method/body inconsistency
Closes #15657.
1 parent 042cdee commit 073a1ab

File tree

1 file changed

+11
-10
lines changed
  • src/librustc/middle/typeck/check

1 file changed

+11
-10
lines changed

src/librustc/middle/typeck/check/mod.rs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -693,16 +693,6 @@ pub fn check_item(ccx: &CrateCtxt, it: &ast::Item) {
693693
debug!("ItemImpl {} with id {}", token::get_ident(it.ident), it.id);
694694

695695
let impl_pty = ty::lookup_item_type(ccx.tcx, ast_util::local_def(it.id));
696-
for impl_item in impl_items.iter() {
697-
match *impl_item {
698-
ast::MethodImplItem(ref m) => {
699-
check_method_body(ccx, &impl_pty.generics, &**m);
700-
}
701-
ast::TypeImplItem(_) => {
702-
// Nothing to do here.
703-
}
704-
}
705-
}
706696

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

710+
for impl_item in impl_items.iter() {
711+
match *impl_item {
712+
ast::MethodImplItem(ref m) => {
713+
check_method_body(ccx, &impl_pty.generics, &**m);
714+
}
715+
ast::TypeImplItem(_) => {
716+
// Nothing to do here.
717+
}
718+
}
719+
}
720+
720721
}
721722
ast::ItemTrait(_, _, _, ref trait_methods) => {
722723
let trait_def = ty::lookup_trait_def(ccx.tcx, local_def(it.id));

0 commit comments

Comments
 (0)