Skip to content

Commit 8afba45

Browse files
committed
Report trait/impl sig inconsistency before method/body inconsistency
Closes #15657.
1 parent 443267c commit 8afba45

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
@@ -758,16 +758,6 @@ pub fn check_item(ccx: &CrateCtxt, it: &ast::Item) {
758758
debug!("ItemImpl {} with id {}", token::get_ident(it.ident), it.id);
759759

760760
let impl_pty = ty::lookup_item_type(ccx.tcx, ast_util::local_def(it.id));
761-
for impl_item in impl_items.iter() {
762-
match *impl_item {
763-
ast::MethodImplItem(ref m) => {
764-
check_method_body(ccx, &impl_pty.generics, &**m);
765-
}
766-
ast::TypeImplItem(_) => {
767-
// Nothing to do here.
768-
}
769-
}
770-
}
771761

772762
match *opt_trait_ref {
773763
Some(ref ast_trait_ref) => {
@@ -782,6 +772,17 @@ pub fn check_item(ccx: &CrateCtxt, it: &ast::Item) {
782772
None => { }
783773
}
784774

775+
for impl_item in impl_items.iter() {
776+
match *impl_item {
777+
ast::MethodImplItem(ref m) => {
778+
check_method_body(ccx, &impl_pty.generics, &**m);
779+
}
780+
ast::TypeImplItem(_) => {
781+
// Nothing to do here.
782+
}
783+
}
784+
}
785+
785786
}
786787
ast::ItemTrait(_, _, _, ref trait_methods) => {
787788
let trait_def = ty::lookup_trait_def(ccx.tcx, local_def(it.id));

0 commit comments

Comments
 (0)